2020-11-14 04:45:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
osf=$(uname | tr '[:upper:]' '[:lower:]')
|
2021-03-13 11:43:40 +00:00
|
|
|
version=v1.13.0
|
|
|
|
dist_file=bbgo-$version-$osf-amd64.tar.gz
|
2020-11-14 04:45:44 +00:00
|
|
|
|
2021-03-13 11:43:40 +00:00
|
|
|
echo "downloading..."
|
|
|
|
curl -L https://github.com/c9s/bbgo/releases/download/$version/$dist_file
|
|
|
|
tar xzf $dist_file
|
|
|
|
mv bbgo-darwin bbgo
|
2020-11-14 04:45:44 +00:00
|
|
|
chmod +x bbgo
|
2021-03-13 11:43:40 +00:00
|
|
|
echo "downloaded"
|
2020-11-14 04:45:44 +00:00
|
|
|
|
|
|
|
function gen_dotenv()
|
|
|
|
{
|
|
|
|
read -p "Enter your MAX API key: " api_key
|
|
|
|
read -p "Enter your MAX API secret: " api_secret
|
|
|
|
echo "Generating your .env.local file..."
|
|
|
|
cat <<END > .env.local
|
2021-03-13 11:43:40 +00:00
|
|
|
MAX_API_KEY=$api_key
|
|
|
|
MAX_API_SECRET=$api_secret
|
2020-11-14 04:45:44 +00:00
|
|
|
END
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ -e ".env.local" ]] ; then
|
|
|
|
echo "Found existing .env.local, you will overwrite the existing .env.local file!"
|
|
|
|
read -p "Are you sure? (Y/n) " a
|
|
|
|
if [[ $a != "n" ]] ; then
|
|
|
|
gen_dotenv
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gen_dotenv
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -e "bbgo.yaml" ]] ; then
|
|
|
|
echo "Found existing bbgo.yaml, you will overwrite the existing bbgo.yaml file!"
|
|
|
|
read -p "Are you sure? (Y/n) " a
|
|
|
|
if [[ $a == "n" ]] ; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat <<END > bbgo.yaml
|
|
|
|
---
|
|
|
|
riskControls:
|
|
|
|
sessionBased:
|
|
|
|
max:
|
|
|
|
orderExecutor:
|
|
|
|
bySymbol:
|
|
|
|
BTCUSDT:
|
|
|
|
# basic risk control order executor
|
|
|
|
basic:
|
|
|
|
minQuoteBalance: 100.0
|
|
|
|
maxBaseAssetBalance: 3.0
|
|
|
|
minBaseAssetBalance: 0.0
|
|
|
|
maxOrderAmount: 1000.0
|
|
|
|
|
|
|
|
exchangeStrategies:
|
|
|
|
- on: max
|
|
|
|
bollgrid:
|
|
|
|
symbol: BTCUSDT
|
2021-03-13 11:43:40 +00:00
|
|
|
interval: 1h
|
2020-11-14 04:45:44 +00:00
|
|
|
gridNumber: 20
|
|
|
|
quantity: 0.001
|
2021-03-13 11:43:40 +00:00
|
|
|
profitSpread: 100.0
|
|
|
|
|
2020-11-14 04:45:44 +00:00
|
|
|
END
|
|
|
|
|
2020-11-14 05:28:22 +00:00
|
|
|
echo "Config file is generated"
|
|
|
|
echo "================================================================"
|
2020-11-14 04:45:44 +00:00
|
|
|
echo "Now you can edit your strategy config file bbgo.yaml to run bbgo"
|
|
|
|
|
|
|
|
if [[ $osf == "darwin" ]] ; then
|
|
|
|
echo "We found you're using MacOS, you can type:"
|
|
|
|
echo ""
|
|
|
|
echo " open -a TextEdit bbgo.yaml"
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "To run bbgo just type: "
|
|
|
|
echo ""
|
2021-03-13 11:43:40 +00:00
|
|
|
echo " ./bbgo run"
|
2020-11-14 04:45:44 +00:00
|
|
|
echo ""
|
|
|
|
echo "To stop bbgo, just hit CTRL-C"
|
|
|
|
|
|
|
|
if [[ $osf == "darwin" ]] ; then
|
|
|
|
open -a TextEdit bbgo.yaml
|
|
|
|
fi
|