Supported Models



This page explains BitfinexBrokerageModel, including the asset classes it supports, its default security-level models, and it's default markets.

SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash);
SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin);
self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash)
self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)

To view the implementation of this model, see the LEAN GitHub repository.

Asset Classes

The BitfinexBrokerageModel supports trading Crypto.


The BitfinexBrokerageModel supports several order types, order properties, and order updates.

Order Types

The following table describes the available order types for each asset class that the BitfinexBrokerageModel supports:

Order TypeCrypto
MarketOrdergreen check
LimitOrdergreen check
LimitIfTouchedOrdergreen check
StopMarketOrdergreen check
StopLimitOrdergreen check
MarketOnOpenOrdergreen check
MarketOnCloseOrdergreen check

Order Properties

The BitfinexBrokerageModel supports custom order properties. The following table describes the members of the BitfinexOrderProperties object that you can set to customize order execution:

TimeInForce A TimeInForce instruction to apply to the order. The following instructions are supported:
  • Day
  • GoodTilCanceled
  • GoodTilDate
HiddenA flag to signal that the order should be hidden. Hidden orders do not appear in the order book, so they do not influence other market participants. Hidden orders incur the taker fee.
PostOnlyA flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled.
public override void Initialize()
    // Set the default order properties
    DefaultOrderProperties = new BitfinexOrderProperties
        TimeInForce = TimeInForce.GoodTilCanceled,
        Hidden = false,
        PostOnly = false

public override void OnData(Slice slice)
    // Use default order order properties
    LimitOrder(_symbol, quantity, limitPrice);
    // Override the default order properties
    LimitOrder(_symbol, quantity, limitPrice, 
               orderProperties: new BitfinexOrderProperties
                   TimeInForce = TimeInForce.Day,
                   Hidden = true,
                   PostOnly = false
    LimitOrder(_symbol, quantity, limitPrice, 
               orderProperties: new BitfinexOrderProperties
                   TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day)),
                   Hidden = false,
                   PostOnly = true
def Initialize(self) -> None:
    # Set the default order properties
    self.DefaultOrderProperties = BitfinexOrderProperties()
    self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
    self.DefaultOrderProperties.Hidden = False
    self.DefaultOrderProperties.PostOnly = False

def OnData(self, slice: Slice) -> None:
    # Use default order order properties
    self.LimitOrder(self.symbol, quantity, limit_price)
    # Override the default order properties
    order_properties = BitfinexOrderProperties()
    order_properties.TimeInForce = TimeInForce.Day
    order_properties.Hidden = True
    order_properties.PostOnly = False
    self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
    order_properties.Hidden = False
    order_properties.PostOnly = True
    self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)


The BitfinexBrokerageModel supports order updates.


The BitfinexBrokerageModel uses the ImmediateFillModel.


The BitfinexBrokerageModel uses the ConstantSlippageModel with zero slippage.

security.SetSlippageModel(new ConstantSlippageModel(0));


The BitfinexBrokerageModel uses the BitfinexFeeModel with the default argument values that models the current Bitfinex fee schedule.

Buying Power

The BitfinexBrokerageModel uses the CashBuyingPowerModel for cash accounts and the SecurityMarginModel for margin accounts.

If you have a margin account, the BitfinexBrokerageModel allows 3.3x leverage.


The BitfinexBrokerageModel uses the ImmediateSettlementModel.

Margin Interest Rate

The BitfinexBrokerageModel uses the NullMarginInterestRateModel.

Default Markets

The default market of the BitfinexBrokerageModel is Market.Bitfinex.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: