What's the exact formula where I can calculate my liquidation price on Bitfinex for a leveraged position? The following variables are given:

Exchange: Bitfinex

Funds: $10,000 USD
BTC Price: $1000
Use Leverage of: 2x = $20,000 USD

Say I wanted to go long Bitcoin thinking it would be above $1000 in the next 6 months. I buy 20k USD worth of BTC (20 btc) at the $1000 price. 


What does the price of btc have to drop before I lose my initial investment of $10,000?
What is the formula for something like this when using Bitfinex exchange?
Old question, but I wanted to work this out myself.

The exchange will liquidate your account as soon as it becomes insolvent. There are exchange dependent parameters fees, interest and maybe a threshhold to take into account. I don't know bitfinex values for these.

Ignoring them for now, the general equation works out like:

p(t) = btcusd at time t

p(0) = 1000

leverage = m = 2

initial usd = d0 = 10000

assets(t) = d0*m/p0*p(t)

liabilities(t) = d0 - md0 = d0(1-m)

Liquidated when assets(t) + liabilities(t) = 0, i.e. when d0*m/p0*p(t) + d0*(1-m) = 0

=> p(t) = -(1-m)*p0/m

=> p(t)/p0 = (m-1)/m

For p0=1000, m=2, you liquidate when p(t) drops to 1/2 of 1000 = 500

If anyone has the exchange-dependent data for bitfinex, I'll try to incorporate into the equation.