{"id":13412832,"url":"https://github.com/c9s/bbgo","last_synced_at":"2025-05-14T03:08:28.301Z","repository":{"id":36953012,"uuid":"301345449","full_name":"c9s/bbgo","owner":"c9s","description":"The modern cryptocurrency trading bot framework written in Go.","archived":false,"fork":false,"pushed_at":"2025-04-10T10:06:26.000Z","size":178295,"stargazers_count":1325,"open_issues_count":142,"forks_count":306,"subscribers_count":31,"default_branch":"main","last_synced_at":"2025-04-10T10:41:47.516Z","etag":null,"topics":["binance","bitcoin","crypto","cryptocurrency","trading","trading-bot"],"latest_commit_sha":null,"homepage":"https://bbgo.finance","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/c9s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"c9s","custom":["https://etherscan.io/address/0x5ed8508e3d046cbe9ff44d6063e29349000c8ddd"]}},"created_at":"2020-10-05T08:45:21.000Z","updated_at":"2025-04-10T09:14:05.000Z","dependencies_parsed_at":"2023-09-26T11:51:56.226Z","dependency_job_id":"4985fbce-5655-4441-b1c3-8232ed2cd7fa","html_url":"https://github.com/c9s/bbgo","commit_stats":{"total_commits":7943,"total_committers":68,"mean_commits":"116.80882352941177","dds":"0.23870074279239584","last_synced_commit":"b07c26a1b5a6ad24a216f6d97cc59973150ac5d6"},"previous_names":[],"tags_count":139,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c9s%2Fbbgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c9s%2Fbbgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c9s%2Fbbgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c9s%2Fbbgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/c9s","download_url":"https://codeload.github.com/c9s/bbgo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261935,"owners_count":21074226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binance","bitcoin","crypto","cryptocurrency","trading","trading-bot"],"created_at":"2024-07-30T20:01:29.806Z","updated_at":"2025-04-10T17:20:02.156Z","avatar_url":"https://github.com/c9s.png","language":"Go","readme":"* [English👈](./README.md)\n* [中文](./README.zh_TW.md)\n\n# BBGO\n\nA modern crypto trading bot framework written in Go.\n\n## Current Status\n\n[![Go](https://github.com/c9s/bbgo/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/c9s/bbgo/actions/workflows/go.yml)\n[![GoDoc](https://godoc.org/github.com/c9s/bbgo?status.svg)](https://pkg.go.dev/github.com/c9s/bbgo)\n[![Go Report Card](https://goreportcard.com/badge/github.com/c9s/bbgo)](https://goreportcard.com/report/github.com/c9s/bbgo)\n[![DockerHub](https://img.shields.io/docker/pulls/yoanlin/bbgo.svg)](https://hub.docker.com/r/yoanlin/bbgo)\n[![Coverage Status](http://codecov.io/github/c9s/bbgo/coverage.svg?branch=main)](http://codecov.io/github/c9s/bbgo?branch=main)\n\u003cimg alt=\"open collective badge\" src=\"https://opencollective.com/bbgo/tiers/badge.svg\"\u003e\n\u003cimg alt=\"open collective badge\" src=\"https://opencollective.com/bbgo/tiers/backer/badge.svg?label=backer\u0026color=brightgreen\" /\u003e\n\n## Community\n\n[![Telegram Global](https://img.shields.io/badge/telegram-global-blue.svg)](https://t.me/bbgo_intl)\n[![Telegram Taiwan](https://img.shields.io/badge/telegram-tw-blue.svg)](https://t.me/bbgocrypto)\n[![Twitter](https://img.shields.io/twitter/follow/bbgotrading?label=Follow\u0026style=social)](https://twitter.com/bbgotrading)\n\n## What You Can Do With BBGO\n\n### Trading Bot Users 💁‍♀️ 💁‍♂️\n\nYou can use BBGO to run the built-in strategies.\n\n### Strategy Developers 🥷\n\nYou can use BBGO's trading unit and back-test unit to implement your own strategies.\n\n### Trading Unit Developers 🧑‍💻\n\nYou can use BBGO's underlying common exchange API; currently, it supports 4+ major exchanges, so you don't have to repeat\nthe implementation.\n\n## Features\n\n- Exchange abstraction interface.\n- Stream integration (user data web socket, market data web socket).\n- Real-time orderBook integration through a web socket.\n- TWAP order execution support. See [TWAP Order Execution](./doc/topics/twap.md)\n- PnL calculation.\n- Slack/Telegram notification.\n- Back-testing: KLine-based back-testing engine. See [Back-testing](./doc/topics/back-testing.md)\n- Built-in parameter optimization tool.\n- Built-in Grid strategy and many other built-in strategies.\n- Multi-exchange session support: you can connect to more than 2 exchanges with different accounts or subaccounts.\n- Indicators with interface similar\n  to `pandas.Series`([series](https://github.com/c9s/bbgo/blob/main/doc/development/series.md))([usage](https://github.com/c9s/bbgo/blob/main/doc/development/indicator.md)):\n    - [Accumulation/Distribution Indicator](./pkg/indicator/ad.go)\n    - [Arnaud Legoux Moving Average](./pkg/indicator/alma.go)\n    - [Average True Range](./pkg/indicator/atr.go)\n    - [Bollinger Bands](./pkg/indicator/boll.go)\n    - [Commodity Channel Index](./pkg/indicator/cci.go)\n    - [Cumulative Moving Average](./pkg/indicator/cma.go)\n    - [Double Exponential Moving Average](./pkg/indicator/dema.go)\n    - [Directional Movement Index](./pkg/indicator/dmi.go)\n    - [Brownian Motion's Drift Factor](./pkg/indicator/drift.go)\n    - [Ease of Movement](./pkg/indicator/emv.go)\n    - [Exponentially Weighted Moving Average](./pkg/indicator/ewma.go)\n    - [Hull Moving Average](./pkg/indicator/hull.go)\n    - [Trend Line (Tool)](./pkg/indicator/line.go)\n    - [Moving Average Convergence Divergence Indicator](./pkg/indicator/macd.go)\n    - [On-Balance Volume](./pkg/indicator/obv.go)\n    - [Pivot](./pkg/indicator/pivot.go)\n    - [Running Moving Average](./pkg/indicator/rma.go)\n    - [Relative Strength Index](./pkg/indicator/rsi.go)\n    - [Simple Moving Average](./pkg/indicator/sma.go)\n    - [Ehler's Super Smoother Filter](./pkg/indicator/ssf.go)\n    - [Stochastic Oscillator](./pkg/indicator/stoch.go)\n    - [SuperTrend](./pkg/indicator/supertrend.go)\n    - [Triple Exponential Moving Average](./pkg/indicator/tema.go)\n    - [Tillson T3 Moving Average](./pkg/indicator/till.go)\n    - [Triangular Moving Average](./pkg/indicator/tma.go)\n    - [Variable Index Dynamic Average](./pkg/indicator/vidya.go)\n    - [Volatility Indicator](./pkg/indicator/volatility.go)\n    - [Volume Weighted Average Price](./pkg/indicator/vwap.go)\n    - [Zero Lag Exponential Moving Average](./pkg/indicator/zlema.go)\n    - And more...\n- HeikinAshi OHLC / Normal OHLC (check [this config](https://github.com/c9s/bbgo/blob/main/config/skeleton.yaml#L5))\n- React-powered Web Dashboard.\n- Docker image ready.\n- Kubernetes support.\n- Helm chart ready.\n- High precision float point (up to 16 digits, run with `-tags dnum`).\n\n## Screenshots\n\n![bbgo dashboard](assets/screenshots/dashboard.jpeg)\n\n![bbgo backtest report](assets/screenshots/backtest-report.jpg)\n\n## Built-in Strategies\n\n| strategy    | description                                                                                                                             | type       | backtest support |\n|-------------|-----------------------------------------------------------------------------------------------------------------------------------------|------------|------------------|\n| grid        | the first generation grid strategy, it provides more flexibility, but you need to prepare inventories                                   | maker      |                  |\n| grid2       | the second generation grid strategy, it can convert your quote asset into a grid, supports base+quote mode                              | maker      |                  |\n| bollgrid    | strategy implements a basic grid strategy with the built-in bollinger indicator                                                         | maker      |                  | \n| xmaker      | cross exchange market making strategy, it hedges your inventory risk on the other side                                                  | maker      | no               |\n| xnav        | this strategy helps you record the current net asset value                                                                              | tool       | no               |\n| xalign      | this strategy aligns your balance position automatically                                                                                | tool       | no               |\n| xfunding    | a funding rate fee strategy                                                                                                             | funding    | no               |\n| autoborrow  | this strategy uses margin to borrow assets, to help you keep a minimal balance                                                        | tool       | no               |\n| pivotshort  | this strategy finds the pivot low and enters the trade when the price breaks the previous low                                            | long/short |                  |\n| schedule    | this strategy buy/sell with a fixed quantity periodically, you can use this as a single DCA, or to refill the fee asset like BNB.       | tool       |\n| irr         | this strategy opens the position based on the predicated return rate                                                                    | long/short |                  |\n| bollmaker   | this strategy holds a long-term long/short position, places maker orders on both sides, and uses a bollinger band to control the position size | maker      |                  |\n| wall        | this strategy creates a wall (large amount of order) on the order book                                                                       | maker      | no               |\n| scmaker     | this market making strategy is designed for stable coin markets, like USDC/USDT                                                         | maker      |                  |\n| drift       |                                                                                                                                         | long/short |                  |\n| rsicross    | this strategy opens a long position when the fast rsi crosses over the slow rsi, this is a demo strategy for using the v2 indicator       | long/short |                  |\n| marketcap   | this strategy implements a strategy that rebalances the portfolio based on the market capitalization                                    | rebalance  | no               |\n| supertrend  | this strategy uses DEMA and Supertrend indicator to open the long/short position                                                        | long/short |                  |\n| trendtrader | this strategy opens a long/short position based on the trendline breakout                                                                 | long/short |                  |\n| elliottwave |                                                                                                                                         | long/short |                  |\n| ewoDgtrd    |                                                                                                                                         | long/short |                  |\n| fixedmaker  |                                                                                                                                         | maker      |                  |\n| factoryzoo  |                                                                                                                                         | long/short |                  |\n| fmaker      |                                                                                                                                         | maker      |                  |\n| linregmaker | a linear regression based market maker                                                                                                  | maker      |                  |\n| convert     | convert strategy is a tool that helps you convert a specific asset to a target asset                                                      | tool       | no               |\n\n\n\n\n## Supported Exchanges\n\n- Binance Spot Exchange (and binance.us)\n- OKX Spot Exchange (previous OKEX)\n- Kucoin Spot Exchange\n- MAX Spot Exchange (located in Taiwan)\n- Bitget Exchange\n- Bybit Exchange\n\n## Documentation and General Topics\n\n- Check the [documentation index](doc/README.md)\n\n## Requirements\n\n* Go SDK 1.22\n\n* Linux / MacOS / Windows (WSL)\n\n* Get your exchange API key and secret after you register the accounts (you can choose one or more exchanges):\n\n  - MAX: \u003chttps://max.maicoin.com/signup?r=c7982718\u003e\n  - Binance: \u003chttps://accounts.binance.com/en/register?ref=38192708\u003e\n  - OKEx: \u003chttps://www.okex.com/join/2412712?src=from:ios-share\u003e\n  - Kucoin: \u003chttps://www.kucoin.com/ucenter/signup?rcode=r3KX2D4\u003e\n\n  This project is maintained and supported by a small group of people. If you would like to support this project, please\n  Register on the exchanges using the provided links with the referral codes above.\n\n## Installation\n\n### Install from binary\n\nThe following script will help you set up a config file and a dotenv file:\n\n```sh\n# grid trading strategy for binance exchange\nbash \u003c(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-grid.sh) binance\n\n# grid trading strategy for max exchange\nbash \u003c(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-grid.sh) max\n\n# bollinger grid trading strategy for binance exchange\nbash \u003c(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-bollgrid.sh) binance\n\n# bollinger grid trading strategy for max exchange\nbash \u003c(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-bollgrid.sh) max\n```\n\nIf you already have configuration somewhere, a download-only script might be suitable for you:\n\n```sh\nbash \u003c(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/download.sh)\n```\n\nOr refer to the [Release Page](https://github.com/c9s/bbgo/releases) and download manually.\n\nSince v2, we've added a new float point implementation from dnum to support decimals with higher precision. To download \u0026\nsetup, please refer to [Dnum Installation](doc/topics/dnum-binary.md)\n\n### One-click Linode StackScript\n\nStackScript allows you to one-click deploy a lightweight instance with bbgo.\n\n- BBGO grid on Binance \u003chttps://cloud.linode.com/stackscripts/950715\u003e\n- BBGO grid USDT/TWD on MAX \u003chttps://cloud.linode.com/stackscripts/793380\u003e\n- BBGO grid USDC/TWD on MAX \u003chttps://cloud.linode.com/stackscripts/797776\u003e\n- BBGO grid LINK/TWD on MAX \u003chttps://cloud.linode.com/stackscripts/797774\u003e\n- BBGO grid USDC/USDT on MAX \u003chttps://cloud.linode.com/stackscripts/797777\u003e\n- BBGO grid on MAX \u003chttps://cloud.linode.com/stackscripts/795788\u003e\n- BBGO bollmaker on Binance \u003chttps://cloud.linode.com/stackscripts/1002384\u003e\n\n### Build from source\n\nSee [Build from source](./doc/build-from-source.md)\n\n## Configuration\n\nAdd your dotenv file:\n\n```sh\n# for Binance Exchange, if you have one\nBINANCE_API_KEY=\nBINANCE_API_SECRET=\n\n# if you want to use binance.us, change this to 1\nBINANCE_US=0\n\n# for MAX exchange, if you have one\nMAX_API_KEY=\nMAX_API_SECRET=\n\n# for OKEx exchange, if you have one\nOKEX_API_KEY=\nOKEX_API_SECRET=\nOKEX_API_PASSPHRASE\n\n# for kucoin exchange, if you have one\nKUCOIN_API_KEY=\nKUCOIN_API_SECRET=\nKUCOIN_API_PASSPHRASE=\nKUCOIN_API_KEY_VERSION=2\n\n# for Bybit exchange, if you have one\nBYBIT_API_KEY=\nBYBIT_API_SECRET=\n```\n\nPrepare your dotenv file `.env.local` and BBGO yaml config file `bbgo.yaml`.\n\nTo check the available environment variables, please see [Environment Variables](./doc/configuration/envvars.md)\n\nThe minimal bbgo.yaml could be generated by:\n\n```sh\ncurl -o bbgo.yaml https://raw.githubusercontent.com/c9s/bbgo/main/config/minimal.yaml\n```\n\nTo run strategy:\n\n```sh\nbbgo run\n```\n\nTo start bbgo with the frontend dashboard:\n\n```sh\nbbgo run --enable-webserver\n```\n\nIf you want to switch to another dotenv file, you can add an `--dotenv` option or `--config`:\n\n```sh\nbbgo sync --dotenv .env.dev --config config/grid.yaml --session binance\n```\n\nTo query transfer history:\n\n```sh\nbbgo transfer-history --session max --asset USDT --since \"2019-01-01\"\n```\n\n\u003c!--\nTo calculate pnl:\n\n```sh\nbbgo pnl --exchange binance --asset BTC --since \"2019-01-01\"\n```\n---\u003e\n\n## Advanced Configuration\n\n### Synchronize System Time With Binance\n\nBBGO provides the script for UNIX systems/subsystems to synchronize date with Binance. `jq` and `bc` are required to be\ninstalled in previous.\nTo install the dependencies in Ubuntu, try the following commands:\n\n```bash\nsudo apt install -y bc jq\n```\n\nAnd to synchronize the date, try:\n\n```bash\nsudo ./scripts/sync_time.sh\n```\n\nYou could also add the script to crontab so that the system time could get synchronized with Binance regularly.\n\n### Testnet (Paper Trading)\n\nCurrently only supports Binance testnet. To run bbgo in testnet, apply new API keys\nfrom [Binance Test Network](https://testnet.binance.vision), and set the following env before you start bbgo:\n\n```bash\nexport PAPER_TRADE=1\nexport DISABLE_MARKET_CACHE=1 # the symbols supported in testnet is far less than the mainnet\n```\n\n### Notification\n\n- [Setting up Telegram notification](./doc/configuration/telegram.md)\n- [Setting up Slack notification](./doc/configuration/slack.md)\n\n### Synchronizing Trading Data\n\nBy default, BBGO does not sync your trading data from the exchange sessions, so it's hard to calculate your profit and\nloss correctly.\n\nBy synchronizing trades and orders to the local database, you can earn some benefits like PnL calculations, backtesting\nand asset calculation.\n\nYou can only use one database driver MySQL or SQLite to store your trading data.\n\n**Notice**: SQLite is not fully supported, we recommend you use MySQL instead of SQLite.\n\n#### Configure MySQL Database\n\nTo use MySQL database for data syncing, first, you need to install your MySQL server:\n\n```sh\n# For Ubuntu Linux\nsudo apt-get install -y mysql-server\n\n# For newer Ubuntu Linux\nsudo apt install -y mysql-server\n```\n\nOr [run it in docker](https://hub.docker.com/_/mysql)\n\nCreate your mysql database:\n\n```sh\nmysql -uroot -e \"CREATE DATABASE bbgo CHARSET utf8\"\n```\n\nThen put these environment variables in your `.env.local` file:\n\n```sh\nDB_DRIVER=mysql\nDB_DSN=\"user:password@tcp(127.0.0.1:3306)/bbgo\"\n```\n\n#### Configure Sqlite3 Database\n\nTo use SQLite3 instead of MySQL, simply put these environment variables in your `.env.local` file:\n\n```sh\nDB_DRIVER=sqlite3\nDB_DSN=bbgo.sqlite3\n```\n\n## Synchronizing your own trading data\n\nOnce you have your database configured, you can sync your own trading data from the exchange.\n\nSee [Configure Sync For Private Trading Data](./doc/configuration/sync.md)\n\n## Using Redis to keep persistence between BBGO sessions\n\nTo use Redis, first you need to install your Redis server:\n\n```sh\n# For Ubuntu/Debian Linux\nsudo apt-get install -y redis\n\n# For newer Ubuntu/Debian Linux\nsudo apt install -y redis\n```\n\nSet the following environment variables in your `bbgo.yaml`:\n\n```yaml\npersistence:\n  redis:\n    host: 127.0.0.1  # The IP address or the hostname to your Redis server, 127.0.0.1 if same as BBGO  \n    port: 6379  # Port to Redis server, default 6379\n    db: 0  # DB number to use. You can set to another DB to avoid conflict if other applications are using Redis too.\n```\n\n## Built-in Strategies\n\nCheck out the strategy directory [strategy](pkg/strategy) for all built-in strategies:\n\n- `pricealert` strategy demonstrates how to use the notification system [pricealert](pkg/strategy/example/pricealert). See\n  [document](./doc/strategy/pricealert.md).\n- `buyandhold` strategy demonstrates how to subscribe kline events and submit market\n  order [buyandhold](pkg/strategy/example/pricedrop)\n- `bollgrid` strategy implements a basic grid strategy with the built-in bollinger\n  indicator [bollgrid](pkg/strategy/bollgrid)\n- `grid` strategy implements the fixed price band grid strategy [grid](pkg/strategy/grid). See\n  [document](./doc/strategy/grid.md).\n- `supertrend` strategy uses Supertrend indicator as trend, and DEMA indicator as noise\n  filter [supertrend](pkg/strategy/supertrend). See\n  [document](./doc/strategy/supertrend.md).\n- `support` strategy uses K-lines with high volume as support [support](pkg/strategy/support). See\n  [document](./doc/strategy/support.md).\n- `flashcrash` strategy implements a strategy that catches the flashcrash [flashcrash](pkg/strategy/flashcrash)\n- `marketcap` strategy implements a strategy that rebalances the portfolio based on the market\n  capitalization [marketcap](pkg/strategy/marketcap). See [document](./doc/strategy/marketcap.md).\n- `pivotshort` - shorting focused strategy.\n- `irr` - return rate strategy.\n- `drift` - drift strategy.\n- `grid2` - the second-generation grid strategy.\n- `rebalance` - rebalances your portfolio based on target weights. [rebalance](pkg/strategy/rebalance). See [document](./doc/strategy/rebalance.md).\n\nTo run these built-in strategies, just modify the config file to make the configuration suitable for you, for example, if\nyou want to run\n`buyandhold` strategy:\n\n```sh\nvim config/buyandhold.yaml\n\n# run bbgo with the config\nbbgo run --config config/buyandhold.yaml\n```\n\n## Back-testing\n\nSee [Back-testing](./doc/topics/back-testing.md)\n\n## Adding Strategy\n\nSee [Developing Strategy](./doc/topics/developing-strategy.md)\n\n## Write your own private strategy\n\nCreate your go package, initialize the repository with `go mod`, and add bbgo as a dependency:\n\n```sh\ngo mod init\ngo get github.com/c9s/bbgo@main\n```\n\nWrite your own strategy in the strategy file:\n\n```sh\nvim strategy.go\n```\n\nYou can grab the skeleton strategy from \u003chttps://github.com/c9s/bbgo/blob/main/pkg/strategy/example/skeleton/strategy.go\u003e\n\nNow add your config:\n\n```sh\nmkdir config\n(cd config \u0026\u0026 curl -o bbgo.yaml https://raw.githubusercontent.com/c9s/bbgo/main/config/minimal.yaml)\n```\n\nAdd your strategy package path to the config file `config/bbgo.yaml`\n\n```yaml\n---\nbuild:\n  dir: build\n  imports:\n  - github.com/your_id/your_swing\n  targets:\n  - name: swing-amd64-linux\n    os: linux\n    arch: amd64\n  - name: swing-amd64-darwin\n    os: darwin\n    arch: amd64\n```\n\nRun `bbgo run` command, bbgo will compile a wrapper binary that imports your strategy:\n\n```sh\ndotenv -f .env.local -- bbgo run --config config/bbgo.yaml\n```\n\nOr you can build your own wrapper binary via:\n\n```shell\nbbgo build --config config/bbgo.yaml\n```\n\nSee also:\n\n- \u003chttps://github.com/narumiruna/bbgo-template\u003e\n- \u003chttps://github.com/narumiruna/bbgo-marketcap\u003e\n- \u003chttps://github.com/austin362667/shadow\u003e\n- \u003chttps://github.com/jnlin/bbgo-strategy-infinite-grid\u003e\n- \u003chttps://github.com/yubing744/trading-gpt\u003e\n\n## Command Usages\n\n### Submitting Orders to a specific exchange session\n\n```shell\nbbgo submit-order --session=okex --symbol=OKBUSDT --side=buy --price=10.0 --quantity=1\n```\n\n### Listing Open Orders of a specific exchange session\n\n```sh\nbbgo list-orders open --session=okex --symbol=OKBUSDT\nbbgo list-orders open --session=max --symbol=MAXUSDT\nbbgo list-orders open --session=binance --symbol=BNBUSDT\n```\n\n### Canceling an open order\n\n```shell\n# both order id and symbol is required for okex\nbbgo cancel-order --session=okex --order-id=318223238325248000 --symbol=OKBUSDT\n\n# for max, you can just give your order id\nbbgo cancel-order --session=max --order-id=1234566\n```\n\n### Debugging user data stream\n\n```shell\nbbgo userdatastream --session okex\nbbgo userdatastream --session max\nbbgo userdatastream --session binance\n```\n\n## Dynamic Injection\n\nIn order to minimize the strategy code, bbgo supports dynamic dependency injection.\n\nBefore executing your strategy, bbgo injects the components into your strategy object if it finds the embedded field\nthat is using bbgo component. for example:\n\n```go\ntype Strategy struct {\n  Symbol string `json:\"symbol\"\n  Market types.Market\n}\n```\n\nSupported components (single exchange strategy only for now):\n\n- `*bbgo.ExchangeSession`\n- `bbgo.OrderExecutor`\n\nIf you have `Symbol string` field in your strategy, your strategy will be detected as a symbol-based strategy, then the\nfollowing types could be injected automatically:\n\n- `types.Market`\n\n## Strategy Execution Phases\n\n1. Load config from the config file.\n2. Allocate and initialize exchange sessions.\n3. Add exchange sessions to the environment (the data layer).\n4. Use the given environment to initialize the trader object (the logic layer).\n5. The trader initializes the environment and starts the exchange connections.\n6. Call strategy.Run() method sequentially.\n\n## Exchange API Examples\n\nPlease check out the example directory: [examples](examples)\n\nInitialize MAX API:\n\n```go\nkey := os.Getenv(\"MAX_API_KEY\")\nsecret := os.Getenv(\"MAX_API_SECRET\")\n\nmaxRest := maxapi.NewRestClient(maxapi.ProductionAPIURL)\nmaxRest.Auth(key, secret)\n```\n\nCreating user data stream to get the order book (depth):\n\n```go\nstream := max.NewStream(key, secret)\nstream.Subscribe(types.BookChannel, symbol, types.SubscribeOptions{})\n\nstreambook := types.NewStreamBook(symbol)\nstreambook.BindStream(stream)\n```\n\n## Deployment\n\n- [Helm Chart](./doc/deployment/helm-chart.md)\n- Baremetal machine or a VPS\n\n## Development\n\n- [Adding New Exchange](./doc/development/adding-new-exchange.md)\n- [Migration](./doc/development/migration.md)\n\n### Setting up your local repository\n\n1. Click the \"Fork\" button from the GitHub repository.\n2. Clone your forked repository into `$GOPATH/github.com/c9s/bbgo`.\n3. Change the directory to `$GOPATH/github.com/c9s/bbgo`.\n4. Create a branch and start your development.\n5. Test your changes.\n6. Push your changes to your fork.\n7. Send a pull request.\n\n### Testing Desktop App\n\nfor webview\n\n```sh\nmake embed \u0026\u0026 go run -tags web ./cmd/bbgo-webview\n```\n\nfor lorca\n\n```sh\nmake embed \u0026\u0026 go run -tags web ./cmd/bbgo-lorca\n```\n\n## FAQ\n\n### What's Position?\n\n- Base Currency \u0026 Quote Currency \u003chttps://www.ig.com/au/glossary-trading-terms/base-currency-definition\u003e\n- How to calculate the average cost? \u003chttps://www.janushenderson.com/en-us/investor/planning/calculate-average-cost/\u003e\n\n### Looking For A New Strategy?\n\nYou can write an article about BBGO on any topic, in 750-1500 words for exchange, and I can implement the strategy for\nyou (depending on the complexity and effort). If you're interested in, DM me in telegram \u003chttps://t.me/c123456789s\u003e or\ntwitter \u003chttps://twitter.com/c9s\u003e, and we can discuss.\n\n### Adding New Crypto Exchange support?\n\nIf you want BBGO to support a new crypto exchange that is not included in the current BBGO, we can implement it for you.\nThe cost is 10 ETH. If you're interested in it, DM me in telegram \u003chttps://t.me/c123456789s\u003e.\n\n## Community\n\n- Telegram Group \u003chttps://t.me/bbgo_intl\u003e\n- Telegram Group (Taiwan) \u003chttps://t.me/bbgocrypto\u003e\n- Twitter \u003chttps://twitter.com/bbgotrading\u003e\n\n## Contributing\n\nSee [Contributing](./CONTRIBUTING.md)\n\n### Financial Contributors\n\n[[Become a backer](https://opencollective.com/bbgo#backer)]\n\n\u003ca href=\"https://opencollective.com/bbgo#backers\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/bbgo/tiers/backer.svg?width=890\"\u003e\u003c/a\u003e\n\n## BBGO Tokenomics\n\nTo support the development of BBGO, we have created a bounty pool to support contributors by giving away $BBG tokens.\nCheck the details in [$BBG Contract Page](contracts/README.md) and our [official website](https://bbgo.finance)\n\n## Supporter\n\n- GitBook\n\n## License\n\nAGPL License\n","funding_links":["https://github.com/sponsors/c9s","https://etherscan.io/address/0x5ed8508e3d046cbe9ff44d6063e29349000c8ddd","https://opencollective.com/bbgo"],"categories":["Go","开源类库","Financial","Open source library","金融"],"sub_categories":["区块链","Search and Analytic Databases","Blockchain","检索及分析资料库","Advanced Console UIs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc9s%2Fbbgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fc9s%2Fbbgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc9s%2Fbbgo/lists"}