My account

Getting up and running is quick and easy and we are here to guide you through the process.

Of course, you need an account at one of the exchanges we support. Then you can simply choose a plan, create an API key pair on your exchange account and submit just half of one part of the pair to us (see "Getting Started" tutorial).

Once you have submitted your API key info, you need to download margin, choose the exchange you want to trade on and then input your full API key and secret to login.

Don’t worry, we connect directly to the exchange and the only communication with our web server is to make sure you are a paid up customer and to download the historical data.

The most likely reason for this is that you haven’t registered your half secret with us (see here: “How do I set up my API keys?”) or that you registered your key instead of your secret. You should also make sure that you submitted the first half of your secret and not some other part.

Please also check if you are entering the full API key and the full secret at the login window as this is needed to authenticate at the exchange.

If you continue to get a “key not registered” error message, please contact [email protected] or click the intercom chat bubble and ask for help!

It is important you setup a new API key/secret pair for leonArdo. On most exchanges you can do this by going to the settings/security sections of their websites. Then you need to create a new API key/secret pair.
Let’s take a look at an example on Bittrex. After clicking the ‘Add New Key’ button and entering my 2FA code a new key is generated.

You should immediately save your secret as on many exchanges it is only shown once. We only need at least the first half of your secret so in this example the following would be enough

3a2aee8966474b59a1

This needs to be added to your margin account here: Manage exchanges
Note that all options, except for withdrawal rights, should be checked.

To login at the exchange later please save the full key and the full secret.

On each exchange the procedure is basically the same, but don’t hesitate to get in touch with us if you need any assistance!

No problem! Just log into your account and go to the Manage Exchanges section. There you can delete the current API half secret you have registered with us and add a new one. Note that only 1 API half secret per exchange is allowed unless you are a Professional customer, in which case you can add up to 3 APIs per exchange.

We have no access to your funds! We only store one quarter (in hashed form) of a two part API key pair on our servers to ensure you are a paid up customer. Even in the very unlikely event that a hacker compromised our servers there is nothing they could do with that. As an extra precaution we also advise that you do not enable withdrawal permissions on your API key pair.

Software setup

We recommend at least 4GB RAM and a HD display for Windows, macOS and Linux systems. It is possible to run margin on lower spec machines (2GB RAM with a 720p display) but this will restrict the number of pairs/bots that can be reasonably run.

Did you have to get past a reCAPTCHA? If you did, then right now leonArdo does not handle this. The exchange has put up an extra barrier to connecting to its API in your country/region. One way to get around it is to connect through a VPN/VPS.

Please get in touch with us if you continue to have issues by mailing: [email protected]

Yes you can and we recommend it! You can use Microsoft Remote Desktop to connect to your VPS or VPN instance (there are even iOS and Android apps) and check in on how margin is trading for you from your PC, phone or tablet. And what’s more, you won’t need to leave your laptop running 24/7.

A few things to remember.

1) Do not to run two instances of margin in parallel connecting to an exchange with the same API key pair.
2) Make sure to set your VPS instance to the same time as the PC/laptop on which you were running margin. Otherwise, your API keys might not work.
3) Make sure your API keys do not have withdrawals activated.
4) Use margin’s encryption tool in the login screen to encrypt your keys to give you further peace of mind.

If you have any questions, don’t hesitate to get in touch with us.

Note that data usage (if connecting to your VPS instance using a phone or tablet) is pretty high so take care depending on the data plan you have for the VPS.

Yes, you can encrypt your stored API keys using margin. Just click on the small lock icon in the login screen and follow the instructions. Make sure to keep that password safe and not stored in plain text on your computer.

GUI

Optionally, move and/or rename the newly created folder to where you want margin to reside. A common choice is ~/opt/margin

Go into the margin folder and run the file called “margin”. Before the first run, the icon will be a default icon and not the margin logo shown in the screenshot.

Optionally, if you want to copy the .desktop file used to run margin to a different place, e. g. your desktop, or ~/.local/share/applications/ to be seen by your desktop environment, you’ll have to change the last line to read something like

GUI

Optionally, move and/or rename the newly created folder to where you want margin to reside. A common choice is ~/opt/margin

Go into the margin folder and run the file called “margin”. Before the first run, the icon will be a default icon and not the margin logo shown in the screenshot.

Optionally, if you want to copy the .desktop file used to run margin to a different place, e. g. your desktop, or ~/.local/share/applications/ to be seen by your desktop environment, you'll have to change the last line to read something like

Exec=/home/username/opt/margin/run-margin.sh

Adapt for the location you actually put margin in.

Command Line

Download margin-linux-x86-<version>.zip (where will be something like 3.1.4)

In the directory the file is in, do: unzip margin-linux-x86-<version>.zip

cd margin-linux

./run-margin.sh

Software handling

This occurs because you do not have enough funds to place even the minimum allowed order. For example for a BTC/USD market, if you see an invalid range in margin, it means in the ‘buy’ case that you do not have enough USD and in the ‘sell’ case enough BTC to place the minimum order possible.

Note that some bots require you to have a little more than the minimum in order to overcome trading fees and continue trading. That means that it is possible to have enough funds to place a manual trade but not start a bot in some cases.

