feature: add cmd document

add documentation index
This commit is contained in:
zenix 2022-02-22 17:52:14 +09:00
parent 208a9bcb7d
commit 06e9450859
37 changed files with 1096 additions and 7 deletions

View File

@ -15,6 +15,9 @@ A trading bot framework written in Go. The name bbgo comes from the BB8 bot in t
[![Telegram Taiwan](https://img.shields.io/badge/telegram-tw-blue.svg)](https://t.me/bbgocrypto)
[![Twitter](https://img.shields.io/twitter/follow/bbgotrading?label=Follow&style=social)](https://twitter.com/bbgotrading)
## Documentation and General Topics
- Check the [documentation index](doc/README.md)
## Features
- Exchange abstraction interface.
@ -45,6 +48,10 @@ A trading bot framework written in Go. The name bbgo comes from the BB8 bot in t
- Kucoin Spot Exchange
- MAX Spot Exchange (located in Taiwan)
## BBGO Tokenomics
To support the development of BBGO, we have created a bounty pool to support contributors by giving away $BBG tokens.
Check the details in [$BBG Contract Page](contracts/README.md) and our [official website](https://bbgo.finance)
## Requirements
Get your exchange API key and secret after you register the accounts (you can choose one or more exchanges):

19
cmd/update-doc/main.go Normal file
View File

@ -0,0 +1,19 @@
package main
import (
"github.com/c9s/bbgo/pkg/cmd"
"github.com/spf13/cobra/doc"
"path"
"runtime"
"fmt"
"log"
)
func main() {
_, b, _, _ := runtime.Caller(0)
root := path.Join(path.Dir(path.Dir(path.Dir(b))), "doc", "commands")
fmt.Println(root)
if err := doc.GenMarkdownTree(cmd.RootCmd, root); err != nil {
log.Fatal(err)
}
}

31
doc/README.md Normal file
View File

@ -0,0 +1,31 @@
# BBGO Documentation Index
--------------------------
### General Topics
* [bbgo command index](commands/bbgo.md) - BBGO prompt user interface
* [bbgo build](build-from-source.md) - How to build bbgo
* [bbgo backtest](topics/back-testing.md) - How to backtesting strategies
* [bbgo TWAP](topics/twap.md) - TWAP order execution to buy/sell large quantity of order
### Configuration
* [bbgo slack](configuration/slack.md) - Setting up Slack Notification
* [bbgo telegram](configuration/telegram.md) - Setting up Telegram Bot Notification
* [bbgo env](configuration/envvars.md) - Environment variables
* [bbgo sync](configuration/sync.md) - Synchronize private trading data
### Deployment
* [bbgo chart](deployment/helm-chart.md) - Helm Chart setup
### Development
* [bbgo new exchange](development/adding-new-exchange.md) - Check lists for adding new exchanges
* [bbgo kucoin cli](development/kucoin-cli.md) - Kucoin command-line tools
* [bbgo sql migration](development/migration.md) - Adding new SQL migration scripts
* [bbgo release process](development/release-process.md) - How to make a new release
### Strategies
* [bbgo grid](strategy/grid.md) - Grid Strategy Explanation
* [bbgo interaction](strategy/interaction.md) - Interaction registration for strategies
* [bbgo price alert](strategy/pricealert.md) - Send price alert notification on price changes
* [bbgo support](strategy/support.md) - Support strategy that buys on high volume support

57
doc/commands/bbgo.md Normal file
View File

@ -0,0 +1,57 @@
## bbgo
bbgo is a crypto trading bot
```
bbgo [flags]
```
### Options
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
-h, --help help for bbgo
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo account](bbgo_account.md) - show user account details (ex: balance)
* [bbgo backtest](bbgo_backtest.md) - backtest your strategies
* [bbgo balances](bbgo_balances.md) - Show user account balances
* [bbgo build](bbgo_build.md) - build cross-platform binary
* [bbgo cancel-order](bbgo_cancel-order.md) - cancel orders
* [bbgo deposits](bbgo_deposits.md) - A testing utility that will query deposition history in last 7 days
* [bbgo execute-order](bbgo_execute-order.md) - execute buy/sell on the balance/position you have on specific symbol
* [bbgo kline](bbgo_kline.md) - connect to the kline market data streaming service of an exchange
* [bbgo list-orders](bbgo_list-orders.md) - list user's open orders in exchange of a specific trading pair
* [bbgo market](bbgo_market.md) - List the symbols that the are available to be traded in the exchange
* [bbgo orderbook](bbgo_orderbook.md) - connect to the order book market data streaming service of an exchange
* [bbgo orderupdate](bbgo_orderupdate.md) - Listen to order update events
* [bbgo pnl](bbgo_pnl.md) - pnl calculator
* [bbgo run](bbgo_run.md) - run strategies from config file
* [bbgo submit-order](bbgo_submit-order.md) - submit limit order to the exchange
* [bbgo sync](bbgo_sync.md) - sync trades and orders history
* [bbgo trades](bbgo_trades.md) - Query trading history
* [bbgo tradeupdate](bbgo_tradeupdate.md) - Listen to trade update events
* [bbgo transfer-history](bbgo_transfer-history.md) - show transfer history
* [bbgo userdatastream](bbgo_userdatastream.md) - Listen to session events (orderUpdate, tradeUpdate, balanceUpdate, balanceSnapshot)
* [bbgo version](bbgo_version.md) - show version name
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,44 @@
## bbgo account
show user account details (ex: balance)
```
bbgo account [--session=[exchange_name]] [flags]
```
### Options
```
-h, --help help for account
--session string the exchange session name for querying information
--total report total asset
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,51 @@
## bbgo backtest
backtest your strategies
```
bbgo backtest [flags]
```
### Options
```
--base-asset-baseline use base asset performance as the competitive baseline performance
--exchange string target exchange
--force force execution without confirm
-h, --help help for backtest
--output string the report output directory
--sync sync backtest data
--sync-from string sync backtest data from the given time, which will override the time range in the backtest config
--sync-only sync backtest data only, do not run backtest
-v, --verbose count verbose level
--verify verify the kline back-test data
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,43 @@
## bbgo balances
Show user account balances
```
bbgo balances [flags]
```
### Options
```
-h, --help help for balances
--session string the exchange session name for querying balances
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,42 @@
## bbgo build
build cross-platform binary
```
bbgo build [flags]
```
### Options
```
-h, --help help for build
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,52 @@
## bbgo cancel-order
cancel orders
### Synopsis
this command can cancel orders from exchange
```
bbgo cancel-order [flags]
```
### Options
```
--all cancel all orders
--group-id int group ID to cancel orders
-h, --help help for cancel-order
--order-id uint order ID to cancel orders
--order-uuid string order UUID to cancel orders
--session string session to execute cancel orders
--symbol string symbol to cancel orders
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,44 @@
## bbgo deposits
A testing utility that will query deposition history in last 7 days
```
bbgo deposits [flags]
```
### Options
```
--asset string the trading pair, like btcusdt
-h, --help help for deposits
--session string the exchange session name for querying balances
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,51 @@
## bbgo execute-order
execute buy/sell on the balance/position you have on specific symbol
```
bbgo execute-order [flags]
```
### Options
```
--deadline duration deadline of the order execution
-h, --help help for execute-order
--price-ticks int the number of price tick for the jump spread, default to 0
--session string the exchange session name for sync
--side string the trading side: buy or sell
--slice-quantity string slice quantity
--stop-price string stop price (default "0")
--symbol string the trading pair, like btcusdt
--target-quantity string target quantity
--update-interval duration order update time (default 10s)
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,45 @@
## bbgo kline
connect to the kline market data streaming service of an exchange
```
bbgo kline [flags]
```
### Options
```
-h, --help help for kline
--interval string interval of the kline (candle), .e.g, 1m, 3m, 15m (default "1m")
--session string session name
--symbol string the trading pair. e.g, BTCUSDT, LTCUSDT...
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,44 @@
## bbgo list-orders
list user's open orders in exchange of a specific trading pair
```
bbgo list-orders [status] [flags]
```
### Options
```
-h, --help help for list-orders
--session string the exchange session name for sync
--symbol string the trading pair, like btcusdt
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,43 @@
## bbgo market
List the symbols that the are available to be traded in the exchange
```
bbgo market [flags]
```
### Options
```
-h, --help help for market
--session string the exchange session name for querying information
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,45 @@
## bbgo orderbook
connect to the order book market data streaming service of an exchange
```
bbgo orderbook --session=[exchange_name] --symbol=[pair_name] [flags]
```
### Options
```
--dump-update dump the depth update
-h, --help help for orderbook
--session string session name
--symbol string the trading pair. e.g, BTCUSDT, LTCUSDT...
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,43 @@
## bbgo orderupdate
Listen to order update events
```
bbgo orderupdate [flags]
```
### Options
```
-h, --help help for orderupdate
--session string session name
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

46
doc/commands/bbgo_pnl.md Normal file
View File

@ -0,0 +1,46 @@
## bbgo pnl
pnl calculator
```
bbgo pnl [flags]
```
### Options
```
-h, --help help for pnl
--include-transfer convert transfer records into trades
--limit int number of trades (default 500)
--session string target exchange
--symbol string trading symbol
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

52
doc/commands/bbgo_run.md Normal file
View File

@ -0,0 +1,52 @@
## bbgo run
run strategies from config file
```
bbgo run [flags]
```
### Options
```
--cpu-profile string cpu profile
--enable-web-server legacy option, this is renamed to --enable-webserver
--enable-webserver enable webserver
-h, --help help for run
--no-compile do not compile wrapper binary
--no-sync do not sync on startup
--setup use setup mode
--totp-account-name string
--totp-issuer string
--totp-key-url string time-based one-time password key URL, if defined, it will be used for restoring the otp key
--webserver-bind string webserver binding (default ":8080")
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,47 @@
## bbgo submit-order
submit limit order to the exchange
```
bbgo submit-order --session SESSION --symbol SYMBOL --side SIDE --quantity QUANTITY [--price PRICE] [flags]
```
### Options
```
-h, --help help for submit-order
--price string the trading price
--quantity string the trading quantity
--session string the exchange session name for sync
--side string the trading side: buy or sell
--symbol string the trading pair, like btcusdt
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

45
doc/commands/bbgo_sync.md Normal file
View File

@ -0,0 +1,45 @@
## bbgo sync
sync trades and orders history
```
bbgo sync --session=[exchange_name] --symbol=[pair_name] [--since=yyyy/mm/dd] [flags]
```
### Options
```
-h, --help help for sync
--session string the exchange session name for sync
--since string sync from time
--symbol string symbol of market for syncing
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,45 @@
## bbgo trades
Query trading history
```
bbgo trades --session=[exchange_name] --symbol=[pair_name] [flags]
```
### Options
```
-h, --help help for trades
--limit int limit (default 100)
--session string the exchange session name for querying balances
--symbol string the trading pair, like btcusdt
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,43 @@
## bbgo tradeupdate
Listen to trade update events
```
bbgo tradeupdate --session=[exchange_name] [flags]
```
### Options
```
-h, --help help for tradeupdate
--session string the exchange session name for querying balances
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,45 @@
## bbgo transfer-history
show transfer history
```
bbgo transfer-history [flags]
```
### Options
```
--asset string trading symbol
-h, --help help for transfer-history
--session string target exchange session
--since string since time
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,43 @@
## bbgo userdatastream
Listen to session events (orderUpdate, tradeUpdate, balanceUpdate, balanceSnapshot)
```
bbgo userdatastream [flags]
```
### Options
```
-h, --help help for userdatastream
--session string session name
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

View File

@ -0,0 +1,42 @@
## bbgo version
show version name
```
bbgo version [flags]
```
### Options
```
-h, --help help for version
```
### Options inherited from parent commands
```
--binance-api-key string binance api key
--binance-api-secret string binance api secret
--config string config file (default "bbgo.yaml")
--debug debug mode
--dotenv string the dotenv file you want to load (default ".env.local")
--ftx-api-key string ftx api key
--ftx-api-secret string ftx api secret
--ftx-subaccount string subaccount name. Specify it if the credential is for subaccount.
--max-api-key string max api key
--max-api-secret string max api secret
--metrics enable prometheus metrics
--metrics-port string prometheus http server port (default "9090")
--no-dotenv disable built-in dotenv
--slack-channel string slack trading channel (default "dev-bbgo")
--slack-error-channel string slack error channel (default "bbgo-error")
--slack-token string slack token
--telegram-bot-auth-token string telegram auth token
--telegram-bot-token string telegram bot token from bot father
```
### SEE ALSO
* [bbgo](bbgo.md) - bbgo is a crypto trading bot
###### Auto generated by spf13/cobra on 22-Feb-2022

1
go.mod
View File

@ -63,6 +63,7 @@ require (
golang.org/x/net v0.0.0-20211205041911-012df41ee64c // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324
golang.org/x/tools v0.1.9 // indirect
gonum.org/v1/gonum v0.8.1
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect

6
go.sum
View File

@ -88,6 +88,7 @@ github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@ -406,12 +407,14 @@ github.com/robfig/cron/v3 v3.0.0 h1:kQ6Cb7aHOHTSzNVNEhmp8EcWKLb4CbiMW9h9VyIhO4E=
github.com/robfig/cron/v3 v3.0.0/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
@ -478,6 +481,7 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.1 h1:/vn0k+RBvwlxEmP5E7SZMqNxPhfMVFEJiykr15/0XKM=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
@ -724,6 +728,8 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w=
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -16,12 +16,14 @@ import (
func init() {
accountCmd.Flags().String("session", "", "the exchange session name for querying information")
accountCmd.Flags().Bool("total", false, "report total asset")
accountCmd.MarkFlagRequired("config")
RootCmd.AddCommand(accountCmd)
}
// go run ./cmd/bbgo account --session=ftx --config=config/bbgo.yaml
var accountCmd = &cobra.Command{
Use: "account",
Use: "account [--session=[exchange_name]]",
Short: "show user account details (ex: balance)",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()

View File

@ -20,6 +20,7 @@ func init() {
// go run ./cmd/bbgo balances --session=ftx
var balancesCmd = &cobra.Command{
Use: "balances",
Short: "Show user account balances",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()

View File

@ -12,6 +12,7 @@ import (
func init() {
BuildCmd.Flags().String("config", "bbgo.yaml", "config file")
BuildCmd.MarkFlagRequired("config")
RootCmd.AddCommand(BuildCmd)
}

View File

@ -24,6 +24,7 @@ func init() {
// This is a testing util and will query deposits in last 7 days.
var depositsCmd = &cobra.Command{
Use: "deposits",
Short: "A testing utility that will query deposition history in last 7 days",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()

View File

@ -20,6 +20,7 @@ func init() {
// go run ./cmd/bbgo market --session=ftx --config=config/bbgo.yaml
var marketCmd = &cobra.Command{
Use: "market",
Short: "List the symbols that the are available to be traded in the exchange",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()

View File

@ -17,7 +17,7 @@ import (
// go run ./cmd/bbgo orderbook --session=ftx --symbol=BTCUSDT
var orderbookCmd = &cobra.Command{
Use: "orderbook",
Use: "orderbook --session=[exchange_name] --symbol=[pair_name]",
Short: "connect to the order book market data streaming service of an exchange",
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
@ -113,6 +113,7 @@ var orderbookCmd = &cobra.Command{
// go run ./cmd/bbgo orderupdate --session=ftx
var orderUpdateCmd = &cobra.Command{
Use: "orderupdate",
Short: "Listen to order update events",
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()

View File

@ -22,6 +22,7 @@ import (
// go run ./cmd/bbgo list-orders [open|closed] --session=ftx --symbol=BTCUSDT
var listOrdersCmd = &cobra.Command{
Use: "list-orders [status]",
Short: "list user's open orders in exchange of a specific trading pair",
Args: cobra.OnlyValidArgs,
// default is open which means we query open orders if you haven't provided args.
ValidArgs: []string{"", "open", "closed"},
@ -116,6 +117,7 @@ var listOrdersCmd = &cobra.Command{
var executeOrderCmd = &cobra.Command{
Use: "execute-order",
Short: "execute buy/sell on the balance/position you have on specific symbol",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
@ -263,6 +265,7 @@ var executeOrderCmd = &cobra.Command{
// go run ./cmd/bbgo submit-order --session=ftx --symbol=BTCUSDT --side=buy --price=18000 --quantity=0.001
var submitOrderCmd = &cobra.Command{
Use: "submit-order --session SESSION --symbol SYMBOL --side SIDE --quantity QUANTITY [--price PRICE]",
Short: "submit limit order to the exchange",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()

View File

@ -20,8 +20,8 @@ func init() {
}
var SyncCmd = &cobra.Command{
Use: "sync",
Short: "sync trades, orders",
Use: "sync --session=[exchange_name] --symbol=[pair_name] [--since=yyyy/mm/dd]",
Short: "sync trades and orders history",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()

View File

@ -16,9 +16,10 @@ import (
"github.com/c9s/bbgo/pkg/types"
)
// go run ./cmd/bbgo tradesCmd --session=ftx --symbol="BTC/USD"
// go run ./cmd/bbgo trades --session=ftx --symbol="BTC/USD"
var tradesCmd = &cobra.Command{
Use: "trades",
Use: "trades --session=[exchange_name] --symbol=[pair_name]",
Short: "Query trading history",
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
@ -117,7 +118,8 @@ var tradesCmd = &cobra.Command{
// go run ./cmd/bbgo tradeupdate --session=ftx
var tradeUpdateCmd = &cobra.Command{
Use: "tradeupdate",
Use: "tradeupdate --session=[exchange_name]",
Short: "Listen to trade update events",
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()

View File

@ -18,6 +18,7 @@ import (
// go run ./cmd/bbgo userdatastream --session=ftx
var userDataStreamCmd = &cobra.Command{
Use: "userdatastream",
Short: "Listen to session events (orderUpdate, tradeUpdate, balanceUpdate, balanceSnapshot)",
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()