Вы находитесь на странице: 1из 10

1.

Gunbot installation
1. Unpack the release .zip file.
2a. When youre not planning to use the WebGUI, prepare the config.js file with your bot
settings, exchange api keys, strategies and pairs (detailed info below).
2b. When youre planning to use the WebGUI, proceed reading here below.
3. Start the Gunbot executable.

Windows: double click gunthy.exe


Linux/ARM/Mac: make sure Gunbot is executable, run chmod +x gunthy-linx64
start Gunbot with ./gunthy-linx64

WebGUI installation (optional)

First, make sure you have a recent version of Node.js installed.


(https://nodejs.org/en/download/current/)

1. In a command prompt, go to the folder where you unzipped Gunbot.


2. Run the following command: npm install
3. Start the WebGUI with this command: node app.js
4. Connect to your WebGUI by opening http://127.0.0.1:3000/listener/

When you have trouble connecting to the WebGUI, make sure that your local firewall accepts
incoming and outgoing traffic on port 3000.

If you have set an external IP or hostname in the config file, and are seeing empty values or
?? in the WebGUI, then visit https://your_webUI_io_or_hostname:5000 and add the browser
exception to the security alert you will be notified about. Then retry connecting to the WebGUI.

2. Setting up the configuration file


All Gunbot settings are done in a single file names config.js. This is where you set up your
exchange API keys, add pairs and define your strategies. When the config file is overwritten
while Gunbot is running, the changed settings will be loaded automatically. In the next sections
all parameters are explained.

Make sure that no parameters are removed when setting it up. Make sure the JSON-Formatting
stays intact. Test for syntax errors on jsonlint.com (remove API key before testing).

Client settings
These settings are used to setup the port number and hostname to be used for the WebGUI.

"port": 3000,
You can change the port for the WebGUI here.

"hostname": "127.0.0.1"
The IP address or hostname to be used for the WebGUI. Defaults to your localhost. An external
IP can also be set.

WebSockets settings (ws)


These settings are used to setup the port number and hostname for WebSockets.

"port": 3000,
You can change the port for WebSockets here.

"hostname": "127.0.0.1"
The IP address or hostname to be used for WebSockets. Defaults to your localhost. An external
IP can also be set.

Bot settings
"debug": false,
Values: true or false
Used to show debug messages in the bot, when set to true.

"period_storage_ticker": 2000,
Values: numerical - represent a number
This parameter defines how many of the received prices from the exchange are being kept in
the array for calculating other indicators. It is critical that you dont set this value too low,
otherwise you dont have enough values for functions like the trend watcher or local EMA
calculation.
A new price gets added to this array every time the tickers are updated, or every time a new
cycle starts faster than the set time for "interval_ticker_update" the latter only happens if you
run very little pairs in your bot.

"interval_ticker_update": 25000,
Values: numerical represents time in milliseconds
This parameter defines after how many milliseconds new prices are being pulled from the
exchange for each pair (default value of 25000 = 25 seconds).
This value is related to "period_storage_ticker, since it defines how often new prices are being
added to the array.

"timeout_buy": 60000,
Values: numerical represent time in milliseconds
This is an internal timeout that prevents the bot from buying again within the set amount of
milliseconds after a buy order has been placed.

"timeout_sell": 60000,
Values: numerical represent time in milliseconds
This is an internal timeout that prevents the bot from selling again within the set amount of
milliseconds after a sell order has been placed.
"WATCH_MODE": false,
Values: true or false
When set to true, Gunbot will process the configured pairs, but will not place actual buy or sell
orders. Good for testing.

"VERBOSE": true,
Values: true or false
Setting this to true will lead to more detailed information being shown in the console.

"BOT_DELAY": 1
Values: numerical represents a multiplier value used in the formula to delay the bot
Bot delay processing a new pair for a random amount of milliseconds. Useful for when Poloniex
complains about sending to many requests.
Formula: random value between 200 an 400 ms * BOT_DELAY

Tradingview settings
these are only relevant if youve bought the Tradingview plugin, otherwise just leave it on the
default values

"TV_GAIN": 0.6,
Values: numerical represent a percentage
Set a minimum gain in % that trades initiated by Tradingview must comply to. When sell orders
are being placed by Tradingview that would have a lower gain than this value, Gunbot will not
place the order. Use this to prevent selling at loss.

"TV_TRADING_LIMIT": 0.001,
Values: numerical represent an amount in primary trading currency.
This value defines the trading limit for orders placed through Tradingview The default value of
0.001 would place maximum orders of 0.001 BTC when used on a BTC_x pair.

"TV_TRADING_LIMIT_BUY": 0.001,
Values: numerical represent an amount in primary trading currency.
This value defines the trading limit for limit buy orders placed through Tradingview The default
value of 0.001 would place maximum orders of 0.001 BTC when used on a BTC_x pair.

"TV_PYRAMID": false,
Values: true or false
Setting this value to true enables the use of pyramid contracts through Tradingview.
This might possibly trigger a large amount of trades. Be sure to have checked your strategy and
balances before trying this.

"TV_TRADING_LIMIT_SELL": 0.001,
Values: numerical represent an amount in primary trading currency.
This value defines the trading limit for limit sell orders placed through Tradingview The default
value of 0.001 would place maximum orders of 0.001 BTC when used on a BTC_x pair.

"TV_PROTECTION": true,
Values: true or false
When set to true Gunbot will check there is an overall profit before selling, as specified in TV_GAIN.
When set to false, Gunbot will execute all TradingView without interfering with a custom strategy.

"RETRY_TV_ORDER": false,
Values: true or false
This parameter can be used to prevent consecutive orders being placed when orders are not
successful. Set this to false to disable looping of orders.

Imap listener settings (for Tradingview plugin)


"enabled": false,
Set this to true to enable the Tradingview plugin. You need to acquire a licence for this.

"authorized_froms": "[\"noreply@tradingview.com\"]",
Set the Tradingview sender email address that you want to use.

"user": "YOUR_EMAIL_HERE",
Set your own email address here. This address listens for mails from Tradingview.

"password": "YOUR_PASSWORD_HERE",
Input the password for your own email address.

"host": "imap.gmail.com",
The address of the IMAP server that the plugin needs to connect to.

"port": 993,
The port number for the IMAP server

"tls": true,
Defines if TLS encryption is used for the IMAP connection.

Exchanges
In this section you insert your API key and secret for the exchanges you want to trade on.
You dont need to remove the exchanges you do not want to trade on.

Pairs
In the pairs sections you can configure which pairs to use, on which exchange, which strategy
should be used, optional overrides are possible.

The notation scheme for pairs is slightly different for each exchange. Configuring a pair trading
BTC (primary) for LTC would look like this for each exchange:

Poloniex: BTC_LTC
Bittrex: BTC-LTC
Kraken: BTCLTC
Cryptopia: LTC_BTC

Configuring a pair to use bb as strategy, and override the DOUBLE_UP value set in the bb
strategy would look like this:

"BTC_DASH": { "strategy": "bb", "override": {"DOUBLE_UP": true}}

Strategies
Gunbot has four different strategies that can be used to trade. These can be freely combined,
where one strategy is being used for buying, and another for selling.

Settings for strategies are global, and apply to all pairs that you set to run on this strategy.
When you need to make changes in the strategy settings for individual pairs, you can configure
this using overrides in the pair setup (more on this below).

Strategies use a generic set of parameters, which are the same for each strategy. Only the
relevant parameters are being used to process the strategy.

1. Bollinger bands (bb)


You can configure at which percentage from the lower Bollinger bands Gunbot should
buy, and at which percentage from the higher Bollinger band a sell order should be
placed.

The formula for the Bollinger bands is:

Middle Band = SMAPERIOD simple moving average (SMA)

Upper Band = Middle Band + (SMAPERIOD standard deviation of price x STDV)

Lower Band = Middle Band - (SMAPERIOD standard deviation of price x STDV)

2. Gain
Set Gunbot to buy when the price reaches a fixed percentage below EMA, and sell when
the price is x percent higher than the price it bought for.
3. Stepgain
Stepgain is similar to gain, but here you set a minimum buy level below EMA and a
second, lower buy level. Gunbot will buy when the price stops dropping after reaching
the first buy level, or when it reaches the second. With selling, you define a minimum
gain in percentage compared to the bought price, and a second sell level at which youd
definitely want to sell. A sell order will be placed when the first level is reached and the
price no longer increases, or when the second level is reached.

4. Pingpong (pp)
This strategy can be used for pairs that move up and down between a predictable price
range for longer periods. You set fixed prices at which Gunbot should buy and sell.

Combining strategies
Each combination of strategies has its own section in the config file. If you want to use a
combination of settings, pick the right one and proceed to configure the relevant parameters.

The following combinations can be used, each has its own section in the config file:

bb pure bollinger bands


gain pure gain
pp pure pingpong
stepgain pure stepgain
bbgain buy using Bollinger bands, sell with gain
gainbb buy with gain, sell with stepgain
bbstepgain - buy using Bollinger bands, sell with gain
stepgainbb buy using stepgain, sell using Bollinger bands
bbpp - buy using Bollinger bands, sell with pingpong
ppbb buy with pingpong, sell with Bollinger bands
gainstepgain buy with gain, sell with stepgain
stepgaingain - buy with stepgain, sell with gain
gainpp buy with gain, sell with pp
ppgain buy with pingpong, sell with gain
stepgainpp buy with stepgain, sell with pp
ppstepgain buy with pingpong, sell with stepgain

Strategy settings
"TRADING_LIMIT": 0.001,
Values: numerical represent an amount in primary trading currency.
This value defines the trading limit for limit buy orders placed by Gunbot. The default value of
0.001 would place maximum orders of 0.001 BTC when used on a BTC_x pair.

"PERIOD": 5,
Values: 1 / 5 / 15 / 30 / 60 represents candle stick size in minutes
Defines the candle stick size used for EMA and BB calculation. Check the charts on your
exchange to check which sizes are supported.
"BUY_LEVEL": 0.1,
Values: numerical represent a percentage
This setting can be used as protection against buying above EMA. The default value of 0.1%
will prevent the bot from buying when the price is not at least >0.1 % under the lowest EMA.

"GAIN": 0.6,
Values: numerical represents a percentage
Relevant: only when gain is used as selling strategy
This sets the target for selling with Gain as selling strategy. The bot will sell when the set
percentage above last buying price is reached.

"EMA1": 24,
Values: numerical represents an amount of candle sticks
Set this to the amount of candle sticks you want to use for your long EMA calculation. The
closing price
for each candle is used in the EMA calculation.
For example: when you set PERIOD to 5, and want to have 2h for long EMA you need to set
EMA1 to 24 (24 * 5 mins).

"EMA1": 12,
Values: numerical represents an amount of candle sticks
Set this to the amount of candle sticks you want to use for your short EMA calculation. The
closing price
for each candle is used in the EMA calculation.
For example: when you set PERIOD to 5, and want to have 1h for short EMA you need to set
EMA2 to 12 (12 * 5 mins).

"HIGH_BB": 40,
Values: numerical represents a percentage
Relevant: when gain is used as selling strategy & when DOUBLE_UP is activated.
This sets the target for selling with bb as selling strategy. The bot will sell when the price hits a
point 40% from HIGH_BB.

"LOW_BB": 40,
Values: numerical represents a percentage
Relevant: only when bb is used as buying strategy
This sets the target for buying with bb as buying strategy. The bot will buy when the price hits a
point 40% from LOW_BB.

"STDV": 2,
Values: numerical (recommended: between 1.9 and 2.1) represents a multiplier value used in
the bollinger bands calculation.
Relevant: when using bb as buying or selling strategy & when DOUBLE_UP is activated.
This value defines the multiplier used for calculation of the lower and upper bollinger bands.

"SMAPERIOD": 20,
Values: numerical represents a number of candle sticks
This parameter defines the amount of periods to be used for the simple moving average
calculation. Set this value to the value used to chart on the exchange. If you want to use SMA
20 on the exchange charts, set this value to 20.
"BUYLVL1": 0.6,
Values: numerical represents a percentage
Relevant: only when stepgain is used as buying strategy
This sets the level 1 target for buying with stepgain as buying strategy.

"BUYLVL2": 2,
Values: numerical represents a percentage
Relevant: only when stepgain is used as buying strategy
This sets the level 2 target for buying with stepgain as buying strategy.

"BUYLVL3": 70,
Values: numerical represents a percentage
Relevant: only when stepgain is used as buying strategy
This sets the level 3 target for buying with stepgain as buying strategy.

"SELLLVL1": 0.6,
Values: numerical represents a percentage
Relevant: only when stepgain is used as selling strategy
This sets the level 1 target for selling with stepgain as selling strategy.

"SELLLVL2": 2,
Values: numerical represents a percentage
Relevant: only when stepgain is used as selling strategy
This sets the level 2 target for selling with stepgain as selling strategy.

"SELLLVL3": 70,
Values: numerical represents a percentage
Relevant: only when stepgain is used as selling strategy
This sets the level 3 target for selling with stepgain as selling strategy.

"BUYLVL": 2,
Values: 1 / 2 / 3 represents steps
Relevant: only when stepgain is used as buying strategy
This sets which step should be considered when using stepgain as buying strategy.
1: Buy when price drops below BUYLVL1 and stops dropping or hits BUYLVL2
2: Buy when price drops below BUYLVL2 and stops dropping or hits BUYLVL3
3: Buy when price hits BUYLVL3

"SELLLVL": 2,
Values: 1 / 2 / 3 represents steps
Relevant: only when stepgain is used as selling strategy
This sets which step should be considered when using stepgain as selling strategy.
1: Buy when price rises above SELLLVL1 and stops rising or hits SELLLVL2
2: Buy when price rises above SELLLVL2 and stops rising or hits SELLLVL3
3: Buy when price hits SELLLVL3

"LASTPOINTS": 5,
Values: numerical represents a number prices from the array
Relevant: only when stepgain is used as buying or selling strategy
This sets how many of the latest collected prices should be used as averaged value for
LASTPOINTS in the trend watcher calculation.

"AVGPOINTS": 250,
Values: numerical represents a number prices from the array
Relevant: only when stepgain is used as buying or selling strategy
This sets how many of the latest collected prices should be used as averaged value for
AVGPOINTS in the trend watcher calculation.

Uptrend: LASTPOINTS / AVGPOINTS = >1


Downtrend: LASTPOINTS / AVGPOINTS = <1

"AVGMINIMUM": 0.00000001,
Values: numerical represents a price
Relevant: only when stepgain is used as buying or selling strategy
This defines the minimum price level to consider in AVGPOINTS.

"GUNTHY_API": false,
Values: true or false
You can use the GUNTHY_API to get BB and EMA from a Gunbot server. Only set this to true if
you set 15 minute candles on Bittrex, or any candle stick size on Cryptopia.

"PP_BUY": 0.00000001,
Values: numerical represents a price
Relevant: only pp Is used as buying strategy
Set the excact price you want Gunbot buying for when using pp as buying strategy.

"PP_SELL": 0.12345678,
Values: numerical represents a price
Relevant: only pp Is used as selling strategy
Set the excact price you want Gunbot buying for when using pp as selling strategy.

"PANIC_SELL": false,
Values: true or false
When set to true, all coins will be sold at market value. This can incur losses!

"DOUBLE_UP": false,
Values: true or false
When set to true, DOUBLE_UP will try to get rid of bags by averaging down. Works on all
strategies.
No limit is set for buy orders placed when averaging down, make sure you have enough of your
primary currency available. Gunbot will start averaging down a bag when the higher Bollinger
band value drops below the last bought price.

"STOP_LIMIT": 60,
Values: numerical represents a percentage
Sets a stop limit to sell a coin at a calculated loss. Setting a stop limit at 60 would cause that all
balance for a coin is being sold when the current price is >60% lower than bought price. After a
stop limit sell order has been placed, no further buy orders will be placed until the price reaches
a point again that is above the level of that of the sell order, thus preventing a negative spiral
where a rebuy would occur soon after hitting stop limit, because the price keeps dropping.

"BUY_ENABLED": true,
Values: true or false
Set this to false to prevent Gunbot from placing buy orders.

"MIN_VOLUME_TO_BUY": 0.0001,
Values: numerical represents the total value of a coins holdings in primary currency
Sets a threshold for buying orders. If you own less than the set amount, buy orders will still be
placed. This prevents owning very small quantities (dust) blocking buy orders.

"MIN_VOLUME_TO_SELL": 0.0001
Values: numerical represents the total value of a coins holdings in primary currency
Sets a threshold for selling orders. If you own less than the set amount, sell orders will not be
placed and the bot goes into buying mode again.