With Interactive Brokers, Oanda v1, VisualChart and also with external 3rd party brokers (alpaca, Oanda v2, ccxt, ...)
0 based indexing
0in arrays for the present moment to address the look-ahead bias when accessing values in arrays
-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-onlymode 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
Beware of survivorshipt bias!
Multiple timeframes can be mixed and run
Integrated Resampling and Replaying
Broker with batteries included
Long Short selling
Continuous Cash Adjustment for Future-like instruments
User defined commission schemes and credit interest
Volume Filling Strategies
Strategies - Trading Logic
Automatic warm-up period calculation before operating
Multiple Strategies (against same broker) can run in parallel
Multiple order generation methods (
order_target_xxx, automated signals)
Event notification for: Incoming Data, Data Feed provider, orders, trades, timers.
Over 122 indicators with the usual suspects on board
Many moving averages (
EMA, ...), classic: (
RSI, ...) and others
Several built-in performance analyzers (
Automated (customizable) plotting with a single command.
For this to work,
matplotlib has to be installed
Define and plug smart automated staking policies
Agents which will be plotted and can observe everything in the system (usually will be used to plot statistics)
Timers for repeated actions over time
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)
av_diffwill contain the difference of the simple moving averages of
For language constructs, cannot be overrideen, like
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))