Back to Community
Context.account object documentation gone

Hello Team Q!

The section about the context.account object has vanished from the documentation, so I'm looking for the exact definition for these attributes:


1 response

Found an old copy of the docs, it doesn't have everything but it's good enough:

context.account.accrued_interest (IB: AccruedCash)

(Float) Interest that has accumulated but has not been paid or charged.

Backtest value: 0

context.account.available_funds (IB: AvailableFunds)

(Float) Equity with loan value less the initial margin requirement.

Backtest value:

context.account.buying_power (IB: BuyingPower)


IB Cash Account: Minimum (Equity with Loan Value, Previous Day Equity with Loan Value)-Initial Margin.
IB Margin Account: Available Funds * 4.
Backtest value: Infinity

context.account.cushion (IB: Cushion)

(Float) Excess liquidity as a percentage of net liquidation.

Backtest value: / context.portfolio.portfolio_value

context.account.day_trades_remaining (IB: DayTradesRemaining)

(Float) The number of open/close trades a user can place before pattern day trading is detected.

Backtest value: Infinity

context.account.equity_with_loan (IB: EquityWithLoanValue)


IB Cash Account: Settled Cash.
IB Margin Account: Total cash value + stock value + bond value + (non-U.S. & Canada securities options value).
Backtest value: context.portfolio.portfolio_value

context.account.excess_liquidity (IB: ExcessLiquidity)

(Float) Equity with loan value less the maintenance margin.

Backtest value:

context.account.initial_margin_requirement (IB: InitMarginReq)

(Float) The minimum portion of a new security purchase that an investor must pay for in cash.

Backtest value: 0

context.account.leverage (IB: GrossLeverage)

(Float) Gross position value divided by net liquidation.

Backtest value: (long value + abs(short_value)) / context.portfolio.portfolio_value

context.account.maintenance_margin_requirement (IB: MaintMarginReq)

(Float) The amount of equity which must be maintained in order to continue holding a position.

Backtest value: 0

context.account.net_leverage (IB: NetLeverage)

(Float) The default value is also used for live trading.

Backtest value: Net exposure value divided by net liquidation.

context.account.net_liquidation (IB: NetLiquidation)

(Float) Total cash, stock, securities options, bond, and fund value.

Backtest value: context.portfolio.portfolio_value

context.account.regt_equity (IB: RegTEquity)


IB Cash Account: Settled Cash.
IB Margin Account: Total cash value + stock value + bond value + (non-U.S. & Canada securities options value).
Backtest value:

context.account.regt_margin (IB: RegTMargin)

(Float) The margin requirement calculated under US Regulation T rules.

Backtest value: Infinity

context.account.settled_cash (IB: SettledCash)

(Float) Cash recognized at the time of settlement less purchases at the time of trade, commissions, taxes, and fees.

Backtest value:

context.account.total_positions_value (IB: GrossPositionValue)

(Float) The sum of the absolute value of all stock and equity option positions.

Backtest value: context.portfolio.positions_value