add setup script

This commit is contained in:
c9s 2020-11-11 17:51:02 +08:00
parent d41d671338
commit 460a581cfd

74
scripts/setup.sh Normal file
View File

@ -0,0 +1,74 @@
#!/bin/bash
osf=$(uname | tr '[:upper:]' '[:lower:]')
version=v1.0.0
if [[ ! -e "bbgo" ]] ; then
curl -L -o bbgo https://github.com/c9s/bbgo/releases/download/$version/bbgo-$osf
chmod +x bbgo
echo "bbgo binary downloaded"
fi
if [[ ! -e "bbgo.yaml" ]] ; then
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
grid:
symbol: BTCUSDT
baseQuantity: 0.002
gridNumber: 100
profitSpread: 50.0
upperPrice: 14000.0
lowerPrice: 11000.0
END
fi
if [[ ! -e ".env.local" ]] ; then
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
export MAX_API_KEY=$api_key
export MAX_API_SECRET=$api_secret
END
fi
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 ""
echo " source .env.local && ./bbgo run --config bbgo.yaml"
echo ""
echo "To stop bbgo, just hit CTRL-C"
if [[ $osf == "darwin" ]] ; then
open -a TextEdit bbgo.yaml
fi