Username: Password:

Author Topic: [TUT] How to running GUNBOT in Linux  (Read 79189 times)

Offline Agent_5284159

  • Rookie
  • *
  • Posts: 5
    • View Profile
[TUT] How to running GUNBOT in Linux
« on: April 12, 2017, 05:05:02 PM »
Hi there, today I will show you guys how to running GUNBOT in Linux.
After this guide, I have faith that you can run GUNBOT in Linux without any problem.

Host and GUNBOT version

DigitalOcean  16.04.2 x64 (512MB)
GUNBOT        Beta 2.0.4 - Linux (x64)
NodeJS          v6.10.2
PM2              2.4.4

How to connect to the server

Windows User

For Windows User, I recommend to use putty as a SSH client, which can let you connect to your server. You can download it from here:

http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html



Just download putty and it should work~



Paste you VPS IP in the hostname field, then click Open, then enter your password(sent by Email(DigitalOcean))

After that you will has access to your VPS now.

Linux User

I believe that there is nothing you need to do, because you have SSH installed by default.



Just type the following line in your terminal, noted that you should replace 123.123.123.123 to your VPS IP

Code: [Select]
ssh 123.123.123.123
Now we are connecting to the server, time for the next move.

Install the packages that the GUNBOT needed

To run GUNBOT on the background, I'd perfer to use pm2, so we may need NodeJS to run pm2.
Don't worry, Just follow my lead~

Installing NodeJS

Type in your terminal

Code: [Select]
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
Then run

Code: [Select]
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"



After that, run

Code: [Select]
nvm install --lts


When you see this, which mean we have NodeJS installed.

Installing pm2

pm2 is an awesome process manager for NodeJS, also we can use it to run GUNBOT

Code: [Select]
npm install -g pm2
Installing unzip

Code: [Select]
apt install unzip


Let get GUNBOT running

To start with, we need to downlaod the bot first. Then we need to unzip it and move to a folder.
I'd like to move the all the file to /root/gunbot

Code: [Select]
wget https://github.com/GuntharDeNiro/BTCT/releases/download/Beta2.0.4lin/gunbotv2.0.4_linux_x86_x64.zip  # Download the GUNBOT
unzip gunbotv2.0.4_linux_x86_x64.zip                                                                                                            # Unzip
mv gunbotv2.0.4_linux_x86_x64/ gunbot/                                                                                                       # I perfer to use this folder
cd gunbot/                                                                                                                                                     # cd into the folder

You will have those file in the folder.



Now, we need to make the gunbot executable

Code: [Select]
chmod +x gunbot
Now we can edit the config file via nano, forget about the config name. We can consider BTC_DASH-config.js as a default config file.

Code: [Select]
nano BTC_DASH-config.js
Using →←↑↓ to locate, you want to save the file? Ctrl + x then y then Enter

We use cp to generate the config file. If you want to trade with BTC_ETH and BTC_ETC, just type

Code: [Select]
cp BTC_DASH-config.js BTC_ETH-config.js
cp BTC_DASH-config.js BTC_ETC-config.js

Now we need a gunbot.yaml file to start pm2

Code: [Select]
nano gunbot.yaml
Copy and paste the following line.

Code: [Select]
apps:
  - script : ./gunbot
    name : 'BTC_ETH'
    args : 'BTC_ETH'
  - script : ./gunbot
    name : 'BTC_ETH'
    args : 'BTC_ETH'
  - script : ./gunbot
    name : 'BTC_ETH'
    args : 'BTC_ETC'

You want to trade more pairs, just write them down in the same format

Now we come to the most excited moment, let start it~

Code: [Select]
pm2 start gunbot.yaml


Here we go~

How can I see the logs

Nice question, we need GUNBOT's log for analytics.

There are two ways for us to see the logs

[size=12]Viewing all logs in one place[/size]

Code: [Select]
pm2 monit


[size=12]Viewing a single paris logs[/size]

Example BTC_ETH

Code: [Select]
pm2 logs BTC_ETH
From here you can know why the bot restarted and the new logs.



----

Now, everything should work, good luck~

Offline jroddingham

  • Rookie
  • *
  • Posts: 16
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #1 on: April 14, 2017, 05:36:35 PM »
+1 for pm2 and a yaml config. I'll be using this instead of tmux I think.

Offline earendil

  • Rookie
  • *
  • Posts: 5
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #2 on: April 19, 2017, 09:00:07 PM »
Hi,
I followed the instructions, and I managed to install everything required and to download, unzip and set the running for Gunbot.
- However, I could not connect using ssh (ssh VPS IP). What does it refer to as 'vps ip'?
- Further, where should I include my API key and password for Poloniex?
Thanks!

Offline Pro

  • Rookie
  • *
  • Posts: 20
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #3 on: April 21, 2017, 02:28:58 AM »
Damn, Linux really sux>:(

And also this guide isn't complete!
There is even no config file to choose from and what to do there? (thinks the new user)

I had to really think and could only draw from my knowledge with windows.
and could only use those nice config files I already created with it.

You really should include the standart ones!

You didn't include how to control the bots.
Also how to stop this stupid pm2 program now.
I can't even get back to command line now.

Please add those things asap.  ??? ::)
« Last Edit: April 21, 2017, 02:33:21 AM by Pro »

