Skip to content

Instantly share code, notes, and snippets.

@vosechu
Last active January 17, 2021 20:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save vosechu/91705eb5ced52512c61cca47e4367bc3 to your computer and use it in GitHub Desktop.
Save vosechu/91705eb5ced52512c61cca47e4367bc3 to your computer and use it in GitHub Desktop.
Gunbot 3.3.2 config
//-----------------------------------------------
// Instructions for this file
//-----------------------------------------------
// This file will provide the basis for all the more specific files. All the
// options set in here will be used by `config.js` files unless they're
// overridden in that file.
//
// If you want to affect all coins at once, edit this file; you don't need to
// reboot the bots though, they'll see that the config changed.
//-----------------------------------------------
var config = {
//===============================================
// Understanding the strategies config
//===============================================
// GAIN/BUY_LEVEL: These are your fallbacks, all strategies must pass these gate
// keepers first. But they are also your safety belt; a fast moving coin
// may end up with you selling at an extreme loss if these weren't in place.
// - BUY_LEVEL uses EMA (length=8 and length==16) to determine when to buy. If a
// coin is BUY_LEVEL% below the lowest EMA line, Gunbot will start using a
// strategy to determine when to buy.
// - It is common to see BUY_LEVEL around 3-5, but special cases exist.
// - GAIN is the percentage ABOVE the purchase price where Gunbot will start using
// a strategy to determine when to sell.
// - It is common to see GAIN set around 2-4, but special cases exist.
//-----------------------------------------------
// GAIN strategy
//-----------------------------------------------
// GAIN strategy: This strategy uses BUY_LEVEL and GAIN alone to set the buy and
// sell prices. Once you pass the fallbacks, Gunbot will issue orders to your
// exchange. Simple and straight forward, but doesn't take advantage of big
// swings in prices.
//-----------------------------------------------
// STEPGAIN strategy
//-----------------------------------------------
// STEPGAIN strategy: Like GAIN, this strategy uses EMA(8) and EMA(16) to
// determine when to buy and sell. This strategy is useful for coins that have
// some predictable volitility. Each level acts as a milestone, where Gunbot
// waits for the price to exceed that level, and then buys/sells when it crosses
// that level again. Since EMA is continuously calculated, this allows Gunbot
// to ride a coin all the way down until it turns around.
// Example: We have a coin that swings by about 5% each day, you might set your
// BUYLVL1-3 to 3/4/5.5 and SELLLVL1-3 to 1/3/5. If that coin drops by 3%
// below the lowest EMA line, Gunbot will speed up and track it closely. If
// the coin turns around, Gunbot will put in a reasonable buy order as soon as
// it crosses the 3% below mark on the way back up. If it continues to go down
// past 5.5%, Gunbot will put in the buy order once the coin goes back up to
// 5.5%. The same happens if you use STEPGAIN to sell.
// Blog post with pictures: https://gunthy.org/index.php?topic=3.0
//-----------------------------------------------
// BB strategy
//-----------------------------------------------
// BB strategy: In this strategy, instead of using EMA(8) and EMA(16), Gunbot
// uses Bollinger Bands with `length=4, ema=false, stddev=2` (or thereabouts).
// LOW_BB/HIGH_BB are the percent from the lower/upper band that you want Gunbot
// to act at. Can be negative. 100 is the center band (not 50). This is a nice,
// effective strategy as long as you have good GAIN/BUY_LEVEL fallbacks.
// Since BB is continuously calculated, this allows Gunbot to ride a coin all
// the way down until it turns around.
// Example: Say we're watching a coin and using BB as our buy strategy with
// LOW_BB set to 50. The coin drops precipitously and gets below 50% of the
// bottom line on the Bollinger Band; Gunbot starts paying attention now, and
// will purchase the coin if it's headed back up and crosses that 50% line
// again.
// Blog post with pictures: https://gunthy.org/index.php?topic=193.0
//-----------------------------------------------
// Bear vs Bull movements
//-----------------------------------------------
// You might expect that you would set BUY_LEVEL/GAIN or LOW_BB/HIGH_BB
// to be the same value, but that would only work if the market was moving
// exactly sideways (which is pretty rare). This is why you'll see the configs
// below with much lower buy levels than sell levels; this ensures that when
// the market is Bearish (going down) you won't lose money - but you also won't
// gain when the market is Bullish (going up).
//
// So, you have a couple options:
// 1. Select your coins very carefully and adjust frequently to only have
// bullish coins. This allows you to have more aggressive settings. For this,
// you might set BUY_LEVEL/GAIN to 2/4. That's double the profit, but will lose
// money in a bear market.
// Blog post with pictures: https://gunthy.org/index.php?topic=4.0
// 2. Grab all the coins and use lopsided settings so you only buy way below
// the EMA line. For this, you might set BUY_LEVEL/GAIN to 5/2. That's a
// consistent 2% gain, but it only activates when a coin drops by a huge amount.
// Almost all of the configs below use this strategy because it's safe to give
// to newcomers.
//-----------------------------------------------
// Example of GAIN strategy
//-----------------------------------------------
// Super easy, conservative strategy. Buy at 5% below EMA, sell it at
// 2% above the bought price. None of the other settings should do anything,
// but we set them to sane-ish defaults in case we change the strategy and
// forget to update the config.
//-----------------------------------------------
// BUY_LEVEL: 5,
// BUY_STRATEGY: 'GAIN',
// LOW_BB: 40, // Won't be used, but set to a sane value
// BUYLVL1: 4.5, // Won't be used, but set to a sane value
// BUYLVL2: 5.5, // Won't be used
// BUYLVL3: 6, // Won't be used
//
// GAIN: 2,
// SELL_STRATEGY: 'GAIN',
// HIGH_BB: 40, // Won't be used, but set to a sane value
// SELLLVL1: 1.5, // Won't be used, but set to a sane value
// SELLLVL2: 3, // Won't be used
// SELLLVL3: 9, // Won't be used
//-----------------------------------------------
// Example of BB/BB strategy
//-----------------------------------------------
//-----------------------------------------------
// BUY_LEVEL: 5,
// BUY_STRATEGY: 'BB',
// LOW_BB: 40,
// BUYLVL1: 4.5, // Won't be used, but set to a sane value
// BUYLVL2: 5.5, // Won't be used
// BUYLVL3: 6, // Won't be used
//
// GAIN: 2,
// SELL_STRATEGY: 'BB',
// HIGH_BB: 40,
// SELLLVL1: 1.5, // Won't be used, but set to a sane value
// SELLLVL2: 3, // Won't be used
// SELLLVL3: 9, // Won't be used
//-----------------------------------------------
// Example of STEPGAIN/STEPGAIN strategy
//-----------------------------------------------
//-----------------------------------------------
// BUY_LEVEL: 5,
// BUY_STRATEGY: 'STEPGAIN',
// LOW_BB: 40, // Won't be used, but set to a sane value
// BUYLVL1: 4.5,
// BUYLVL2: 5.5,
// BUYLVL3: 6,
//
// GAIN: 2,
// SELL_STRATEGY: 'STEPGAIN',
// HIGH_BB: 40, // Won't be used, but set to a sane value
// SELLLVL1: 1.5,
// SELLLVL2: 3,
// SELLLVL3: 9,
//-----------------------------------------------
// Example of BB/STEPGAIN strategy
//-----------------------------------------------
//-----------------------------------------------
// BUY_LEVEL: 5,
// BUY_STRATEGY: 'BB',
// LOW_BB: 40,
// BUYLVL1: 4.5, // Won't be used, but set to a sane value
// BUYLVL2: 5.5, // Won't be used
// BUYLVL3: 6, // Won't be used
//
// GAIN: 2,
// SELL_STRATEGY: 'STEPGAIN',
// HIGH_BB: 40, // Won't be used, but set to a sane value
// SELLLVL1: 1.5,
// SELLLVL2: 3,
// SELLLVL3: 9,
//===============================================
// Some real-life examples (submissions welcome!)
//===============================================
//-----------------------------------------------
// Example of GAIN/STEPGAIN (example from Cryptokeeper, but don't blame him if it doesn't work)
//-----------------------------------------------
// This seems like a very reasonable config which emphasizes quick and obvious
// purchases and long upswings. Very conservative.
//-----------------------------------------------
BUY_LEVEL: 5,
BUY_STRATEGY: 'GAIN',
LOW_BB: 25, // Won't be used, but set to a sane value
BUYLVL1: 5.5, // Won't be used
BUYLVL2: 20, // Won't be used
BUYLVL3: 40, // Won't be used
GAIN: 2,
SELL_STRATEGY: 'STEPGAIN',
HIGH_BB: 25, // Won't be used, but set to a sane value
SELLLVL1: 1.5,
SELLLVL2: 3,
SELLLVL3: 9,
//-----------------------------------------------
// Example of Pingpong (Generally not used)
//-----------------------------------------------
// This is rarely used, but if you know you want buy or sell at exactly one
// value. Usually this is an override situation, but most exchanges let you
// do LIMIT orders, so this hasn't found a lot of use lately.
//-----------------------------------------------
// PINGPONG_BUY: 0.12345678,
// BUY_LEVEL: 5,
// BUY_STRATEGY: 'PINGPONG',
// LOW_BB: 40,
// BUYLVL1: 4.5, // Won't be used, but set to a sane value
// BUYLVL2: 5.5,
// BUYLVL3: 6,
//
// PINGPONG_SELL: 0.12345678,
// GAIN: 2,
// SELL_STRATEGY: 'PINGPONG',
// HIGH_BB: 40,
// SELLLVL1: 1.5, // Won't be used, but set to a sane value
// SELLLVL2: 3,
// SELLLVL3: 9,
BTC_TRADING_LIMIT: 0.01,// max amount of BTC balance to use for each pair
SECURITY_MARGIN: 99, // sell all balance if currency decreases x% after you bought it
MIN_VOLUME_TO_BUY: 0.0005, // bitrex min volume
//-----------------------------------------------
// STARTUP OPTIONS
//-----------------------------------------------
MAX_LATEST_PRICES:300, // limit of latest prices to analyze to determine if price is growing or falling. Gunthar says this should be > 300.
MAX_LATEST_DIRECTIONS:90, // limit of latest price directions, used in supergun detection
MAX_LATEST_PRICES_TREND:30,
MAX_LAST_ORDERS:50,// keeping last orders bought
PERIOD: 15,// candlestick period. This must be 15.
SAVEFILE_SUFFIX: '-save.json',
//-----------------------------------------------
// PRIMARY SETTINGS
DEFAULT_MARKET_NAME:'bittrex',
//---BITTREX
BITTREX_KEY:'xxx',
BITTREX_SECRET:'xxx',
BITTREX_PRICE_METHOD:'ohlc',// ohlc OR vwa price to buy definition method
BITTREX_VWA_1_INTERVAL: 10,// weighted average interval in minutes
BITTREX_VWA_2_INTERVAL: 120,// weighted average interval in minutes
// //---KRAKEN
// KRAKEN_ASSET_PAIR:'XETHXXBT',
// KRAKEN_KEY: '',
// KRAKEN_SECRET: '',
// KRAKEN_PRICE_METHOD:'ohlc',// ohlc OR vwa price to buy definition method
// KRAKEN_VWA_1_INTERVAL: 0.02,// weighted average interval in minutes
// KRAKEN_VWA_2_INTERVAL: 0.04,// weighted average interval in minutes
// //---POLONIEX
// POLONIEX_KEY: '',
// POLONIEX_SECRET: '',
// POLONIEX_PRICE_METHOD:'vwa',// ohlc OR vwa price to buy definition method
// POLONIEX_VWA_1_INTERVAL: 0.02,// weighted average interval in hours
// POLONIEX_VWA_2_INTERVAL: 0.04,// weighted average interval in hours
//-----------------------------------------------
// BOT TIMINGS
//-----------------------------------------------
API_CALLS_DELAY: 10,
BOT_SLEEP_DELAY:(1000)*25,// bot cycle delay (koef*sec)
BOT_MAX_LIFETIME:999999999,// overall bot lifetime(koef*min),
BOT_ON_FAIL_DELAY:(1000)*11, // bot repeat cycle delay if previous cycle failed (koef*sec) //;
//-----------------------------------------------
// EMAIL
//-----------------------------------------------
ALERT_ON_NO_FUNDS:false, // email on insufficcient funds
SMTP_EMAIL: '%40@gmail.com',
ALERT_EMAIL:'********',
SMTP_PASSWORD: '**********',
SMTP: true,
SMTP_PROTOCOL: 'SMTPS',
SMTP_HOST: 'smtp.gmail.com',
//-----------------------------------------------
// OUTPUT FOR LEARNING HOW IT WORKS
//-----------------------------------------------
MAX_LATEST_PRICES_SHOWN: 6, // limit of latest prices to show in console.log
SHOW_LASTEST_DIRECTIONS:true, // show chart in console
// MAX_LATEST_DIRECTIONS_SHOWN:10, // chart height
// LASTEST_DIRECTIONS_LIST_WIDTH:10, // chart width
//-----------------------------------------------
// OTHER (might be deprecated/not in use )
//-----------------------------------------------
BTC_BALANCE: 2, // btc balance for test purposes,
// DEBUG
DEBUG_LOG:false,
I_REALLY_WANT_IT:false,
BUY_SMALL_PORTION:1,
INSUFFICIENT_FUNDS_ON_SELL_FIX: 0.0005,
INSUFFICIENT_FUNDS_ON_BUY_FIX: 0.0005,
};
module.exports = config;
// An example pair config file. Since everything in this file is commented out, it will take all settings from the ALLPAIRS-params.js
// Generally I have like 30 of these files with just 3 lines in them (I usually remove the commented lines).
var config = {
//-----------------------------------------------
// PRIMARY SETTINGS
DEFAULT_CURRENCY_PAIR:'BTC_ANS', // single pair format for all markets !
// BUY_LEVEL: 5,
// BUY_STRATEGY: 'GAIN',
// LOW_BB: 25, // Won't be used, but set to a sane value
// BUYLVL1: 5.5, // Won't be used
// BUYLVL2: 20, // Won't be used
// BUYLVL3: 40, // Won't be used
// GAIN: 2,
// SELL_STRATEGY: 'STEPGAIN',
// HIGH_BB: 25, // Won't be used, but set to a sane value
// SELLLVL1: 1.5,
// SELLLVL2: 3,
// SELLLVL3: 9,
// BTC_TRADING_LIMIT: 0.02,// max amount of BTC balance to use for each pair
// SECURITY_MARGIN: 99, // sell all balance if currency decreases x% after you bought it
// MIN_VOLUME_TO_BUY: 0.0005, // bitrex min volume
};
module.exports = config;
start cmd /k gunthy.exe BTC_ANS bittrex
start cmd /k gunthy.exe BTC_ANT bittrex
start cmd /k gunthy.exe BTC_ARDR bittrex
start cmd /k gunthy.exe BTC_BAT bittrex
start cmd /k gunthy.exe BTC_BTS bittrex
start cmd /k gunthy.exe BTC_DASH bittrex
start cmd /k gunthy.exe BTC_DCR bittrex
start cmd /k gunthy.exe BTC_DGB bittrex
start cmd /k gunthy.exe BTC_DTB bittrex
start cmd /k gunthy.exe BTC_EMC2 bittrex
start cmd /k gunthy.exe BTC_ETC bittrex
start cmd /k gunthy.exe BTC_ETH bittrex
start cmd /k gunthy.exe BTC_FAIR bittrex
start cmd /k gunthy.exe BTC_GAME bittrex
start cmd /k gunthy.exe BTC_GNT bittrex
start cmd /k gunthy.exe BTC_GUP bittrex
start cmd /k gunthy.exe BTC_HMQ bittrex
start cmd /k gunthy.exe BTC_KMD bittrex
start cmd /k gunthy.exe BTC_LTC bittrex
start cmd /k gunthy.exe BTC_MAID bittrex
start cmd /k gunthy.exe BTC_NAV bittrex
start cmd /k gunthy.exe BTC_PIVX bittrex
start cmd /k gunthy.exe BTC_RLC bittrex
start cmd /k gunthy.exe BTC_SNGLS bittrex
start cmd /k gunthy.exe BTC_STEEM bittrex
start cmd /k gunthy.exe BTC_STRAT bittrex
start cmd /k gunthy.exe BTC_SYS bittrex
start cmd /k gunthy.exe BTC_VIA bittrex
start cmd /k gunthy.exe BTC_WAVES bittrex
start cmd /k gunthy.exe BTC_WINGS bittrex
start cmd /k gunthy.exe BTC_XEM bittrex
start cmd /k gunthy.exe BTC_XLM bittrex
start cmd /k gunthy.exe BTC_XMR bittrex
#!/bin/bash
## GUNCONTROL • GUNBOT 3.2 CUSTOM LAUNCHER
## version v0.0.2 / May 2017.
##
##
## Denis Smirnov / densmirnov@me.com / densmirnov.com
## Also credits goes to gionni@gunthy.org for his GunBot Start/Stop Bash Script
##
## BTC: 1denG4FjcXDeGSYeiv65R6Eyi3HWo7R8j
## LTC: Li1ojtx9cwB7SpruVdBAojcUs9j2VLgU6G
## ETH: 0xa4C7fACEFC08e684Cd9043c3e31C86Dfb88DF75a
## LSK: 10061645427951005252L
## -----------------------------------------------
## STARTUP ITEMS
## -----------------------------------------------
export RESET && export BOLD && export RED && export GREEN && export BLUE && export YELLOW && export WHITE && export BOTTOM
RESET=$(tput sgr0) && BOLD=$(tput bold) && RED=$(tput setaf 1) && GREEN=$(tput setaf 2) && BLUE=$(tput setaf 4) && YELLOW=$(tput setaf 5) && WHITE=$(tput setaf 6) && BOTTOM="\n ─────────────────────────────────────────────────────── \n"
# RESET=$(tput sgr0) && BOLD=$(tput bold) && RED=$(tput setaf 1) && GREEN=$(tput setaf 2) && BLUE=$(tput setaf 4) && YELLOW=$(tput setaf 3) && WHITE=$(tput setaf 7) && BOTTOM="\n ─────────────────────────────────────────────────────── \n"
export CMD && export ARCH && export BOTFOLDER && export FILES && export NAME && export NAME1 && export GUNTHY
CMD=$1 && ARCH=$(uname -m) && BOTFOLDER="$(pwd)" && FILES="*-config.js" && GUNTHY=""
## OS DETECTION
## -----------------------------------------------
if [[ "$OSTYPE" == "linux-gnu" && "$ARCH" == "x86_64" ]]; then
GUNTHY="gunthy-linuxx64"
elif [[ "$OSTYPE" == "linux-gnu" && "$ARCH" == "i686" ]]; then
GUNTHY="gunthy-linuxx86"
elif [[ "$OSTYPE" == "darwin"* ]]; then
GUNTHY="gunthy-macos"
else
GUNTHY="Unknown OS"
fi
## MAIN SCRIPT
## -----------------------------------------------
# clear
echo -e "${BLUE}""\n┌───────────────────────────────────────────────────────┐\n${BLUE}│${RESET} ${GREEN}GUNBOT LAUNCHER v0.0.2${RESET} ${BLUE}$(date +%d.%m.%Y\ %H:%M)${RESET} ${BLUE}│\n└───────────────────────────────────────────────────────┘\n""${RESET}"
if [[ -n "$CMD" ]]; then
## START
## -----------------------------------------------
if [[ "$CMD" == "start" ]]; then
echo -e "${WHITE}"" STARTING GUNBOT...$BOTTOM" "${RESET}"
for f in $FILES
do
echo -e "${WHITE}"" • Checking ${YELLOW}$NAME${WHITE}...\t${RESET}\c"
NAME=$(echo "$f"| cut -d'-' -f 2)
if ! screen -list | grep -qw "$NAME"; then
echo -e "${BLUE}"" \t\t\t STOPPED!\n Starting \c""${RESET}"
screen -dmS "$NAME" "${BOTFOLDER}"/"$GUNTHY" "$NAME" bittrex && sleep 0.25
echo -n "${BLUE}...1 ${RESET}" && sleep 0.25
echo -n "${BLUE}...2 ${RESET}" && sleep 0.25
echo -e "${BLUE}...3! ${RESET} ${GREEN}DONE!${RESET}"
else
echo -e "${BLUE}""\t\t\tRUNNING!\n Skipping... ${GREEN}DONE!""${RESET}" && sleep 0.25
fi
done
echo -e "${WHITE}""$BOTTOM ALL PAIRS ARE RUNNING!" "${RESET}"
exit 0
fi
## STOP
## -----------------------------------------------
if [[ "$CMD" == "stop" ]]; then
echo -e "${WHITE}"" STOPPING GUNBOT...$BOTTOM" "${RESET}"
for f in $FILES
do
echo -e "${WHITE} • Checking ${YELLOW}$NAME ${WHITE}... \t\t\t${RESET}\c"
NAME=$(echo "$f"| cut -d'-' -f 2)
if ! screen -list | grep -qw "$NAME"; then
echo -e "${BLUE}""\tSTOPPED!\n Skipping... ${GREEN}DONE!""${RESET}" && sleep 0.25
else
echo -e "${BLUE}""\tRUNNING!\n Stopping... ${GREEN}DONE!""${RESET}" && sleep 0.25
screen -S "$NAME" -X quit && sleep 0.25
fi
done
echo -e "${WHITE}""$BOTTOM ALL PAIRS ARE STOPPED!" "${RESET}"
exit 0
fi
## LIST
## -----------------------------------------------
if [[ "$CMD" == "list" ]]; then
export LOOKUP && export HEADER && export DIVIDER
LOOKUP="ps aux"
HEADER="%-12b\t%-12s\t%-12b\n"
DIVIDER=${BLUE}" ------------"${RESET}
echo -e "${WHITE}"" RUNNING PAIRS:$BOTTOM" "${RESET}"
$LOOKUP | grep -v grep | grep "SCREEN" | awk '{printf " • %-09s\n", $13}'
echo -e "${WHITE}""$BOTTOM" "${RESET}"
exit 0
fi
else
echo -e "${RED}"" COMMAND MISSING$BOTTOM""${RESET}"
echo -e " ${BLUE}Usage: ${WHITE}bash guncontrol.sh [${GREEN}${BOLD} start ${RESET}| ${RED}${BOLD}stop ${RESET}| ${YELLOW}${BOLD}list${RESET} ]${RESET}"
echo -e "${RED}""$BOTTOM" "${RESET}"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment