diff --git a/README.md b/README.md index 951680059..a7028195e 100644 --- a/README.md +++ b/README.md @@ -56,35 +56,49 @@ MYSQL_URL=root@tcp(127.0.0.1:3306)/bbgo?parseTime=true Make sure you have [dotenv](https://github.com/bkeepers/dotenv) +To sync your own trade data: + +``` +bbgo sync --config config/grid.yaml --session max +bbgo sync --config config/grid.yaml --session binance +``` + +If you want to switch to other dotenv file, you can add an `--dotenv` option: + +``` +bbgo sync --dotenv .env.dev --config config/grid.yaml --session binance +``` + + To sync remote exchange klines data for backtesting: ```sh -dotenv -f .env.local -- bbgo backtest --exchange binance --config config/grid.yaml -v --sync --sync-only --sync-from 2020-01-01 +bbgo backtest --exchange binance --config config/grid.yaml -v --sync --sync-only --sync-from 2020-01-01 ``` To run backtest: ```sh -dotenv -f .env.local -- bbgo backtest --exchange binance --config config/bollgrid.yaml --base-asset-baseline +bbgo backtest --exchange binance --config config/bollgrid.yaml --base-asset-baseline ``` To query transfer history: ```sh -dotenv -f .env.local -- bbgo transfer-history --exchange max --asset USDT --since "2019-01-01" +bbgo transfer-history --exchange max --asset USDT --since "2019-01-01" ``` To calculate pnl: ```sh -dotenv -f .env.local -- bbgo pnl --exchange binance --asset BTC --since "2019-01-01" +bbgo pnl --exchange binance --asset BTC --since "2019-01-01" ``` To run strategy: ```sh -dotenv -f .env.local -- bbgo run --config config/buyandhold.yaml +bbgo run --config config/buyandhold.yaml ``` ## Built-in Strategies @@ -105,7 +119,7 @@ modify the config file to make the configuration suitable for you, for example i vim config/buyandhold.yaml # run bbgo with the config -dotenv -f .env.local -- bbgo run --config config/buyandhold.yaml +bbgo run --config config/buyandhold.yaml ``` ## Write your own strategy diff --git a/frontend/components/ConfigureDatabaseForm.js b/frontend/components/ConfigureDatabaseForm.js index d1d06c9ed..053c220b5 100644 --- a/frontend/components/ConfigureDatabaseForm.js +++ b/frontend/components/ConfigureDatabaseForm.js @@ -5,10 +5,15 @@ import Button from '@material-ui/core/Button'; import Typography from '@material-ui/core/Typography'; import TextField from '@material-ui/core/TextField'; import FormHelperText from '@material-ui/core/FormHelperText'; +import Radio from '@material-ui/core/Radio'; +import RadioGroup from '@material-ui/core/RadioGroup'; +import FormControlLabel from '@material-ui/core/FormControlLabel'; +import FormControl from '@material-ui/core/FormControl'; +import FormLabel from '@material-ui/core/FormLabel'; import Alert from '@material-ui/lab/Alert'; -import {testDatabaseConnection, configureDatabase} from '../api/bbgo'; +import {configureDatabase, testDatabaseConnection} from '../api/bbgo'; import {makeStyles} from '@material-ui/core/styles'; @@ -30,10 +35,12 @@ const useStyles = makeStyles((theme) => ({ }, })); -export default function ConfigureDatabaseForm({ onConfigured }) { +export default function ConfigureDatabaseForm({onConfigured}) { const classes = useStyles(); const [mysqlURL, setMysqlURL] = React.useState("root@tcp(127.0.0.1:3306)/bbgo") + + const [driver, setDriver] = React.useState("sqlite3"); const [testing, setTesting] = React.useState(false); const [testResponse, setTestResponse] = React.useState(null); const [configured, setConfigured] = React.useState(false); @@ -79,44 +86,72 @@ export default function ConfigureDatabaseForm({ onConfigured }) { - If you have database installed on your machine, you can enter the DSN string in the following field. - Please note this is optional, you CAN SKIP this step. + If you have database installed on your machine, you can enter the DSN string in the following field. + Please note this is optional, you CAN SKIP this step. - - - { - setMysqlURL(event.target.value) - resetTestResponse() - }} - /> - - If you have database installed on your machine, you can enter the DSN string like the + + + + + Database Driver + { + setDriver(event.target.value); + }}> + } label="Standard (Default)"/> + } label="MySQL"/> + + + + + + + + {driver === "mysql" ? ( + + { + setMysqlURL(event.target.value) + resetTestResponse() + }} + /> + MySQL DSN + + + If you have database installed on your machine, you can enter the DSN string like the following format: -
- - root:password@tcp(127.0.0.1:3306)/bbgo - +
+
root:password@tcp(127.0.0.1:3306)/bbgo
-
- Be sure to create your database before using it. You need to execute the following statement +
+ Be sure to create your database before using it. You need to execute the following statement to create a database: -
- - CREATE DATABASE bbgo CHARSET utf8; - +
+
CREATE DATABASE bbgo CHARSET utf8;
+
-
-
+
+ ) : ( + + + + If you don't know what to choose, just pick the standard driver (sqlite3). +
+ For professionals, you can pick MySQL driver, BBGO works best with MySQL, especially for + larger data scale. +
+
+
+ )} +