Margin trading improved

Davide Barbieri
The Rock Trading
Published in
5 min readSep 15, 2016
An open margin position.

In February 2016 we made margin trading available at TheRockTrading. This implementation was meant to be a “primer” for several reasons, among which the fact that bitcoin market is still too small to be useful, interesting and manageable for leveraged trading.

So far it has performed well, both from a technical point of view (my main concern, personally) and a financial point of view. Feedbacks were positive and its simple implementation decreased the learning curve for those who were approaching margin trading for the first time.

Today we are upgrading the trading engine, with an important new feature that should make margin trading a more serious business for all our users.

What is margin trading?

First of all let me explain what margin trading is at its core: a margin position is opened when an order with a certain leverage is matched.

That’s all, folks.

Submitting a buy order with 5x leverage

Let’s use an example, to make things more clear (I will use BTCEUR as market example, but remember that margin trading is available also on Ethereum pairs ETHBTC and ETHEUR). Suppose the market is trading at about 500 euro per bitcoin, and you want to go “long” because you feel that the price will increase in the next days. You have 1000 euro in your balance, but you are fairly confident the price will skyrocket, so — as a trader — you want to buy more than you can. You can use leverage, and use all your 1000 EUR to buy not only 2 bitcoins but 10 bitcoins. You will place a limit order of 10 bitcoins at 500 euro with leverage 5x.

This will the facto place a regular order, in BTCEUR orderbook, of 10 bitcoins @ 500 for a total value of 5000 euro, but will use only 1000 euro of your balance. The other 4000 euro are lent by the system.

So far, the order is a simple limit order as seen by other traders. And it will remain so, until it is partially or fully matched.

Suppose it is matched by a seller for 1.3 bitcoins, and a few minutes later for another 2 bitcoins. What will happen now is that you will see 2 different open positions and a limit order still available for 1.7 bitcoins (5–2–1.3=1.7).

Why two open positions? Because an open position is defined by the price it is opened/traded, which might have been different from your original leveraged order price. So, same initial order, but two different trades, means two different open positions. That is how it is currently implemented at TheRockTrading: to mirror an open position at its basic meaning.

When a position is opened, you can simply close it at market value (usually ask value, if it is a long position, bid value if it is a short position) by clicking on the handy close button. Or, if you are an advanced trader and have the “export mode” option active on TheRockTrading, you can see a lot of details of your position by clicking on it and there you can also close it, fully or partially, with a contrarian limit order (selling, if you are closing a long position, buying if you are closing a short one).

The difference between long and short positions.

There is an important difference between long and short positions in our implementation.

Naked shorting is not available. That’s because collateral for a margin position, is in the same currency of the position itself: if you go long on BTCEUR, you use your EUR as collateral, if you go short on the same market, you need BTC to sell them at leverage.

Rollover fees are based on collateral currency (EUR for long positions, BTC for short ones).

On long positions, you buy x bitcoin that will remain locked in your position balance. On short positions, in order to close it, you may not have enough euro to buy back enough bitcoin, if market conditions moves. That’s why you have the option to transfer part of your regular euro balance, into the euro position balance. You can transfer more balance than needed, without worry; every euro left in the position balance, when closed, will be returned back.

Sticking to base currency collateral on long positions and to trade currency collateral on short positions, was an implementation choice, mostly driven by the fact that margin trading is yet a dangerous tool in the wrong hands, and we do not want it to became wild. As both TheRockTrading users and bitcoin trading markets mature, this may change, but it will probably happen in a far future.

What has changed, now?

If you are reading this, I hope you have now a basic understanding of how margin trading works and how it is implemented at TheRock.

If you already had some experience with margin trading at TheRock, you may have noticed that “big” orders usually generate multiple positions.

That’s because a position is defined by a leveraged order, matched by a trade; but obviously you can have one order, matched by several contrarian orders.

This is an open margin position at its core; we want to maintain this basic unit of operation as it is, but it’s not handy for bigger traders, even if it will allow anyone to have the maximum granular control of their open positions.

How to maintain both benefits? With the introduction of “main positions”.

The new “main position” view. Note different close long orders, for different single positions of the same main one.

Now a “main position” is defined by its initial leveraged order and will group all single positions created by single trades against it. So, if you place a long order of 10 bitcoins, you will then focus on this “10 bitcoins” position as a whole.

All the usual features of a position apply: you can still partially close it, for instance. But at the same time, you can still see all the details of each single position that belongs to the main one.

Conclusion

I might have bored to death most of the readers up to now, but I hope to have explained not only how margin trading works but also why we made certain decisions. TheRockTrading as an exchange keeps growing, but we want to have our customers grow with us in experience and knowledge.

Again, if you are not dead at this point and would like to send us some feedback, go ahead!

--

--