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.

Topics - jroddingham

Pages: [1]
Couple of things I figured I would get typed out.

So, in my experience I have seen that supergun (the algo watchdog, not the RR strategy) works pretty darn well when monitoring directions. However, I have also noticed that it sometimes feels a little trigger happy (PUNS FOR DAYS) when performing a sell or buy. We know that it's monitoring for ++++++- to know when to sell and decide a trend reversal has happened. What we don't know is, exactly how many -'s it takes within a time period for that to happen. We can only configure the *total* number of prices it stores to determine directions. In my mind it would be desirable to make supergun more or less responsive to trend reversals. Meaning, sometimes it would be nice to allow a ++++-+--+++++++ to not sell, or be super sensitive and have it sell on ++++++-


     I propose a tight/loose trigger function for supergun directions. It would use two variables, 'triggerPlus' and 'triggerMinus'. These would be integers that define how many positive or negative directions in a row you would accept before a trigger condition is met.

For example, triggerPlus: 3 and triggerMinus: 2 with a MAX_DIRECTIONS: 10 would do the following:

trying to sell:

+++-++--++ -> Nothing happening to trigger yet, trend hasn't reversed because we are allowing for 2 negatives in a row so still rising
++++-++--- -> SELL! (3 negative directions has gone over the threshold, therefore trend has now reversed)

trying to buy:

----+----+ -> Nothing happening because not enough up trends to signal for a reversal
-----+-+++ -> BUY! You've gone over the configured amount to signal reversal

Beginners & Help / Gunbot Configuration Guide (WIP)
« on: April 28, 2017, 01:25:37 PM »
This will take some time I think, so please disregard this post until the (WIP) is removed from the title. Thanks!

This post will be my attempt to get some visual documentation and explanations of the various strategies gunbot uses, as well as some more verbose descriptions of the config files. If ANYONE catches something said herein that is false, please reply and let me know. It takes a village and all that.... Let's get started!

I will attempt to keep this thing somewhat readable, there's a lot to cover, and much I don't know. This started with just wanting to make a verbose line for all the existing config comments, and has ballooned into something much more considering how often some questions get asked and assumptions of knowledge from existing users when trying to talk to newcomers. I had a decent amount of frustration getting details of the various parameters when I first joined up. Let's mitigate that a bit for future users.

Gunbot as of right now employs 4 different strategies.
  • BB - Bollinger Band
  • GAIN - Stepgain (explained later)
  • 1000 Trades - Ping Pong EMA
  • Supergun - Old Russian Roulette (confusing name, not to be confused with the supergun watchdog algo)

Bollinger Bands:

This is a well known indicator used in many other markets besides altcoins, of course. It is a method that attempts to visually represent the range of prices a security could hit on either extreme. It is calculated using standard deviation and SMA (simple moving average). It's a good way to visually see volatility in a security. (Gunbot likes volatility)

Now, actual strategies on using this particular indicator are beyond the scope of this document. However, let's make some basic assumptions so that the way it is configured with the bot and expected behaviors can be explained.

Let's assume you want to buy at the lower portion of the inside of the bands, and sell when a price climbs to the upper portion of inside the bands. The configuration file has these lines to set that:
Code: [Select]
LOW_BB: 10,
HIGH_BB: 10,

This is showing what your settings would then be trying to do. Please note that the overlays in that image are not to scale. We are dealing with percentages, so when the bands tighten up, so does the colored line I drew. This is more of a concept than an attempt to use hard numbers. The entire width of the inside of the bands will be 100%. The HIGH value measures as a % from the top of the band going down, and the LOW measures as a percentage on the inside going up. Also notice that gunbot uses a signed int for the integer variable, so will indeed accept a negative value. You can see the effect of that in the image, as it will start going negative as you leave the confines of the band.

OK, so you see how that works. For this to be effective though, you really need to have a lot of prices to calculate the deviations. The default of 300 prices is a suggestion, but of course you can go higher than this.

This next bit is fairly important for you to understand, as it relates to many other things gunbot does and the logic it follows.

When gunbot makes a call to the exchange, it is pulling whatever the newest price is at it existed on the books at that time. It logs this in memory and in the logs. How accurate this data is will be highly dependent on how often you are asking for the pricing data. It can and does collect data via PUSH notification via the public API, but this isn't enough.

