Skip to content

Instantly share code, notes, and snippets.

@jooize
Last active January 7, 2018 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jooize/c77eaad424379f46ba6213a4fbb0f49d to your computer and use it in GitHub Desktop.
Save jooize/c77eaad424379f46ba6213a4fbb0f49d to your computer and use it in GitHub Desktop.
Setup NuBot for Liquidity

Liquidity with NuBot

Exchange (SouthXchange)

  • Create account.
  • Enable multi-factor authentication.
  • Enable API access.
  • Create API key.
  • Restrict API access to IP of gateway (consider).

Setup VPS

  • Create Droplet on DigitalOcean.
    • Use Ubuntu LTS.
    • Choose specifications.
    • Activate backups?
    • Select SSH key.
  • Open console and note its fingerprint. Compare at SSH login.

Set SSH alias for VPS

vpsip=
cat << EOF >> ~/.ssh/config
Host southxchange
    User nu
    HostName $vpsip
EOF

NuBot on VPS

ssh root@southxchange

Add user nu without password

Passwordless logins are denied by default.

adduser nu --disabled-pass‐word
mkdir /home/nu/.ssh
chown nu:nu /home/nu/.ssh
chmod 700 /home/nu/.ssh
cat /root/.ssh/authorized_keys >> /home/nu/.ssh/authorized_keys
chown nu:nu /home/nu/.ssh/authorized_keys

Install unarchiver

apt install -y unzip

Install Java

apt-add-repository ppa:webupd8team/java

Press Enter.

apt update
apt install -y oracle-java8-installer

Accept the terms for Java. (Enter, Left, Enter)

Firewall:

ufw allow ssh/tcp
ufw show added
ufw enable

Press Y, Enter.

Automatic security updates:

Won't reboot.

dpkg-reconfigure --priority=low unattended-upgrades

Setup NuBot

ssh nu@southxchange
curl -LO https://bitbucket.org/JordanLeePeershares/nubottrading/downloads/nubot-v0.5.0-RC11.zip
unzip nubot-v0.5.0-RC11.zip
ln -s nubot-v0.5.0-RC11.zip southxchange_usnbt-usd

Auth key (required for streamer server)

Key for protected credentials in NuBot.

AUTHKEY=
echo "$AUTHKEY" > ~/southxchange_usnbt-usd/res/authkey.txt

NuBot config

cd southxchange_usnbt-usd/config
ln -s ../../southxchange_usnbt-usd.json nubot-config.json
APIKEY=
APISECRET=
cat << EOF > ~/southxchange_usnbt-usd.json
{
  "exchangeName": "southxchange",
  "pair": "nbt_btc",
  "txFee": 0.4,

  "apiKey": "$APIKEY",
  "apiSecret": "$APISECRET",
  
  "bypassStreaming": false,
  "streamingServer": "price.crypto-daio.co.uk:5556",

  "verbosity": "high",
  "executeOrders": true,

  "bookDisableTier2": true,
  "bookBuyWall": 10,
  "bookBuyOffset": 0.005,
  "bookSellWall": 10,
  "bookSellOffset": 0.005,

  "submitLiquidity": false,

  "mailNotifications": "none"
}
EOF

Autostart

cat << 'EOF' > ~/start
#!/usr/bin/env sh
tmux new-session -d -s "NuBot" -n "Debug" "$SHELL"
tmux new-window -n "USNBT-USD" "cd southxchange_usnbt-usd && java -jar NuBot.jar -server -cfg=../southxchange_usnbt-usd.json ; $SHELL || $SHELL"
EOF
chmod +x ~/start

Cron autostart

crontab -e
@reboot /home/nu/start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment