backtesting#

alpha_model#

alpha_model.AlphaModel

Base class for all alpha models.

futures_model.FuturesModel

Type of alpha model, which can be easily integrated with any type of Tickers (plain Ticker objects, as well as FutureTickers).

contract#

events#

time_event.TimeEvent

Represents an event associated with certain date/time (e.g. 2017-05-13 13:00).

regular_time_event.regular_time_event.RegularTimeEvent

TimeEvent which occurs on regular basis (e.g. each day at 17:00).

regular_time_event.after_market_close_event.AfterMarketCloseEvent

Rule which is triggered every day after market closes.

regular_time_event.market_close_event.MarketCloseEvent

Rule which is triggered every day when the market closes.

regular_time_event.market_open_event.MarketOpenEvent

Rule which is triggered every day when the market opens.

regular_time_event.calculate_and_place_orders_event.CalculateAndPlaceOrdersRegularEvent

Class implementing the logic for all triggering regular calculation of signals and placing orders.

execution_handler#

commission_models#

commission_model.CommissionModel

fixed_commission_model.FixedCommissionModel

Naive commission model which always charges the same commission.

bps_trade_value_commission_model.BpsTradeValueCommissionModel

Commission model which uses fixed bps rate for trade value.

ib_commission_model.IBCommissionModel

Interactive Brokers commission for a transaction.

slippage#

base.Slippage

Base class for slippage models.

fixed_slippage.FixedSlippage

Slippage which always adds (or subtracts if short sale) certain absolute amount of money to the price.

price_based_slippage.PriceBasedSlippage

Calculates the slippage by using some fixed fraction of the current securities' price (e.g. always 0.01%).

square_root_market_impact_slippage.SquareRootMarketImpactSlippage

Slippage based on the square-root formula for market impact modelling.

fast_alpha_model_tester#

backtest_summary.BacktestSummaryElement

Class containing a summary of the performed backtest.

fast_alpha_models_tester.FastAlphaModelTester

ModelTester in which portfolio construction is simulated by always following the suggested Exposures from AlphaModels.

initial_risk_stats.InitialRiskStatsFactory

scenarios_generator.ScenariosGenerator

Class used for generating different scenarios for Trades.

monitoring#

abstract_monitor.AbstractMonitor

AbstractMonitor is a class providing an interface for all inherited Monitor classes (live, historic, custom, etc).

backtest_monitor.BacktestMonitor

This Monitor will be used to monitor backtest run from the script.

backtest_result.BacktestResult

BacktestResult is a class providing simple data model containing information about the backtest: for example it contains a portfolio with its timeseries and trades.

order#

orders_filter#

orders_filter.OrdersFilter

Adjusts final orders list to meet various requirements e.g. volume limitations.

volume_orders_filter.VolumeOrdersFilter

Verifies whether the orders sizes do not exceed the given volume limit.

portfolio#

portfolio.Portfolio

backtest_position.BacktestPosition

backtest_equity_position.BacktestEquityPosition

backtest_crypto_position.BacktestCryptoPosition

backtest_future_position.BacktestFuturePosition

trade.Trade

Trade is a logical unit representing getting exposure to the market (long or short) finished by closing the position.

transaction.Transaction

Encapsulates the notion of a filled Order, as returned from a Brokerage.

position_sizer#

position_sizer.PositionSizer

Converts Signal objects into sized orders.

simple_position_sizer.SimplePositionSizer

Converts each signal to a market order targeting a portfolio weight equal to Exposure value.

initial_risk_position_sizer.InitialRiskPositionSizer

Sizes positions from risk per trade and the signal's fraction_at_risk (typically ATR-based).

initial_risk_with_volume_position_sizer.InitialRiskWithVolumePositionSizer

Extends InitialRiskPositionSizer with a liquidity cap based on recent volume.

fixed_portfolio_percentage_position_sizer.FixedPortfolioPercentagePositionSizer

Scales each signal to a fixed fraction of portfolio value.

signals#

signal.Signal

Objects of this class are used in the portfolio construction process.

signals_register.SignalsRegister

Used to save signals processed by the Position Sizer and to be able to later to analyze all signals generated by the model and to present them in a readable form.

backtest_signals_register.BacktestSignalsRegister

In memory implementation of Signals Register.

strategies#

abstract_strategy.AbstractStrategy

Basic interface used to create a generic strategy.

alpha_model_strategy.AlphaModelStrategy

Puts together models and all settings around it and generates orders on before market open.

trading_session#

trading_session.TradingSession

Base class for all Trading Sessions.

backtest_trading_session.BacktestTradingSession

Encapsulates the settings and components for carrying out a backtest session.

backtest_trading_session_builder.BacktestTradingSessionBuilder

Class used to build a Trading Session with all necessary elements, connections and dependencies.