Offline shacky

  • Rookie
  • *
  • Posts: 4
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #4 on: April 21, 2017, 07:15:37 AM »
control + c to stop de pm2 monit

ken

  • Guest
Re: [TUT] How to running GUNBOT in Linux
« Reply #5 on: April 21, 2017, 06:02:46 PM »
This may help with generating the yaml.

Code: [Select]
#!/bin/bash
if [ -z "$1" ]; then
        echo usage: $0 output [gunbot_path]
        exit
fi
FILE=$1
GBSCRIPT=${2:-gunbot}
if [ -f $FILE ]; then
        rm -rf $FILE
fi
echo apps: > $FILE
for i in $( ls *-config.js ); do
        IDX=`expr index "$i" -`
        PAIR=${i:0:$IDX-1}
        echo "- script : ./$GBSCRIPT" >> $FILE
        echo "  name : '$PAIR'" >> $FILE
        echo "  args : '$PAIR'" >> $FILE
done

Offline zurk

  • Rookie
  • *
  • Posts: 13
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #6 on: April 24, 2017, 01:31:54 PM »
I started GunBot X3 on CentOS7 using pm2. Here are the contents .yaml file:
Code: [Select]
apps:
  - script : ./index.js
    name : 'BTC_MAID'
    args : 'BTC_MAID poloniex'
BTC: 1GuBmfoRX9JJdGE6GzabLkb3WfNqRuTgic
telegram https://t.me/AlexeyTsurkan

ken

  • Guest
Re: [TUT] How to running GUNBOT in Linux
« Reply #7 on: April 25, 2017, 12:37:58 AM »
Here's an updated yaml generator script.  You'll probably have to make edits to the output, but this should still save some time typing.

Code: [Select]
#!/bin/bash
if [ -z "$1" ]; then
        echo usage: $0 output
        exit
fi
FILE=$1
if [ -f $FILE ]; then
        rm -rf $FILE
fi
echo apps: > $FILE
for i in $( ls *-config.js ); do
        IDX=`expr index "$i" -`
        PAIR=${i:0:$IDX-1}
        for name in poloniex kraken bittrex; do
                echo "- script : node" >> $FILE
                echo "  name : '$name : $PAIR'" >> $FILE
                echo "  args : 'index $PAIR $name'" >> $FILE
        done
done

Offline Vladee

  • Rookie
  • *
  • Posts: 7
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #8 on: April 25, 2017, 02:40:45 PM »
I started GunBot X3 on CentOS7 using pm2. Here are the contents .yaml file:
Code: [Select]
apps:
  - script : ./index.js
    name : 'BTC_MAID'
    args : 'BTC_MAID poloniex'

As a linux beginner I must say pm2 makes my life (gunbot life) much easier.  :) I still wonder how a command for starting gunbot X3 via command line look like (without using yaml)?

ken

  • Guest
Re: [TUT] How to running GUNBOT in Linux
« Reply #9 on: April 25, 2017, 03:58:25 PM »
As a linux beginner I must say pm2 makes my life (gunbot life) much easier.  :) I still wonder how a command for starting gunbot X3 via command line look like (without using yaml)?

Code: [Select]
node index BTC_ETH poloniexor per the example you quoted
Code: [Select]
./index BTC_MAID poloniex
Look at the yaml file, script is the file you wish to execute, so it reads as "node" or "./index" in the examples in this thread.  The second line is the pm2 process name.  This can be anything you want, it's just used as a reference.  I call mine something like "exchange : pair" or "poloniex : BTC_ETH."  The third line are the options passed in to the script executed in the first line.  This is where we tell gunbot which exchange and pair to use.

The script I posted will generate an output like this:
Quote
apps:
- script : node
  name : 'poloniex : BTC_ETH'
  args : 'index BTC_ETH poloniex'

Offline Vladee

  • Rookie
  • *
  • Posts: 7
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #10 on: April 25, 2017, 08:55:43 PM »
Thank you, ken, for such an explanatory answer! I feel being one step further in linux  :D

Offline serverleader

  • Rookie
  • *
  • Posts: 4
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #11 on: April 27, 2017, 04:17:52 AM »
Dude! thanks! !!!

Offline soyab0007

  • Rookie
  • *
  • Posts: 28
  • 10% discount with code "SOYAB" on GUNBOT License
    • View Profile
    • Tradingbotpro
Re: [TUT] How to running GUNBOT in Linux
« Reply #12 on: April 27, 2017, 01:52:00 PM »
Is there a SSH GUI client for windows?


Authorized GunBot Reseller

Offline dobcrypto

  • Contributor
  • **
  • Posts: 196
  • Russian - native language
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #13 on: April 28, 2017, 03:36:41 AM »
Is there a SSH GUI client for windows?
putty 0.68 =)