Poloniex, Kraken, Bittrex, etc do not send any data as it relates to EMA, BB, etc. Meaning, it can't call and say "Give me the BB data for this pair, in this time frame, kthx." It is because of this fact that it has to collect the data itself in order to make it's own formula calculations.

Bot sleep delay really means "I will ask the exchange for a price every N seconds and wait that long before trying again."
Code: [Select]
MAX_LATEST_PRICES: 300 is where you would set how many prices you want the bot to store before switching to Bollinger Band trading. This is a sliding window, meaning it will ONLY be looking at the last N number of prices when making decisions.

It has a save state, to allow for a bot to restart and not have to collect a complete set of data again. Gunbot will perform best if you allow it to always be seeing a complete set of pricing data so as not to throw off your standard deviation numbers.

Code: [Select]
These are weighted variables, using EMA1 and EMA2, adjusted according to volume.

Poloniex can calculate the BB using all the available data on the books, and gunbot can only do it's best with the prices it has retrieved. This is why you CANNOT simply look at the Poloniex bands and see your bot didn't buy where you think it should have, because there will be a discrepancy there. The bands will change if you change the candles you are looking at, but not if you change the range of time.
You *need* to set the candlesticks on Poloniex (or other exchange) to match the PERIOD you have set in your configs to have any hope of comparison without creating your own charts from the bot log data!

This candle range will be set with
Code: [Select]
PERIOD: 15,   // candlestick period I believe that is the same across the configs, as far as the naming used there.

Ok, well let's see if I can manage to annotate the BB-XXX_YYY-config.js file with lots of comments, and let Gunthar tell me all the ways I'm wrong. Fun!

