# 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 ```sh vpsip= cat << EOF >> ~/.ssh/config Host southxchange User nu HostName $vpsip EOF ``` ## NuBot on VPS ```sh ssh root@southxchange ``` ### Add user `nu` without password *Passwordless logins are denied by default.* ```sh adduser nu --disabled-pass‐word ``` ```sh 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 ```sh apt install -y unzip ``` ### Install Java ```sh apt-add-repository ppa:webupd8team/java ``` Press Enter. ```sh apt update apt install -y oracle-java8-installer ``` Accept the terms for Java. (Enter, Left, Enter) **Firewall:** ```sh ufw allow ssh/tcp ufw show added ufw enable ``` Press Y, Enter. **Automatic security updates:** Won't reboot. ```sh dpkg-reconfigure --priority=low unattended-upgrades ``` ## Setup NuBot ```sh ssh nu@southxchange ``` ```sh curl -LO https://bitbucket.org/JordanLeePeershares/nubottrading/downloads/nubot-v0.5.0-RC11.zip unzip nubot-v0.5.0-RC11.zip ``` ```sh ln -s nubot-v0.5.0-RC11.zip southxchange_usnbt-usd ``` ### Auth key (required for streamer server) Key for protected credentials in NuBot. ```sh AUTHKEY= echo "$AUTHKEY" > ~/southxchange_usnbt-usd/res/authkey.txt ``` ### NuBot config ```sh 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 ```sh 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 ``` ```sh chmod +x ~/start ``` #### Cron autostart ```sh crontab -e ``` ``` @reboot /home/nu/start ```