Offline bp423

  • Rookie
  • *
  • Posts: 2
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #14 on: May 04, 2017, 07:39:11 PM »
I am getting the following errors.  Can anyone assist?

0|BTC_ETH  | [ ----------------    2017/05/04 18:59:47       Gunbot v2.0.4 Beta cycle#18 ------------------------ ]
0|BTC_ETH  | ::::: collecting data...
0|BTC_ETH  | **showError******************* ERROR *****************************
0|BTC_ETH  | 2017/05/04 18:59:47 statusCode 422
0|BTC_ETH  | 2017/05/04 18:59:47 Error!!! statusCode 422
0|BTC_ETH  | !!! Cycle 19 failed. Will repeat in 3000s

In addition how do I specify that I want to use supergun?
« Last Edit: May 04, 2017, 08:05:01 PM by bp423 »

Offline Snapper_Head

  • Rookie
  • *
  • Posts: 4
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #15 on: May 04, 2017, 11:18:41 PM »
How do I exit out of the session and keep the bot running on the VPS ?

Offline Agent_5284159

  • Rookie
  • *
  • Posts: 5
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #16 on: May 05, 2017, 04:09:03 AM »
+1 for pm2 and a yaml config. I'll be using this instead of tmux I think.

Yep, I think pm2 is better than tmux. PM2 can restart the pair once they exit unexpectly.

Hi,
I followed the instructions, and I managed to install everything required and to download, unzip and set the running for Gunbot.
- However, I could not connect using ssh (ssh VPS IP). What does it refer to as 'vps ip'?
- Further, where should I include my API key and password for Poloniex?
Thanks!

VPS IP, I think you can contact your vps provider.
You can use nano to edit the config file, then write your api in it.

Damn, Linux really sux>:(

And also this guide isn't complete!
There is even no config file to choose from and what to do there? (thinks the new user)

I had to really think and could only draw from my knowledge with windows.
and could only use those nice config files I already created with it.

You really should include the standart ones!

You didn't include how to control the bots.
Also how to stop this stupid pm2 program now.
I can't even get back to command line now.

Please add those things asap.  ??? ::)

Sorry about it.

Config file can be generate using the following bash script. Save as xx.sh then work.

Code: [Select]
#!/bin/bash

echo "apps:"
for pair in `ls *-config.js | sed "s/\-config.js//g"`
do
        echo "  - script : stepgain.js"
        echo "    name : '$pair'"
        echo "    args : '$pair'"
done

This can help you to generate a stepgain config file.
Code: [Select]
bash xx.sh > gunbot.yaml Then should work.

To control the bot,
Code: [Select]
pm2 start/stop/restart BTC_ETH, to exit from monit,
Code: [Select]
Ctrl + c
Good luck

Offline Agent_5284159

  • Rookie
  • *
  • Posts: 5
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #17 on: May 05, 2017, 04:11:35 AM »
I am getting the following errors.  Can anyone assist?

0|BTC_ETH  | [ ----------------    2017/05/04 18:59:47       Gunbot v2.0.4 Beta cycle#18 ------------------------ ]
0|BTC_ETH  | ::::: collecting data...
0|BTC_ETH  | **showError******************* ERROR *****************************
0|BTC_ETH  | 2017/05/04 18:59:47 statusCode 422
0|BTC_ETH  | 2017/05/04 18:59:47 Error!!! statusCode 422
0|BTC_ETH  | !!! Cycle 19 failed. Will repeat in 3000s

In addition how do I specify that I want to use supergun?

Check this pls: https://gunthy.org/index.php?topic=65.0

How do I exit out of the session and keep the bot running on the VPS ?

After you let gunbot running in pm2, just exit the SSH and gunbot will still running on the VPS,

Offline Snapper_Head

  • Rookie
  • *
  • Posts: 4
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #18 on: May 07, 2017, 04:30:06 PM »
I am a little confused. Version 2.04

Quote
Porting back 1000trades and Best currencies for linux users: start them with node 1000trades BTC_ETH or node currencies. Config files for 1000trades and Best currencies are config.js and params.js
This says to start with node 1000trades BTC_ETH
but when I open the config.js the top line is

   COINS_PAIR:   'BTC_ETC',
   KEY: '',
   SECRET: '',
   
How do I add other pairs  to trade ? Do I just add them in the   COINS_PAIR:   'BTC_ETC',   or do I have to create more config files


Offline Nistap

  • Rookie
  • *
  • Posts: 3
    • View Profile
Re: [TUT] How to running GUNBOT in Linux
« Reply #19 on: May 09, 2017, 11:25:44 AM »
I have exactly the same question. As the release notes state that the supergun and 1000trades are configured with config.js and params.js.

For me it is totally unclear how to define multiple coin pairs.

Is it a combination of config.js, params.js and BTC_XXX-config.js?

Is it possible to define multiple pairs in the "COINS_PAIR" keyword in the config.js file.\

I've been looking in several forums and can't find the answer (Maybe I've looked in the wrong places, but until now I have not found any useful information)
« Last Edit: May 09, 2017, 12:15:31 PM by Nistap »