This is the simplest bot in margin. Click on the strategy button (chess knight with +) to create a new bot. Initially it will default to an effective gain of 0.1% around the spread. Click and drag the buy and sell price lines to set the prices you want. The bot waits until its order is fully filled before switching actions and then places a limit order on the opposite side. In the example below, the bot has just placed a limit buy order and is waiting for the order to become active. If this order gets filled, a limit sell order for the same amount will be placed on the opposite side. Here, we’ve specified an effective gain of just over 3%.

There are a number of parameters you can set, some of which can be set directly in the chart. The ‘time window’ is set by dragging the long vertical blue line (see image below - it’s the thin blue line in the middle of the chart running from top to bottom) to determine what time period is desired. The vertical height of the time window is given by the lowest and highest priced trades that occurred during that time.

Inside this window the relative buy and sell margins can be set (dashed red horizontal lines). As the lowest and highest trade price will change over time, the vertical height of the window changes accordingly, which in turn means the buy and sell margin prices will change. As the market contracts, the prices become closer to each other. This also means that the initial Eff. gain* shown in the center of the time window will also change.

The Min. effective gain [%] is a very important parameter. For the mArgin maker it applies to both buy/sell and sell/buy cycles. It is always active, the default value being 0.0%. If you want to ensure that the bot makes a gain after trading fees have been subtracted, a positive value must be given. Note that this means a bot order can get stuck at a particular price in order not to violate the Min. effective gain.

The other parameters are quite self explanatory - especially if you hover over their tooltips.

Stop loss can be enabled and then adapted in the chart. If a stop-loss event occurs, the bot will accept the user-specified loss by triggering a spot sell order and then the bot stops.

The ‘Start with’ combo box (see figure) allows you to start the bot in three modes: buy, sell or any. Starting in any mode will activate both the buy and sell thresholds and is great if you are not sure which way the market will initially move.

Rather than placing limit orders like the static ping pong and mArgin maker bots, the Bollinger Band bot places spot orders. Once the bot triggers a spot order it will place it, which means you need to be prepared that the actual trade might not be at the price the order was triggered at.

How does an order get triggered? There are two bands, a sell band (solid red line) and a buy band (solid blue line), that can be configured. These are set relative to the Bollinger Bands. For an order to trigger, the opposite orderbook has to intersect the buy/sell band. For example, in the buy case, the top of sell orderbook has to touch the ‘Current buy threshold’. Note that in volatile markets this means that it can commonly occur that the orderbook rapidly retreats after triggering a spot order. This results in the spot order having to overcome the spread to get filled. On certain pairs this can be some percentage points off the trigger price.

In order to protect against unwanted losses it is possible to set a Min effective gain parameter. This can be set on both sides. In the figure the Minimum effective gain displaces the current buy threshold by more than 4% to ensure that the desired Minimum effective gain is achieved.

In the figure above, a minimum effective gain ensures that the bot does not buy back in too soon in a market that had trended upwards. Also note that the two sell trades (small yellow triangles) went through above the Bollinger Band sell threshold because of the Min effective gain setting.

Stop loss is also available on both sides. On the buy side a stop loss can be setup relative to the last buy the bot performed. This is visualised in the chart and the percentage can be manipulated by dragging the annotation up or down. Note that if stop loss is triggered, the bot will stop trading.

This could be a timestamp issue as Binance expects clients connecting to their API to be in sync (timewise) with their server. This might mean your system clock needs to be up-to-date. If you are on Windows, please follow these steps to get up and running :

Right click on the time in the task bar and select “Adjust date/time”. In the window that appears, make sure “Set time automatically” is on.

In the same window, click on “Additional date, time & regional settings”, then under “Date and Time” go to "Set the time and date”. In the “Internet Time” tab, click “Change settings...”, then make sure “Synchronize with an Internet time server” is selected and click “Update now”, then “OK”.

Next, run services.msc via the Start menu, then right click on “Windows Time” in the list of services and select “Properties”. Make sure “Startup type” is set to “Automatic” and that the service is started right now. Click the “Start” button if the service status is “Stopped” right now.

If all else fails, start a PowerShell as administrator and run the following lines:

The EMA crossover bot can be started in one of three modes: buy, sell or any. In the 'buy' mode it will wait until a buy situation arises before triggering its first spot order. In 'any' mode it is ready to either buy or sell, whichever situation occurs first.

What triggers a buy?
A buy event is triggered when the short term EMA line crosses the long term EMA line from below.

What triggers a sell?
A sell event is triggered when the short term EMA line crosses the long term EMA line from above.

Important details
Please note that in default mode the EMA bot waits for a candle to fully form before calculating the current value of the two EMA lines. The actual value taken for each candle can be configured in the GUI, but the default is to take the closing value. This means that even though a crossover event may have occurred in a particular candle the bot will react one candle later. Reacting within a currently forming candle had the undesired effect of potentially multiple crossover events occurring. It is possible for the bot to react to a crossover event immediately, but we then advise that offsets are used (see Crossover fine tuning below).

It is also important to note that once the bot triggers a buy or sell event it places a spot order. This means that the resulting trade can be displaced from the crossover event due to having to overcome the spread and in cases where there is a shallow order book this can result in many partial order fills.

Crossover fine tuning
It is possible to add a buy or sell offset which provides more confidence that a crossover situation has occurred. These are visualised in the chart as separate lines ensuring you have a visual confirmation of their affect.