Know Your Limits

Know your limits

Configuring Gunbot can be an art, and it can be a science.  One of the most basic configuration elements is setting the proper limits to tell Gunbot how much to trade.  This article explains those basics and then some tips on how to avoid mistakes.

Know your limits

What’s Going On

Gunbot needs to be told what to do.  It needs to know what pairs you want to run, what strategies to run on those pairs, what Telegram account to notify of massive profits, and so much more.

One of the most fundamental pieces of information Gunbot needs to know is your budget.  Some people trade with very low amounts… skirting with the minimum order size that the Exchange will allow, and others trade with amounts that would make most people’s head spin.

In order to tell Gunbot your budget, you don’t tell it the total amount you have to play with, nor will it assume all the crypto you have in your account is fair game and auto-budget itself. It must be told how big each trade should be, and needs to know how to tell if an amount is too small to care about.  These small amounts, also called “dust”, might prevent Gunbot from trading if it’s not told to ignore them.

Limits Explained

Like with any configuration element, your first trip to learn about it should be the official Gunbot wiki.  That’s where the latest intel resides about variables, default settings, strategies and what’s latest in the most recent version.

Let’s see what the wiki has to say about these limits (the wiki, like Gunbot, has evolved over time):

ParameterDefault valueDescription
TRADING_LIMITStrategy dependentValues: numerical – represent an amount in base currency.

 

This value defines the trading limit for each buy order. Make sure to always set this higher than MIN_VOLUME_TO_BUY & MIN_VOLUME_TO_SELL.

When you set this to 0.1 and trade BTC-x pairs, Gunbot will place a buy order worth 0.1 BTC each time it buys. When trading a fiat pair like USDT-x, set a whole number like 100 as TRADING_LIMIT.

GBU NOTE: On Gunbot version 10 and earlier, only use whole numbers for fiat pairs.

MIN_VOLUME_TO_BUYStrategy dependentValues: numerical – represents the total value of a coins holdings in base currency.

 

Sets a threshold for buy orders. Prevents orders from being placed when TRADING_LIMIT is lower than this value. Set this at least to the minimum trade size of your exchange. When trading a fiat pair like USDT-x, set a whole number like 10 as MIN_VOLUME_TO_BUY.

GBU NOTE: On Gunbot version 10 and earlier, only use whole numbers for fiat pairs.

MIN_VOLUME_TO_SELLStrategy dependentValues: numerical – represents the total value of a coins holdings in base currency.

 

Sets a threshold for sell orders lower than the exchange minimum trade size. If you own less than the set amount, sell orders will not be placed and Gunbot goes into buying mode. Set this at least to the minimum trade size of your exchange.When trading a fiat pair like USDT-x, set a whole number like 10 as MIN_VOLUME_TO_SELL.

When you hold 0.006 (in base currency) of a coin and have set MIN_VOLUME_TO_SELL to 0.01, Gunbot will not try to sell your current 0.006 balance because it is below the set threshold of 0.01, instead it will place another buy order first as soon as buying are met.

GBU NOTE: On Gunbot version 10 and earlier, only use whole numbers for fiat pairs.

What does this mean?

So, the first thing we learn is that TRADING_LIMIT does not represent your entire budget – it’s the amount Gunbot will trade per pair.  This is important, because every new pair you add to a Gunbot instance can possibly spend at least TRADING_LIMIT amount of your funding currency.

Use funding currency terms

Speaking of funding currency, that’s the second thing we need to know about TRADING_LIMIT  The amount you put as this value needs to be expressed in the same coin as you are using as the funding currency.  In Gunbot, this is the first coin of the pair.  For example, if the pair you run is BTC-OMG , then “BTC” is the Funding Currency (aka “base”) and OMG is the coin you want to buy (aka “quote”).  If your pair is ETH-LTC then Ethereum is your base and LiteCoin is your quote.  In Gunbot’s terms, the base comes first and quote comes second.

Note: As of Gunbot v7, all pairs are denoted in “BASE-QUOTE” format with a dash in the middle, regardless of how the Exchange expresses or denotes the format.  For example, Cryptopia might say “ETH/BTC” with a slash, or Kraken might put it backwards and use “XLTCXXBT” with an extra “X” in front of each asset, but only some, but Gunbot’s notation would be ETH-BTC for the Cryptopia example and BTC-LTC for the Kraken example.

