Username: Password:

Author Topic: Gunbot Configuration Guide (WIP)  (Read 88706 times)

Offline jroddingham

  • Rookie
  • *
  • Posts: 16
    • View Profile
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)

https://www.tradingview.com/wiki/Bollinger_Bands_(BB)


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,
SELL_STRATEGY: 'BB',
BUY_STRATEGY: 'BB',



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]
POLONIEX_VWA_1_INTERVAL: 0.02,
POLONIEX_VWA_2_INTERVAL: 0.04,
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
DEFAULT_CURRENCY_PAIR:'BTC_PIVX', // ^^^^^ same

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_KEY: '', // API KEY
BITTREX_SECRET: '', // API SECRET

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

KRAKEN_ASSET_PAIR: 'XETHXXBT',
KRAKEN_KEY: '',
KRAKEN_SECRET: '',
KRAKEN_GAIN: 2,
KRAKEN_PRICE_METHOD: 'vWP',
KRAKEN_VWA_1_INTERVAL: 1,
KRAKEN_VWA_2_INTERVAL: 15,

POLONIEX_KEY: '', // API KEY
POLONIEX_SECRET: '', API SECRET

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_ON_NO_FUNDS: false,
SMTP_EMAIL: '%40@gmail.com',
ALERT_EMAIL: '********',
SMTP_PASSWORD: '**********',
SMTP: true,
SMTP_PROTOCOL: 'SMTPS',
SMTP_HOST: 'smtp.gmail.com',

DEBUG_LOG: false,
 I_REALLY_WANT_IT: false,
BUY_SMALL_PORTION: 1,
INSUFFICIENT_FUNDS_ON_SELL_FIX: 0.0005,
MAX_LATEST_PRICES_SHOWN: 0,
SHOW_LASTEST_DIRECTIONS: false,
MAX_LATEST_DIRECTIONS_SHOWN: 0,
LASTEST_DIRECTIONS_LIST_WIDTH: 0,
BTC_BALANCE: 2,
};
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!

« Last Edit: May 03, 2017, 02:33:56 AM by jroddingham »

Offline AlfonseX

  • Contributor
  • **
  • Posts: 101
  • Trop de chefs, pas assez d'indiens !
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #1 on: April 28, 2017, 03:13:50 PM »
Very nice initiative, it will help a lot of people. And then, it will centralize all this information.
Thank you very much.
If you think I helped you, give me a drink:
in btc: 12aeQSpytxoehCEptQE8tUJVVSAS42LvXo
in eth: 0x02a611f0c15bccdb6fa8e5e4b0692ff6d77852bd

Offline majorlee

  • Rookie
  • *
  • Posts: 17
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #2 on: April 28, 2017, 05:21:07 PM »
some great work there J-Rod - u deserve a medal :)

Offline Cyperh

  • Rookie
  • *
  • Posts: 22
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #3 on: April 28, 2017, 08:44:57 PM »
Very great work! Thanks a lot.
This is exactly what many of us missed until now.
Great J-Rod

Offline criptonauta

  • Contributor
  • **
  • Posts: 137
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #4 on: April 30, 2017, 03:42:53 AM »
Thumbs Up!

Congratz, J-Rod  :D

Also, it'll save us from innumerable explanations!  ;D
   ✔ FAST, APPROVED AND EASY Escrow for used GunBot licenses @ 5% ..:..Gunbot licenses 10% off: 'Criptonauta_Gun' code. | Tuning, Custom Strats | No VPS? Get yours here   ✔

Offline Marati Mario

  • Rookie
  • *
  • Posts: 6
  • no personal texts
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #5 on: April 30, 2017, 01:53:05 PM »
stunning explanation

Offline gionni

  • Rookie
  • *
  • Posts: 23
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #6 on: May 01, 2017, 03:58:57 PM »
Adding something I just learned from Gunthar regarding the GAIN setting.
As pointed out this is used before BB can kick in but also:
Quote
Gunthar De Niro, [01 mag 2017, 16:51]:
if the BB calculation is complete but the gap is lower than %GAin it sells at %GAIN

look at BB value you have in yoru bot

and do maths

there is a protection against too tiny BB

Quote
or because BB are too tiny so if it follows BB - highBB value you would trade at loss

so it falls back to %GAIN minimum

So basically even when working with BB don't forget to set your GAIN level appropriately.

PS. +1 For getting a nicely commented config file

Offline Top0tun

  • Rookie
  • *
  • Posts: 11
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #7 on: May 02, 2017, 11:06:43 AM »
guys, I am a little bit confused with EMA.
How do you calculate 0.02 and 0.04 ? Should I multiply 60 * 0,04 to get correct time ?
If yes 60*0,04 = 2,4 - it means 2 minutes ? Why it so small ?

