Skip to content

Features

Live Trading

With Interactive Brokers, Oanda v1, VisualChart and also with external 3rd party brokers (alpaca, Oanda v2, ccxt, ...)

0 based indexing

  • Use 0 in arrays for the present moment to address the look-ahead bias when accessing values in arrays

  • Use -1, -2 (i.e.: negative values) for the last moments, to keep in sync with Python's definition

  • Any positive index means the future (test your code in event-only mode and it will break)

Event and Vectorized

  • The trading logic and the broker are always run on an event by event basis

  • The calculation for indicators is vectorized if possible (source data can be preloaded)

Everything can be run in event-only mode with no data preloaded, just like if things were live.

Data Feeds (Live Too)

  • Built-in support for several sources: CSV, Database-Sources, YahooFinance, Interactive Brokers, Oanda v1, ...

  • Any number of simultaneous data feeds (memory constrained, obviously) can be run simultaneously

    Warning

    Beware of survivorshipt bias!

  • Multiple timeframes can be mixed and run

  • Integrated Resampling and Replaying

Broker with batteries included

  • Order Types: Market, Limit, Stop, StopLimit, StopTrail, StopTrailLimit, OCO, Bracket, MarketOnClose

  • Long Short selling

  • Continuous Cash Adjustment for Future-like instruments

  • User defined commission schemes and credit interest

  • Fund Mode

  • Volume Filling Strategies

  • Custom Slippage

Strategies - Trading Logic

  • Automatic warm-up period calculation before operating

  • Multiple Strategies (against same broker) can run in parallel

  • Multiple order generation methods (buy/sell, order_target_xxx, automated signals)

  • Event notification for: Incoming Data, Data Feed provider, orders, trades, timers.

Indicators

Over 122 indicators with the usual suspects on board

  • Many moving averages (SMA, EMA, ...), classic: (MACD, Stochastic, RSI, ...) and others

  • ta-lib integration

Performance Analyzers

Several built-in performance analyzers (TimeReturns, TradeAnalyzer, SharpeRatio, VWR, SQN, ...)

Plotting (extra)

Automated (customizable) plotting with a single command.

Note

For this to work, matplotlib has to be installed

Sizers

Define and plug smart automated staking policies

Observers

Agents which will be plotted and can observe everything in the system (usually will be used to plot statistics)

Miscelanea

  • Timers for repeated actions over time

  • Trading Calendars

  • Timezone Support

Pure Python

Work with one of the most powerful, yet easy to use, programming languages. No external libraries required.

  • Uses OO to easily let the pieces of the puzzle be fitted to each other.

  • Operators are overloaded, where possible, to provide natural language constructs such as:

    av_diff = bt.ind.SMA(period=30) - bt.ind.SMA(period=15)
    

    where av_diff will contain the difference of the simple moving averages of 30 and 15 periods.

  • For language constructs, cannot be overrideen, like and, or, if, equivalent functions are provided to ensure no functionality is missing, such as

    av_and = bt.And(av_diff > 0, self.data.close < bt.ind.SMA(period=30))