Username: Password:

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Rakeau

Pages: [1]
1
Beginners & Help / Re: [LINUX] Stop after sell script
« on: June 29, 2017, 10:41:34 AM »
Nice. I did think that Gunbot should have a built-in way to stop a bot after it completes a sale, a "graceful" stop if you will.

2
Technical Support & Development / Re: Linux proxy for 422 errors.
« on: June 29, 2017, 05:28:10 AM »
Rather than going to all the effort to setup a DNS server, in order to 'override' the DNS lookup of Polo, why not just add the relevant domains into the /etc/hosts file? That will cause them to resolve to 127.0.0.1. And should you want to stop using the proxy, you just remove them out of that file again. By running dnsmasq and putting the IP address override in dnsmasq.conf you're basically doing the same thing - and if you want to disable the proxy you would have to undo the same changes in the config file.

Far less messing around, less resource overhead, and fewer dependencies to setup and install this way. The less things there are to break, the better.

Setup can be summarised as:

1. Setup the proxy config file settings.yml
2. Run polproxy.py
3. Add or remove 127.0.0.1 poloniex.com to /etc/hosts to use / not use proxy.

I'm running an AWS Ubuntu VPS. using python uses Python 2.x, so you need to change your commands for python3. To get it running:


Setup:

sudo apt-get install libgnutls28-dev
sudo apt-get install libcurl4-gnutls-dev
sudo apt install python-pip
sudo pip install pycurl
sudo pip install pyyaml
sudo pip install urllib
(Might not be necessary as per AlfonseX's post https://gunthy.org/index.php?topic=541.msg2781#msg2781)
sudo setcap CAP_NET_BIND_SERVICE=+eip $(readlink -f $(which python3))
wget https://github.com/kevinlekiller/polproxy/archive/master.zip -O ~/polproxy.zip
cd ~
unzip polproxy.zip
cd polproxy-master/
cp settings.yml.example settings.yml
nano settings.yml
(<-- input API details, ctrl+x then Y to save and close)

This assumes you'll put the polproxy folder in your home folder (~/).


Running the proxy:

cd ~/polproxy-master
screen -S proxy -dm python3 polproxy.py
sudo sh -c 'echo 127.0.0.1 poloniex.com >> /etc/hosts'


By using screen, we can have the proxy running in the background and leave the terminal free for other tasks.


Checking the proxy + Killing the proxy using screen (crash course):

screen -list -- shows active screens
screen -r proxy -- goes into the screen running the proxy, you can check its output for errors etc.
Ctrl + A then D -- detaches from the screen.
Ctrl + C -- Kills the proxy and terminates the screen (fix /etc/hosts first -- see below)
sudo nano /etc/hosts -- Edit the hosts file. Either comment out the lines (# prefix) or just remove them + save.

With that I can run the proxy.

Basically, to use the proxy, we run it, and then change our /etc/hosts file to point poloniex.com to 127.0.0.1. To stop using the proxy, we remove the poloniex entry from the hosts file. You don't even need to stop your bots.


However, once updating /etc/hosts , if I tail Gunbot's logs, I get:

Code: [Select]
2017/06/29 16:07:24     ::::: collecting market data...
2017/06/29 16:07:25     *** PLNX CALLBACK | calling EMA ***,unable to verify the first certificate
2017/06/29 16:07:25     2017/06/29 16:07:25 Error: Error: unable to verify the first certificate
2017/06/29 16:07:25     !!! Cycle 1413 failed. Will repeat in 60s

So it has an effect - but there seems to be an SSL issue. I imagine that is because I set it up using beer-k0in's Generator script + gmon, so I can't set the TLS_REJECT thing for nodejs... (I'm not sure if I'll continue using that but I digress).

If I don't run it via gstart / pm2 start and instead run it manually using the command provided (NODE_TLS_REJECT_UNAUTHORIZED=0 ./gunthy-linuxx64 BTC_PAIR poloniex), it seems to work, but I still get errors (leading to cycle failures), process duplication and high CPU usage. Unfortunately I don't think this bot really seems to solve anything.

Given there's a Windows Gunbot Proxy floating around as well, given these proxies seem popular right now, maybe it would be worth Gunthar giving us the option to use a proxy server or allow us to set the API URL / Domain in Gunbot's settings, rather than hard-coding it in .. this would greatly simplify things. Even if an update does resolve the 422 errors.

Also - the Poloniex API suggests to use "api.poloniex.com", so this may also need to be added, either to dnsmasq config or /etc/hosts. However, it really depends on which domain name Gunbot is trying to resolve internally.

Pages: [1]