#!/bin/bash
#
# MAX_API_KEY=
#
#
# MAX_API_SECRET=
#
#
# LOWER_PRICE=
#
#
# UPPER_PRICE=
#
#
# GRID_NUMBER=
#
#
# QUANTITY=
#
#
# PROFIT_SPREAD=
#
#
# SIDE=
#
#
# CATCH_UP=
#
#
# LONG=
set -e
osf=$(uname | tr '[:upper:]' '[:lower:]')
version=v1.13.0
dist_file=bbgo-$version-$osf-amd64.tar.gz
apt-get install -y redis-server
curl -O -L https://github.com/c9s/bbgo/releases/download/$version/$dist_file
tar xzf $dist_file
mv bbgo-$osf bbgo
chmod +x bbgo
mv bbgo /usr/local/bin/bbgo
useradd --create-home -g users -s /usr/bin/bash bbgo
cd /home/bbgo
cat < .env.local
export MAX_API_KEY=$MAX_API_KEY
export MAX_API_SECRET=$MAX_API_SECRET
END
cat < /etc/systemd/system/bbgo.service
[Unit]
Description=bbgo trading bot
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
WorkingDirectory=/home/bbgo
# EnvironmentFile=/home/bbgo/envvars
ExecStart=/usr/local/bin/bbgo run --enable-web-server
KillMode=process
User=bbgo
Restart=always
RestartSec=10
END
cat < bbgo.yaml
---
persistence:
json:
directory: var/data
redis:
host: 127.0.0.1
port: 6379
db: 0
exchangeStrategies:
- on: max
grid:
symbol: USDTTWD
quantity: $QUANTITY
gridNumber: $GRID_NUMBER
profitSpread: $PROFIT_SPREAD
upperPrice: $UPPER_PRICE
lowerPrice: $LOWER_PRICE
side: $SIDE
long: $LONG
catchUp: $CATCH_UP
persistence:
type: redis
store: main
END
systemctl enable bbgo.service
systemctl daemon-reload
systemctl start bbgo