Offline jroddingham

  • Rookie
  • *
  • Posts: 16
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #8 on: May 02, 2017, 03:06:10 PM »
guys, I am a little bit confused with EMA.
How do you calculate 0.02 and 0.04 ? Should I multiply 60 * 0,04 to get correct time ?
If yes 60*0,04 = 2,4 - it means 2 minutes ? Why it so small ?

Probably just due to the way the rest of the program is constructed. Instead of another line or two in the code to handle converting the config value to what the program needs, this is just a direct number. In this case, .02 == 2 hours, .04 == 4 hours. Just move the decimal point!

Offline Top0tun

  • Rookie
  • *
  • Posts: 11
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #9 on: May 02, 2017, 06:03:51 PM »
guys, I am a little bit confused with EMA.
How do you calculate 0.02 and 0.04 ? Should I multiply 60 * 0,04 to get correct time ?
If yes 60*0,04 = 2,4 - it means 2 minutes ? Why it so small ?

Probably just due to the way the rest of the program is constructed. Instead of another line or two in the code to handle converting the config value to what the program needs, this is just a direct number. In this case, .02 == 2 hours, .04 == 4 hours. Just move the decimal point!
And now my head is blow off. how I'll set 15 mins ?

Offline jroddingham

  • Rookie
  • *
  • Posts: 16
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #10 on: May 02, 2017, 08:49:06 PM »
guys, I am a little bit confused with EMA.
How do you calculate 0.02 and 0.04 ? Should I multiply 60 * 0,04 to get correct time ?
If yes 60*0,04 = 2,4 - it means 2 minutes ? Why it so small ?

Probably just due to the way the rest of the program is constructed. Instead of another line or two in the code to handle converting the config value to what the program needs, this is just a direct number. In this case, .02 == 2 hours, .04 == 4 hours. Just move the decimal point!
And now my head is blow off. how I'll set 15 mins ?

You sure you want 15/30 minute EMA calculations and not meaning to have 15 minute *candles*? I mean you can get 15 minutes by (.02 / 8) = .0025. I wouldn't suggest that, but hey tweak however you want!
« Last Edit: May 03, 2017, 02:35:52 AM by jroddingham »

Offline Zoro

  • Rookie
  • *
  • Posts: 5
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #11 on: May 07, 2017, 01:38:22 PM »
Hello all together :)

I am completky new to this kind of things so maybe my question is more then unadequate (so forgive me in advance please), but can anyone of you explain in a simple way, what the new features or differences are between the existing trading mechanics? ( BB - Step gain, the original config?-1000 trades- russian roulette)

@ jroddingham

thank you very much for your time and work on the BB-explanation, thats much appreciated!

my best greetings in the round

-Zoro-

Offline Outsider

  • Rookie
  • *
  • Posts: 38
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #12 on: May 07, 2017, 08:19:15 PM »
Anyone got an idea on how to match the Gunbot BB generation with the Poloniex visuals?

Offline majorlee

  • Rookie
  • *
  • Posts: 17
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #13 on: May 10, 2017, 12:34:02 PM »
thanks buddy

Offline Kruste

  • Rookie
  • *
  • Posts: 13
  • be strong to be useful
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #14 on: June 08, 2017, 11:19:32 AM »
Thx for the guide @jroddingham  :)

Offline jontix

  • Rookie
  • *
  • Posts: 4
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #15 on: June 11, 2017, 11:21:21 PM »
Thanks J-Rod! Very useful!

Offline TellGoDiSaidSup

  • Rookie
  • *
  • Posts: 1
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #16 on: June 23, 2017, 09:00:22 PM »
Thanks for this! A lot of great information. What should we enter in the graph/chart settings?

Offline freelunch

  • Rookie
  • *
  • Posts: 19
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #17 on: June 24, 2017, 01:24:00 AM »
Very nice, thanks a lot!

Offline Oktorok

  • Rookie
  • *
  • Posts: 1
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #18 on: June 24, 2017, 03:49:54 AM »
Thanks for this! A lot of great information. What should we enter in the graph/chart settings?

Hey guys I am a newbie here too, trying to understand EMA1, EMA2 and BB - I would also like to know what we put in these values on Poloniex. Gunthar's guide recommends 4 hours and 8 hours for EMA1 and EMA2 right? So what does that mean we put in on Poloniex graph settings? Thanks all

Offline holodigm

  • Rookie
  • *
  • Posts: 1
    • View Profile
Re: Gunbot Configuration Guide (WIP)
« Reply #19 on: June 29, 2017, 10:34:40 AM »
SMA and EMA are calculated from time 'periods', so in general this is your candle stick size.
So for 15 minute candle sticks I generally set:
EMA 1 = 2 hours / 15 mins = 8
EMA 2 = 4 hours / 15 mins = 16
SMA I normally set to 12 and this will effect your BBs

These generally match closely to the trade signals that gunbot works with when using EMA based trades.
Anyone who knows more please add :)

Also, have a look at http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages#exponential_moving_average_calculation
 and maybe  https://coins.newbium.com/post/1873-indicator-on-poloniex-what-is-that