So, put the TRADING_LIMIT in the same terms of the base.  If you run BTC-xxx pairs, then you should put the limit in as a Bitcoin amount.  ETH-xxx pairs need Ethereum values as the limit.

FIAT is “special”

There’s a special case for FIAT pairs (USD, EUR, USDT, TUSD, etc) where not only do you need to put the amounts in FIAT terms (100 for $100, for example instead of 0.001 BTC for a $10k bitcoin value), but in versions 10 and earlier, you also need to not use any decimals.  WHOLE NUMBERS ONLY (this is reported to be “fixed” in later versions, although I have not tested it).

Good:

TRADING_LIMIT: 120

Bad:

TRADING_LIMIT: 120.50

TRADING_LIMIT: 0.001

This goes for all “currency value” settings: TRADING_LIMIT, MIN_VOLUME_TO_BUY, MIN_VOLUME_TO_SELL, and FUNDS_RESERVE.   It also applies to Ping Pong Strategy variables PP_BUY and PP_SELL.

The reason you want to not use decimals in FIAT is that — if there are decimals present, the most likely reason is that you didn’t change it from defaults, and you’re probably using minuscule amounts like 0.002.  You do not want this.

MVTB and MVTS – what are they?

The other two main configuration elements regarding actual money values are MIN_VOLUME_TO_BUY (MVTB) and MIN_VOLUME_TO_SELL (MVTS).  These help Gunbot understand when to buy and when to sell.

Dust explained

“Dust” is a term crypto traders use to describe very small amounts of crypto in an account.   Just like when you use a saw to cut some wood, the action of sawing not only gives the intended result (wood that is cut), but it also produces material as a side effect of performing the sawing — namely, dust.

Dust is important to understand, because you can accumulate dust in many ways in the crypto world.

For one, if you have, say 10.05634 EOS coins in your account, and you are only able to sell 10 of them, you will have 0.05634 EOS left in your account.  This might happen because your sell order couldn’t be matched up to an exact sell order that filled all 10.  Maybe your order was matched up to two buy orders – one for 6 EOS and one for 4 EOS.  Then when it came to try and get rid of the remaining amount, the order would be too small for the exchange to honor.

Another way you might get dust is from small micro-deposits, such as from Binance’s referral program.  Binance gives fee commissions for anyone you refer. It started off at 50% and is currently 20%.  So when someone you refer makes a trade, they have to pay a fee on that trade.  You get 20% of that fee.  The fee is already small – usually 0.1% if no BNB is used and 0.05% if BNB is used.   Therefore you’d be getting 0.02% or 0.01% of their trade, which is almost guaranteed to be a minuscule amount.  This becomes dust in your account.

Binance has since updated their referral program to allow double commissions if you own 500 BNB tokens in your account.  Please see those program specifics for most updated rules and conditions.

MIN_VOLUME_TO_BUY (MVTB)

This setting allows Gunbot to avoid dust.  Normally, dust clogs up Gunbot and prevents it from trading.  Basically, it won’t initiate a trade if you already own some value of the coin.  However, since “dust” needs to be ignored, Gunbot needs to know what you consider “dust” vs “substantial enough to notice”.

Once you have at least MVTB amount of coins in your account, Gunbot goes into sell mode.  If you have less than MVTB coins, Gunbot is in buy mode.

MIN_VOLUME_TO_SELL (MVTS)

After reading the wiki entry for MVTS, you might think it’s basically the same as MVTB, since it says “threshold for sell orders”.

However, there’s a difference between when Gunbot should be in a Buying mood (crypto amount is less than MVTB) and when Gunbot should be allowed to sell (crypto amount is more than MVTS).

There’s also a difference between Gunbot being in a selling mood and Gunbot being allowed to sell.

How to Set Appropriate Limits

Now that we’ve reviewed a ton of detail on each of the settings, you might just be asking “ENOUGH ALREADY!  WHAT DO I PUT HERE?!?!?!”

Here are some tips on how to set the right amount:

Rule #1: MVTB should be less than or equal to TRADING_LIMIT.

Rule #2: MVTB and MVTS should be greater than or equal to the Exchange’s Minimum Order Size.

If you set this too low, then Gunbot will attempt to make orders, but the Exchange will kick them back.  It’s not like Gunbot is going to auto-increase the values for you – it is your money after all.

Rule #3: It’s ok and common for MVTB and MVTS to be the same

