Skip to content

Instantly share code, notes, and snippets.

@KryptoGB
Last active January 3, 2018 09:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KryptoGB/ebe716caf0e7970630ef67ccd12c2872 to your computer and use it in GitHub Desktop.
Save KryptoGB/ebe716caf0e7970630ef67ccd12c2872 to your computer and use it in GitHub Desktop.
Krypto's "DOUBLE_UP" Exploit for Stepgain
If you are reading this right now you probably know that Gunbots "DOUBLE_UP" averaging feature currently doesn't work with Stepgain.
This exploit uses MIN_VOLUME_TO_SELL as a workaround to get a single "DOUBLE_UP" while using the Stepgain strategy.
This has only been tested on 5.0.4 though it should apply to 4.0.5 as well.
While this should work for other strategies, I've not tested it personally. (edit: BB is Confirmed.)
Hit me up on Telegram in TheBotFather or Gunthy Elite channel if you can confirm/deny it working for other versions and strategies.
To get this working in your config we only need to mess with 2 variables "BTC_TRADING_LIMIT" and "MIN_VOLUME_TO_SELL"
"MIN_VOLUME_TO_SELL" is a setting that was implemented so gunbot would ignore dust (tiny leftover amounts) on the exchanges
By setting MIN_VOLUME_TO_SELL to X% below BTC_TRADING_LIMIT we can trick the bot into thinking this amount is dust and to execute a
"DOUBLE_UP" trend watcher when the pair drops below X%
In the following example our MIN_VOLUME_TO_SELL will be set to 10% less than our BTC_TRADING_LIMIT meaning that when
a pair loses 10% of it's value it will start a trend watcher to find another buy opportunity.
"BTC_TRADING_LIMIT": 0.0010,
"MIN_VOLUME_TO_SELL": 0.0009,
Results at 10% have been pretty good for most pairs. Feel free to tweak, test and share your results with me on Telegram
Be sure to change STOP_LIMIT setting to reflect this new "DOUBLE_UP" if you are running it on all your pairs. In the above example
we would want to set STOP_LIMIT to 11 or more to give the trend watcher room to work.
Did this tip help you? Send me beer money! BTC: 1Per7XsUsCUv4zWNPnrHUizDQX33XxVvKL
Or msg me on Telegram @KryptoGB if you want to tip me in any coin available at Bittrex.
@jadiesel
Copy link

This is insane genius. Going to try it right now.

@tandyuk
Copy link

tandyuk commented Sep 19, 2017

Krypto's double up 'feature' in action:
BTC-DAR

        "BOT_DELAY": 60   (With this bot running a single pair, average update freq is about 30-35seconds)
        "period_storage_ticker": 300,     (300 samples of data, 30 seconds apart - this is 150 minutes, or 2.5 hours)
        "interval_ticker_update": 30000,   (Bot must run for minimum 2.5 hours before it has all this data, results prior to this are sktechy to say the least)
        "bbstepgain":
        "BTC_TRADING_LIMIT": 0.02,
        "PERIOD": 5,   (5 min candlesticks)
        "HIGH_BB": -5,  (Slightly above the top BB)
        "LOW_BB": 10,    (Just above the bottom BB)
        "STDV": 2,
        "SMAPERIOD": 300,   (last 300 samples (2.5h) of data to calculate SMA for buying)
        "SELLLVL1": 0.95,    (baseline breakeven level - really my math shows 0.55 is the absolute minimum profit to break even on bittrex, but if you go that low all youre doing is lining their pockets with fees)
        "SELLLVL2": 1.3,     (minimum level we really want to sell at)
        "SELLLVL3": 3,       (and if we get this high, im happy, sell now regardless)
        "SELLLVL": 2,	(sell somewhere between SELLLVL2 and SELLLVL3)
        "LASTPOINTS": 20,  (last 20 samples (10m) to see price jumps)
        "AVGPOINTS": 120,  (last 120 samples (60m) to calculate average price for selling)
        "AVGMINIMUM": 1.0e-8,
        "EMA1": 200,   (last 200 samples (1h40m) of data to calculate EMA1)
        "EMA2": 50,    (last 50 samples (25m) for EMA2)
        "PANIC_SELL": false,    (if you set this to true, your bot will instantly sell ALL of your coins at whatever market rates are when you load the bot. Imho this should have a 'double lock' type saftey feature, eg setting "ALLOW_PANIC":true up in bot settings.)
        "DOUBLE_UP": false,    (never had real success with this, apart from it buring a 1.5BTC hole in my pocket by repeatedly doubling up.
                                THIS REALLY NEEDS TO DEFAULT TO OFF
                                and end rant! )
        "STOP_LIMIT": 85,      (In theory, if coin value drops to this % of the value you paid for it, sell. Eg. you buy for 1.000. Prices reaches 0.850 bot sells. Has never actually worked for me once!)
        "BUY_ENABLED": true,
        "MIN_VOLUME_TO_BUY": 0.02, (Ensure this is slightly above sell value)
        "MIN_VOLUME_TO_SELL": 0.0195 (This is the 'bug'/'feature'/'whatever you want to call it' that Krypto found - no idea why this causes the bot to be able to double buy, but imho this makes the bot behave like DOUBLE_UP should do)

3:05pm buys 0.02004998 worth of DAR @ 0.000175 (114.28571428 units)
Price continues to fall.
5:57pm buys another 0.02004998 worth of DAR @ 0.0015768 (126.83916793 units)
7:12pm sells 0.04384236 worth of DAR @ 0.00018228 (241.12488221 units)
Gross profit: 0.0037424

BUG!
7:19pm buys 0.02004998 worth of DAR @ 0.00019100 - WTF??
7:24pm manual sale of DAR @ 0.00019774
Gross profit: 0.00060401

So nice tidy little profit from the double up, and fortunately, from the double buy bug - Though I can assure you this would not have happened if i was not already looking at the coin for this very post when the bug happened. By the time I'd finished writing this post, DAR was back at 0.00019200 (Although at one point it did dip again to 0.00018712 or so, and yes, my bot did buy and sell again - but without a double buy of any sort :) )

So what would have happened if I had
"MIN_VOLUME_TO_BUY": 0.02,
"MIN_VOLUME_TO_SELL": 0.02

3:05pm buys 0.02004998 worth of DAR @ 0.000175 (114.28571428 units)
Price continues to fall.
7:12pm sells 0.02083199 worth of DAR @ 0.00018228
Gross profit: 0.00078201

So in all, the double buy feature/bug that Krypto found earnt me a tidy 0.00296039 profit, plus the 0.00060401 rescued from the other double buy bug means I'm off down the pub for a pint (or 3!)

Added some explanations of how I interpret the settings, and why ive set values as I have to help others understand how the ticker periods, and other things affect the charts.

Here is what I believe the chart my gunbot 'saw' looks like
https://s.tradingview.com/x/4bw31Mzo/

@guelz
Copy link

guelz commented Sep 21, 2017

great work!
but is EMA1 +2 really a multiple of data samples and not of 5min candles??
"EMA1": 200, (last 200 samples (1h40m) of data to calculate EMA1)
"EMA2": 50, (last 50 samples (25m) for EMA2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment