General

Introduction

Bitfex is a crypto derivatives exchange offering a complete futures market for Bitcoin. Three types of derivatives products are available for trading:

General information regarding margin, prices, index and exchange functioning are provided below. You can navigate directly to a topic from the menu.

Bitfex BTC Index

To calculate the Bitfex BTC Index Price, the latest prices from 5 different crypto exchanges namely Bitstamp, Coinbase, Gemini, Itbit,and Kraken are sourced continuously.

The mid-price is calculated using the best bid and best ask prices, from each of the 5 exchanges. The exchanges with the highest and the lowest prices are excluded from further calculation. The remaining 3 exchanges then given equal weightage of 33.33% each to calculate the BTC index price.

In the case one or more exchange's price feed is unavailable or exchange(s) are disabled, prices from 2 out of 4 or 1 out of 3 exchanges, excluding the exchanges with highest and lowest price, will be used to calculate the Bitfex BTC Index. If only 2 active price feeds are available, both will contribute an equal 50% weight to the Index. If only a single price feed is available, this price will be the index price. If for some reason Bitfex could not get the price feed from any of these exchange, trading will be temporarily disabled (platform locked) until a connection is re-established with any one of the exchanges.

Mark Price

For Perpetual Contracts, the Mark Price is dependent on the underlying Index Price and the Funding rate.

For Futures Contracts Mark Price is the average of Best Bid Price and Best Ask Price.

If there are no bids or no offer or both bids and offers are missing then BTC index price will be the Mark Price of the Futures contract.

Funding

For perpetual contracts, a mechanism called funding is employed to keep the price tethered to the underlying spot price, which will be the Bitfex Index Price.

After a fixed interval of 8 hours, there is an exchange of payments based on the value and sign of the funding rate. The funding rate is calculated over this fixed interval over the course of 24 hours, every 8 hours. Thus, funding happens at 0 UTC, 8 UTC and 16 UTC in a 24 hours cycle. Only traders holding a position at these times will either pay or receive funding.

The funding a trader has to pay/will receive is calculated as:

Funding = Position Value * Funding Rate.

If the rate is positive, longs (buyers) will pay the shorts (sellers). If the rate is negative, the shorts pay the longs.

Funding is a net-zero operation for the exchange; it is payments being exchanged between buyers and sellers.

Expiration Price

The expiration price is used for the settlement of expiring futures contracts. A time-weighted average of the Bitfex BTC Index from 07:30 UTC till 8:00 UTC, on a per minute basis, is used for its calculation. Thus, expiration price is given as the average of 30 instances of the Bitfex BTC Index, in the last half hour before settlement occurs.

Initial Margin and Maintenance Margin

Initial Margin(IM) is the minimum account balance required to initiate a position.

IM = Order Value * IM Percentage

Maintenance Margin(MM) is the minimum account balance required to keep a position open.

MM = Position Value * MM Percentage

Initial Margin and Maintenance margin will be calculated for all orders and trades.

Initial Margin will be blocked for all open positions and open orders (except the orders that will reduce the position size).

Profit and Loss

Profit and Loss is calculated on the basis of entry and exit/market prices. There are two types of profit/loss (PnL), realised and unrealised.

Realised PnL

This includes profits and/or losses from closed positions, trading fees and funding fees.

Unrealised PnL

This is PnL for open positions. Unrealised PnL is calculated on the basis of mark price. Unrealised PnL can be negative or positive immediately after an order executes. This happens when the mark price is different from the last price. Do note, unrealised profits are always added in real time to the NAV.

Average Entry Price

The average entry price for a position is given by the total number of contracts in the position divided by the value (in BTC) of the total position entered.

FIFO in PnL and Average Entry Price Calculation

Entering and exiting positions on Bitfex happens as per the 'First-In, First-Out' (FIFO) principle, with PnL and average entry price calculations reflecting the same. FIFO implies that contracts in positions entered first are also the contracts that are sold/bought first when a position is being exit. The example below illustrates this further:

Suppose you enter a long position (buy) of 1000 contracts in BTCUSD at $6000
You enter another long position of 1000 contracts in BTCUSD at $5000 and 
another long position of 1000 contracts when BTCUSD price is $7000

Now, Total Position (in BTC) = 1000/6000 + 1000/5000 + 1000/7000
= 0.50952381 BTC

Total Contracts = 1000 + 1000 + 1000 = 3000

Average Entry Price = Total Contracts/ Total Position (in BTC)
= 3000/0.50952381 = $5887.85

Now suppose, after some days the Mark Price for BTCUSD is $9050
You unrealised PnL will be calculated as follows

Unrealised PnL = 
  [1/Entry Price for 1st position - 1/ Mark Price]* Contracts in Position 1
+ [1/Entry Price for 2nd position - 1/ Mark Price]* Contracts in Position 2
+ [1/Entry Price for 3rd position - 1/ Mark Price]* Contracts in Position 3


= [1/6000 - 1/9050] * 1000 + [1/5000 - 1/9050] * 1000 + [1/7000 - 1/9050] * 1000 
= 0.53409629 BTC

Now, suppose you exit at $9000 by selling half your total position, 
i.e. 1500 contracts, then as per FIFO, the contracts in the position
that was taken first will be exit first, followed by contracts in the
second position and so on.

Hence, your Realised PnL will be calculated as follows

Realised PnL = 
  [1/Entry Price for 1st position - 1/ Exit Price]* Sold Contracts in Position 1
+ [1/Entry Price for 2nd position - 1/ Mark Price]* Sold Contracts in Position 2

= [1/6000 - 1/9000] * 1000 + [1/5000 - 1/9000] * 500
= 0.1 BTC

Consequently, your average entry price will be calculated as follows
Now, Total Position (in BTC) = 500/5000 + 1000/7000
= 0.24285714 BTC

Total Contracts = 500 + 1000 = 1500

Therefore, after the first exit, you have
Average Entry Price = Total Contracts/ Total Position (in BTC)
= 1500/0.24285714 = $6176.47

There are two types of account balances, Net Asset Value (NAV) and Available Balance.

NAV will be used for Liquidation Process and Available Balance will be used to check order placement.

Available Balance = NAV – IM Blocked

For example, a user deposit 1 BTC to his account.

NAV = 1 BTC
Available Balance = 1 BTC

Say the trader places an order of value 2 BTC, then for IM = 5% IM = 5% of 2 BTC = 0.1 BTC Say fees charged is 0.075%, then Fee = 0.075% of 2 BTC = 0.00150 BTC

Updated NAV = 1 - Fee = 1-0.00150 = 0.99850 BTC Available Balance = NAV – IM Blocked = 0.99850 - 0.1 = 0.899850 BTC

While placing a new order, if IM > Available Balance, order will be rejected.

Margin Call

As soon as NAV<=IM, a margin call will be issued to the trader via email. The trader can then choose to keep their positions open by increasing their account balance, and/or cancelling some or all open orders and/or closing some or all positions.

Auto Liquidation

If the Bitfex Exchange Risk System assesses that a trader's account balance is insufficient to maintain the account's positions, it will trigger a liquidation event.

The condition for the liquidation event is NAV <= MM. As soon as this condition is met, the Bitfex Liquidation Engine will take over the trader's account. At this moment, all the open orders will be cancelled, and liquidation orders will be sent to market. During the liquidation event, a trader has no control over their account and cannot place, cancel or modify any orders from their account.

This will continue till NAV > MM.

A liquidation fee of 0.6% will be charged, that will go to the insurance fund.

As soon as NAV<=IM, a margin call will be issued to the trader via email. The trader can then choose to keep their positions open by increasing their account balance, and/or cancelling some or all open orders and/or closing some or all positions.

Liquidation can be avoided in the following ways:

  • Set stop-loss when placing orders
  • Cover position by adding funds to the account balance if a margin call is issued
  • Close the position if a margin call is issued
  • Cancel open orders to free up margin if a margin call is issued

Bitfex Risk Engine does not liquidate the entire position in one go, instead does so via consecutive liquidation orders that are of a minimum predefined size or a percentage of the total position. By breaking down the liquidation into multiple orders until NAV > MM, the engine tries to ensure the preservation of the account balance and thus the capital of the trader.

Insurance Fund

Bitfex’s insurance fund covers the loss in case a trader goes bankrupt. The liquidation fee collected is added to this insurance fund.

With the advanced Risk Management System of the Bitfex Exchange and the margin requirements that have been set, it is very difficult to get bankrupt unless a very large market move occurs within a very short span of time. As the liquidation fees collected continues to replenish the insurance fund, any occurring bankruptcies will be covered for owing to the insurance fund.

However, in the extraordinary circumstance that the insurance fund depletes completely, a mechanism of socializing the subsequent bankruptcies amongst winning traders will follow, although the exchange will try to ensure before such a scenario occurs, margin requirements are revised if a pattern of excessive bankruptcies is observed among the traders.

Implied Logic

In a futures market to trade perpetual, quarterly and exchange quoted spread contracts, a matching engine with implied order functionality is essential, as this maintains an interconnection between the three contracts.

Any change in the liquidity and pricing of one of the contracts will automatically affect the liquidity and pricing of other contracts pertaining to the changed one.

The mechanism of implied orders is such that whatever orders are outstanding in the spread market are actively pooled in the outrights market (known as Implied Ins) and outstanding outrights orders are actively pooled in spreads (known as Implied Outs), so that a fill in the spreads is possible via outrights and vice versa.

Implied logic ensures liquidity in spreads and outrights is interlinked which leads to better liquidity and prevents price manipulation that illiquid markets can be prone to.