You can set MVTS higher, but be careful that you don’t make Gunbot stop selling while it’s unable to buy.  Most commonly, these two values will be the same amount.

Rule #4: It is highly recommended that TRADING_LIMIT be higher than MVTB  to avoid the “Double Buy Exploit“.  Target would be 3x to 4x, but it’s usually enough to make it 1.5 to 2x.

Many people, and the defaults in previous versions of Gunbot helped with this, use the same amount for `TRADING_LIMIT` and `MVTB`.  However, if you do this, then you are subject to experiencing the “Double Buy Exploit”.  It’s not an actual exploit from a security perspective, and it’s not a bug in any way.  It’s just a consequence of Gunbot doing exactly what you told it to do.

Rule #5: If you’re too Greedy, you’ll suffer in bear markets

Many beginner crypto traders, and especially Gunbotters, look to their right and see someone who has tripled their money with amazing trades.  They look to their left and see another person who’s made 10X gains and brags about the constant profits.

So, naturally, they think that’s what crypto is, so they set Gunbot running and give all their BTC to Gunbot.  It might work for a little while, but eventually the bear cycle comes around and BAGS happen.  And because they were greedy and gave all their BTC to Gunbot, Gunbot did exactly what it was told to do, and pretty soon, all the BTC is gone and all the trader has is a bunch of heavy bags that have lost value.  Instead of blaming themselves and their greedy nature, or their rush to use a tool they didn’t understand, or their tendency to believe those people who claimed 10x gains and didn’t disclose the losses (who brags about the realities?), they blame Gunbot.

We at GBU recommend you use much less than all your BTC when botting.  First, you need room to handle your bags.  Bags happen to everyone and there is no magic formula to eliminate all of them fast, cheap, and cleanly.  You should always keep dry powder, and use much less budget than you think.

When I started off, I used the lowest amount both I and the exchange could stand, and only ran enough pairs that I used 10-20% of my available BTC.  This gave me enough room to learn Gunbot’s settings, to make sure I didn’t make wild mistakes, and when the bear market came, I had plenty of BTC to move to other pairs, use Double Up or move my bags off to another wallet.

With the above guidelines, you should be good to start with what is good for your risk profile, your preferences and your specific situation.

Double Buy Exploit

Example: let’s say you run BTC-ETH pair and have 0.002 set for both TRADING_LIMIT and MVTB.  This means when you have less than 0.002 BTC worth of ETH in your account, Gunbot feels like buying.

Then, ETH becomes tasty and Gunbot buys some.  It buys 0.002 worth and it’s now in your account.

Well, Gunbot usually buys on a downtrend, if it’s configured like most people want.  If ETH value continues to drop after Gunbot purchases it, then you will have, say 0.00195 BTC worth of ETH in your account.

If this value stays there for the next cycle, and Gunbot has a low TRADES_TIMEOUT and isn’t using the safety switch, then, per the rules you have configured, 0.00195 BTC worth of ETH is now considered “dust”.  It’s free to buy again!  If the conditions are still ripe for buying, Gunbot will then purchase another TRADING_LIMIT amount of ETH (0.002) and it will be added to the wallet.

Now you have 0.00395 BTC worth and that amount is greater than MVTB, so it won’t buy again.

This shows up as a “double buy” in your trading history, because it will show two purchases of 0.002 close together. You might think Gunbot is double-buying by mistake, but it’s doing what you told it to do.

Exchange Minimum Order Size

At time of writing, here are the different Gunbot-supported Exchange minimums:

ExchangeMinimum
(BTC)
Notes
Binance0.001Binance used to be 0.001, then changed to 0.002 and is now back to 0.001.  It also has additional minimum requirements more than just order size, such as minimum number of coins. Also, many coins must be purchased in whole numbers and not fractions (this doesn’t impact TRADING_LIMIT, however – Gunbot will automatically round the order to a whole number when needed). Binance also publishes their Trading Rules online.
Bittrex0.001Bittrex used to have a 0.0005 limit and then issued an announcement in November 2017 where they said the new limit is 0.001.  However, we’ve seen that we can still place orders for 0.0005 for many coins, if not all of them. Maybe Bittrex is slow in implementing and enforcing the rules, but GBU recommends following the published guidelines.
Poloniex0.0001Polo’s minimum is the same for all the funding currencies – BTC, ETH, XMR and USDT.
Kraken0.002Kraken’s minimum orders vary by currency – 0.002 is the BTC minimum.  You can view all the details on Kraken’s article about the topic.
Cryptopia0.0005This is from experience and forum posts vs an official post by the company.  It used to be 0.0001.
Bitfinex<varies>The official Bitfinex post about exchange minimum order size states:  “The minimum order sizes for each trading pair is periodically adjusted to maintain order sizes that are reasonably proportioned to their values. The ultimate goal is to keep the minimum order size between 10-25 USD equivalent value while limiting the changes to the minimum order sizes to useful incremental values.
CEX.io<varies>
0.002
According to CEX.IO’s guidance posted on their website, they say:
“Trading on CEX.IO is flexible in terms of order placement, however, there are certain limitations.You can always check them by typing in https://cex.io/api/currency_limits into your address line.”BTC is listed at 0.002.  Other currencies have their respective limits.
GDAX 0.001 GDAX publishes their minimums for trading, withdrawals and deposits on their support site.

