Determining position size, leverage, and liquidation levels
If we are indeed at the start of a bitcoin bull run, then it is going to get progressively harder to accumulate a full BTC. Raising the FIAT needed to buy one outright is beyond my means without taking some credit risk. Trading alts is another to do this, but I’m not willing to risk much of the BTC that I already have on alts. Instead I’ve decided to see what I can do with a small amount of fait and some margin trading. So I opened an account on Kraken.
US residents don’t have many options when it comes to leveraged trading. Kraken is one of the few, and the one that seemed most accessible to me. Getting verified was simple enough, but I was a bit shocked to find that they don’t allow ACH transfers from bank accounts, only wire. Alas. I was able to use stablecoins to transfer from my preferred exchange, as well as some BTC I had earmarked in a trading wallet, as well as some ETH I had mined.
With these meager funds, I made a small swing trade on spot. I’ll admit that I didn’t know much about leverage, but I did know that there was a call level and a liquidation level. For the life of me though, I couldn’t find a way to calculate this. Kraken’s documentation shows that they have a profit and loss / liquidation calculator, but it’s on the futures site, and not available to me. I’m not sure this is an oversight, or a way for them to get over on noobs.
I spent an hour or two last night trying to calculate these numbers myself. With a few examples and some algebra, I was able to put together a spreadsheet that allows me to plan my entry and stops, and validate that they are well outside of liquidation range.
Using an example from Kraken’s documentation: Using $5000 in equity to open a $10,000 position with 5x leverage results in a $2000 margin level. The margin ratio on the account is
(5000/2000) x 100 = 250%. A ratio of one hundred percent put us in danger of liquidation. Kraken can margin call at around 80% (the exact percentage depends on some obtuse factor), and the liquidation process starts at 40%. But how to figure this out.
Kraken’s example gives us a hint. If the account takes a paper loss of $3500, this puts the equity at $1500 (
5000-3500), and the margin level is now
1500/2000 = 75%. So we know have enough information to write it out as an equation.
margin rate = (equity - original position price - current position value) / margin amount
What we really want, though, is to estimate the current position value. Using a bit of algebra we can isolate it as such:
current position value = (margin rate * margin amount) - equity + position cost
Now we can substitute the call and liquidation rates in our spreadsheet to determine the current position value, further breaking it down by market price and position size.
In order to use the spreadsheet, fill out your equity size, entry and stop loss. The risk amount is set to two percent, change as you like. If the position size is more than five times your equity, OVERLEVERAGE will return true, which means that the parameters you’ve entered are so conservative that you won’t come close to the full risk amount. You can lower your stop loss to find the sweet spot.
In our example, we have $10,000 in equity, and are going to enter a position at $10,000, with a stop loss of $9900. This will allow us to open a $20,000 position, which we will be able to open using $4000 of margin (collateral) at 5x.
As you can see, the spot price will have to drop to $7000 before our margin level falls to 100%: (14,000 position value + 6,000 equity remaining = original position size of $20,000.) Since our stop loss is well, well above this level, we shouldn’t have to worry about getting called at 80% or liquidated at 40%.
Hopefully this spreadsheet is helpful, and please, please use risk management before you take these trades. If you’re new to leverage, as I am, I recommend you read CryptoCred’s Comprehensive Guide to Position Size and Leverage.
2 Replies to “Kraken margin trading calculator”
Hey this is really great, thank you. How can I adjust the calculations in the spreadsheet for short/sell positions?
You can make a copy of this sheet and make your own changes. I’m afraid I’m no longer doing margin trading on Kraken (see yesterday’s article about Perpetual.Finance) so I don’t have time to work on this.