Code: [Select]
var config = {
DEFAULT_MARKET_NAME:'poloniex', // Self explanatory, I think he uses this in case some other parameter isn't passed, not sure though

BTC_TRADING_LIMIT:0.01, // This is the maximum amount of currency that gunbot will be allowed to use to trade with. In the BB strategy, I believe this is all used in one trade.

SECURITY_MARGIN: 60,  // This is a percentage you set to tell the bot when you've raised the white flag and you are ready to surrender. If the price of the security you bought drops this number as a percentage from the price you bought, an immediate sell is issued.

MIN_VOLUME_TO_BUY: 0.0005, // This is pretty much if you don't like to see those small bags collecting in your portfolio. Set this to an amount that is the minimum you want to buy.

LOW_BB: 5, // Low end of the BB band, as a % measure up from the bottom band

HIGH_BB: 5, // High end of the BB band, as a % measure down from the top band

SELL_STRATEGY: 'BB', // You can mix and match strategies here, BB or GAIN

BUY_STRATEGY: 'BB', //  You can mix and match strategies here, BB or GAIN

BUY_LEVEL: 0.1, // this is the buy level used in GAIN, it's here in the BB because it will be used until enough prices have been collected to start BB


BITTREX_GAIN: 2, // This number is a percentage where gunbot will sell after the purchase

BITTREX_PRICE_METHOD: 'vWP', // yeah, no clue. This follows his variable naming, so some thing needed in relation to how the API data gets pulled differently from each exchange

BITTREX_VWA_1_INTERVAL: 10, // Time interval as Bittrex is concerned. I don't know, but I would assume this is close to the .02 from polo

BITTREX_VWA_2_INTERVAL: 120, // Time interval as Bittrex is concerned. I don't know, but I would assume this is close to the .02 from polo



GAIN: 2, // this is the buy level used in GAIN, it's here in the BB because it will be used until enough prices have been collected to start BB. It is also used in a situations where your best bet is to take the gain, due to what supergun is currently seeing.

POLONIEX_PRICE_METHOD: 'ohlc', // yeah, no clue. This follows his variable naming, so some thing needed in relation to how the API data gets pulled differently from each exchange

POLONIEX_VWA_1_INTERVAL: 0.02, // ema1 + volume period
POLONIEX_VWA_2_INTERVAL: 0.04, // ema2 + volume period

SELL_ON_START: false, // sell all your inventory when bot starts

CANCEL_SELL_ORDERS_ON_START: false, // cancel all your sell orders when bot starts

CANCEL_BUY_ORDERS_ON_START: true, // cancel all buys when bot starts

CANCEL_OPEN_ORDERS_ON_START: false, // cancel any open orders when bot starts

MAX_LATEST_PRICES: 300, // how many prices the bot will store to do the deviation calculations (this should be a nice high number for BB)

MAX_LATEST_DIRECTIONS: 30, // number of prices bot will use to determine price momentum up or down (supergun watchdog)

MAX_LAST_ORDERS: 500, // number to tell bot how many order entries to store in logs

PERIOD: 15, // candlestick period (If looking at Poloniex, make sure this matches your chart on the website)

SAVEFILE_SUFFIX: '-save.json', // pretty obvious, no need to change unless you're a tweaker. :)

API_CALLS_DELAY: 777, // new variable, not sure exactly what this does. Sounds like it should be obvious, but we are making calls for prices all the time. Maybe it has something to do with a specific API call. Gunthar?

BOT_SLEEP_DELAY: (1000) * 20, // used to determine the amount of time the bot should wait between calling the API and asking for orderbook prices.

BOT_MAX_LIFETIME: 999999999, // how long should this bot run before turning off?

BOT_ON_FAIL_DELAY: (1000) * 10, // If you get an error from Poloniex, due to any issue including them getting slow, this is a delay you set to override your normal delay. This is useful to not get banned!

ALERT_EMAIL: '********',
SMTP_PASSWORD: '**********',
SMTP: true,

DEBUG_LOG: false,
module.exports = config;

That's it for the BB section, I am surely wrong on some things, and missed others. I will be adding the next strategy soon, probably GAIN, as I haven't even run the 1000Trades or Russian Roulette yet!

Gunbot running in supergun, level 3. It picked the bottom and the top of the bounce perfectly. Just wanted to share with everyone and new users the power of direction analysis!

Beginners & Help / GUNBOT - Linux Tutorial
« on: April 12, 2017, 02:00:37 PM »
I will assume you've got a working linux machine. VPS, local, whatever. There's already a ton of info on Google about getting that functional. (Gunthar if required we can maybe throw some links in here too, VPS suggestions etc)

OK. First thing you need to do is figure out which distribution you are using. Different versions have different package managers. It won't affect being able to run the gunbot executable. I will give instructions for Debian based distros, and we can append to it with package commands for the others if need be.
You now should be sitting in the home directory of your session.

Now you need to go grab the zip file containing the latest gunbot goodies. You do this by issuing a 'wget' command, which will copy that file to your home directory.
Open your browser and go to
Find the latest one, right click the url and copy it to your clipboard. Go back to your terminal and issue a:

Code: [Select]
jrod@ISHTAR:~$ wget

This will download the zip file to your home directory. (Gunthar doesn't use tar apparently  ;)) You now need to unzip it. You likely don't have unzip installed, so using the default Debian package manager you would issue this command:

Code: [Select]
jrod@ISHTAR:~$ sudo apt-get install unzip

You will be prompted for your password. Sudo is issued in this type of linux where you are a non-root user. You are telling the shell to run the command with elevated privileges. This is basically a security feature. After installing that package, you can now unzip your files.

Code: [Select]
jrod@ISHTAR:~$ unzip

OK, so you've gotten this far. the command 'ls' in linux will list the contents of the directory you're in. Let's do that now.

Code: [Select]
jrod@ISHTAR:~$ ls

You will see the original file you downloaded, and now a directory that contains everything that was unzipped. Now you need to get into that directory to do a couple more things. The command in linux to change a directory is 'cd' (It's also this in DOS and Windows terminal) You can go back a directory with a 'cd ..' and recall the list directory with 'ls'

Code: [Select]
jrod@ISHTAR:~$ cd gunbotv2.0.4_linux_x86_x64

Now, the gunbot file needs to be set to be executable, else you'll get an error about not having permissions to run it. So, let's do that!

Code: [Select]
jrod@ISHTAR:~/gunbot/gunbotv2.0.4_linux_x86_x64$ chmod +x gunbot

Now, to run the file from linux terminal it's the name of the file preceded by a './', like this:

Code: [Select]
jrod@ISHTAR:~/gunbot/gunbotv2.0.4_linux_x86_x64$ ./gunbot BTC_DASH
Gunthar has provided that one pair as an example, you will run gunbot executable against each pair you want to run. You will have to use a program called 'screen' or 'tmux' in order to run a session on a remote terminal, and not have it die when you disconnect.  I will give some brief instructions as well as some links on using tmux. Here's what it looks like when running:

So, tmux. Basically think of this as a container for all your multiple terminal sessions. There are many ways to do this, and Crypto Wally has by far the best implementation (which hopefully he posts at some point) but for now, this will get you something reasonably functional. First a simple google of 'tmux tutorials' will bring you lots of stuff. Videos are out there as well as detailed tutorials. I am going to show you how I currently look at my 14 or so pairs.

You're going to need to install tmux.

Code: [Select]
jrod@ISHTAR:~/gunbot/gunbotv2.0.4_linux_x86_x64$ sudo apt-get install tmux
Run tmux after installing:

Code: [Select]
jrod@ISHTAR:~/gunbot/gunbotv2.0.4_linux_x86_x64$ tmux

This will open up a new window, started in the directory you executed from. You will notice the new line at the bottom showing you the current active window. Tmux is the container in which everything else will nest in. Now, for tmux to know you're issuing a command to it, and not anything else you have to issue a (configurable) command to tell tmux to get ready and follow your godlike commands issued from your fingertips. By default, this is 'ctrl - b'. Here's a handy list of things you can do with tmux:

You have your choice of running multiple full size windows that you can toggle between, or splitting the exiting window into smaller ones that you can see fill all at once. This is a matter of preference, but after a bunch of pairs due to the way the console outputs you can't really see much of what is going on at that point. That's why Wally pipes the output to tee and then reformats it. Anyway...

Here's how it looks if you issue a combination of 'ctrl-b %' commands and 'ctrl-b "' commands.

ctrl-b " splits the screen horizontally:

ctrl-b % splits the active window vertically:

You can move around the windows with a ctrl-b (arrow key), and kill any one of them with a ctrl-b x. Again, take a look at the commands list and play around.

Now, here's what I currently do for better visibility. Instead of a split screen, each command is opened in it's own full window and I can tab between those. You can see by default it's named 'bash' at the bottom, but that's because we haven't done anything. If you run a gunbot session, it will want to be named gunbot. You will want to rename these. You can rename your window with a 'ctrl-b ,' command. The bar at the bottom changes asking you for a new name, like this:

you can create a new window and rename it with a 'ctrl-b c' to (c)reate the new window and again a 'ctrl-b ,' command to rename it. There's two ways to toggle between the windows within tmux. You can do a 'ctrl-b' followed by the number of the window you're going for, or a 'ctrl-b w' which will bring you an interactive list to switch around.


when you are ready to detach from your session, you will want to issue a 'ctrl-b d' for (d)etaching from your session. This will drop you back to your regular shell prompt, you can safely exit your shell/session. When you want to reattach, just issue a simple 'tmux attach' to get back to it. That works easily enough for the single tmux session, if you want to run multiple sessions that's another story.

Next up, you may want to play with the 1000 trades or best currencies. You will need to have the latest version of node installed.

check the version of nodejs you have by running:

Code: [Select]
jrod@ISHTAR:~$ nodejs --version

You don't want version 4.2.6, you'll likely need to update. Easiest cleaner way will be to purge your old version, and then curl to install the newer package.

Code: [Select]
jrod@ISHTAR:~$ sudo apt-get purge nodejs-legacy

Now, curl to get the newer version and prepare to install.

Code: [Select]
jrod@ISHTAR:~$ curl -sL | sudo -E bash -

Now, go ahead and intstall nodejs.

Code: [Select]
jrod@ISHTAR:~$ sudo apt-get install nodejs

At this point you can run the 1000 Trades and the Best Currencies apps from within your working folder.

Also, check this thread:

It has a very nice way to run all your pairs at once without any fancy screen bash scripts. Well worth the look!

Gunthar already fattened my BTC wallet, but if you're feeling generous and this helped you out, here's my cardboard sign and tip jar wallet:


Pages: [1]