Summary:

  1. Make MIN_VOLUME_TO_BUY and MIN_VOLUME_TO_SELL at least as big as the Exchange’s minimum order size.
  2. Make TRADING_LIMIT higher than MIN_VOLUME_TO_BUY.
  3. Make TRADING_LIMIT  as low as you and the exchange can stand while you learn how to configure Gunbot and learn the market cycles.
  4. (Gunbot 10 and lower) When using FIAT pairs, use whole numbers only (no decimals).

How to change port of Gunbot’s GUI for better security

As of Gunbot v8.0.3, Gunbot’s GUI (gunthy-gui) defaults to port 5000 and for security reasons, you might want to change it. (the default for

What’s Going On

Gunbot v8 and later (XT, CS and RT) can run in two modes – by itself on the command-line (aka “Gunbot Core”) or with a GUI (aka “Gunbot GUI”).

Gunbot v8, v9: Gunbot itself is the “gunthy” executable (named either gunthy.exe, gunthy-linx64, gunthy-macos, or gunthy-arm) and is what runs in both modes.  The GUI is optional.  The GUI (named gunthy-gui) presents a friendly interface for configuration, control and surface-level monitoring, and then runs the gunthy executable for you.

Gunbot v10 and later: Gunbot executable is just one file, and based on your configuration file (config.js), it will either run in “Gunbot Core” mode or “Gunbot GUI” mode.  This is in the “GUI” section of the config file.

“enabled”: [true | false]
“start”: [true | false]
“port”: 5000

In Gunbot v10 and up, if “enabled” is true, then the GUI will run on the “port” specified.  “start” indicates whether or not Gunbot Core should automatically start when Gunbot runs.

Both gunthy and gunthy-gui use what’s known as a network port to communicate with itself or other components.  For Gunbot, this is configured in the “ws” section of the config.js file and contains “port” and “clientport” settings. For the GUI, this is an HTTP port (not configurable from the config.js file in Gunbot versions before v10) and is part of the URL you can use to access the GUI, both locally on the box and from an external system.

Default port

The default port that Gunbot GUI runs on is 5000.  This means you would access “http://localhost:5000” when you’re actually accessing the system that runs Gunbot directly, or “http://<ip address>:5000” when accessing the system remotely.  If you have a DNS server or hosts file, you can configure those to point a user-friendly name to the IP address, such as myvpsisawesome.gunbotuniversity.com.  If you do that, you would still add the “:5000” at the end so the full URL is http://myvpsisawesome.gunbotuniversity.com:5000.  Without the “:5000” at the end, then your browser tries to connect to port 80 (http) or port 443 (https) and this won’t work.

Why Security is Important to Some

If you leave the Gunbot GUI settings at default and use the default port of 5000, then you run the risk of being too-easily discovered by remote systems.  Once it’s known that the default port is 5000 for Gunbot, there are hackers, crawlers and systems such as http://shodan.io that can collect data and tell others that you’re running Gunbot.  Shodan even has a gunbot query already set up so that you can search for Gunbots on the network.

I don’t know about you, but I’d rather my Gunbot GUI not be so easily found.  It won’t be long before we hear of some Gunbotter whose system was hacked, DDOS’ed or otherwise compromised and losses occur.

The first step in making your Gunbot more secure is to change from the default port.  There are other steps you can take, such as using a VPN to access your GUI, limiting the IP addresses that can talk to your server, on these ports, and adding SSL certificates (Gunbot v8, v9 require a reverse proxy; Gunbot v10 and up can have SSL natively supported if you have a certificate).  Those steps are not covered in this guide.

How to Fix

Change your port number

How to change your port number is different with various Gunbot versions.  You want to pick a port number that makes sense and will work:

  1. Well known ports are ports 0 – 1023. You should not pick these ports unless you know what you’re doing and have taken appropriate security precautions.
  2. Registered ports are 1024 – 49151.  It’s ok to pick a port in this range, as long as you don’t pick a port that conflicts with something else running on your machine.  You may or may not want to use common registered ports that systems frequently search for, like 8000, 8080
  3. Make sure you do not pick the same port that’s listed in config file under ws:port.  or clientport.  Generally, this means avoiding 5001 and 3000.
  4. Dynamic / private ports are those from 49152 to 65535.

Gunbot v10 and later:

In the `config.js` file, Change the “GUI”: port parameter from something other than port 5000.

"GUI": {
   "enabled": true,
   "start": false,
   "port": 5000, <--- change this

For example, if you change it to 5158, then you would access Gunbot GUI at http://<your IP address>:5158

Gunbot v8, v9:

In order to change the default port that gunthy-gui uses, you need to set an “environment variable” called PORT to the port number you want the GUI to use.  Depending on what operating system you use, how you change this varies.

For Windows users, you set the port before you run the command:

set PORT=5003
gunthy-gui.exe

This should now make the GUI respond to URL with :5003 at the end instead of :5000.

You can also make a batch file to launch Gunbot GUI:

@echo off
set PORT=5003
start /d gunthy-gui.exe

For Linux/MAC/ARM users, you can do it all on one line.  From the directory gunbot is installed, running the following will launch the GUI and use port 5003:

env PORT=5003 ./gunthy-gui

If you use pm2, you can do the same thing on one line:

env PORT=5003 pm2 start ./gunthy-gui --name binance

Then use your normal pm2 list all and pm2 info binance and other commands to manage the gunthy-gui process.

Websocket port

It’s important to note that the PORT that the GUI uses to speak HTTP is not the “clientport” in the config file.

"ws": {
"port": 5001,
"clientport": 3000,
"hostname": "127.0.0.1"
},

In Gunbot v8, websockets were important and it impacted how clients talked with graphs and such on the GUI.  This is less so in later versions and supposedly websockets are not used at all.  However, both of these ports *are* used.

This 5001 port here can be changed as well, but it needs to NOT conflict with any other port being used on the system.  You cannot use the same port for ws:port and PORT=xxxx.  They must be different ports.

Multiple instances on same device

Most of the time, you don’t need to change ws: port setting.  However, if you run multiple Gunbot instances on the same machine manually, then each port needs to be unique.

For example, the first time you install Gunbot on a machine, it can run with port:5000 for the GUI and port:5001 for ws:port.  If you put a second Gunbot instance in another folder and want to run it, you need to change ws:port from 5001 to something else, like 5003.  If you also wanted a second GUI running, you would use the changes described earlier, and maybe use 5002 for that.

Also, if you are accessing your Gunbot GUI from a remote system, you will want to change the hostname setting inside of ws to be the IP address or FQDN (fully-qualified domain name) of the machine running Gunbot GUI.  For example, if you’re using a VPS, you would put in the IP of the VPS. Otherwise, in Gunbot 8.0.3 and earlier, the GUI will be slow and open up a lot of websocket connections to a box that won’t respond (again, this was much more the case in Gunbot v8 than later versions, but I still highly recommend changing hostname anyway)

For example:

"ws": {
"port": 5021,
"clientport": 3000,
"hostname": "4.2.2.1"
},

Or

"ws": {
"port": 5021,
"clientport": 3000,
"hostname": "myawesomegunbot.gunbotuniversity.com"
},

Gunbot version 9 no longer uses websockets and doesn’t officially require the hostname update, although GBU still recommends the change.

Note: in previous versions, running multiple GUIs, even when changing the port, didn’t work well for me.  I haven’t tested it in version 8.  Instead, I just spin a new VPS for another instance so that I’m not subject to any IP address problems, resource constraints, or interoperability issues.  As of version 10, there aren’t any known issues with this.

Summary:

  1. If you keep default settings for things like what port the GUI listens to, you increase your risks.
  2. It’s fairly trivial to change the GUI port so you’re not so easily found.
  3. While the instructions differ for older versions, the port can be configured in the config.js file under the GUI: port setting.