aat is an asynchronous, event-driven framework for writing algorithmic trading strategies in python with optional acceleration in C++. It is designed to be modular and extensible, with support for a wide variety of instruments and strategies, live trading across (and between) multiple exchanges, fully integrated backtesting support, slippage and transaction cost modeling, and robust reporting and risk mitigation through manual and programatic algorithm controls.
Like Zipline and Lean,
aat exposes a single strategy class which is utilized for both live trading and backtesting. The strategy class is simple enough to write and test algorithms quickly, but extensible enough to allow for complex slippage and transaction cost modeling, as well as mid- and post- trade analysis.
aat is in active use for live algorithmic trading on equities, commodity futures contracts, and commodity futures spreads by undisclosed funds.
A complete overview of the core components of
aat is provided in the GETTING_STARTED file.
aat's engine is composed of 4 major parts.
The trading engine initializes all exchanges and strategies, then martials data, trade requests, and trade responses between the strategy, risk, execution, and exchange objects, while keeping track of high-level statistics on the system
The risk management engine enforces trading limits, making sure that stategies are limited to certain risk profiles. It can modify or remove trade requests prior to execution depending on user preferences and outstanding positions and orders.
The execution engine is a simple passthrough to the underlying exchanges. It provides a unified interface for creating various types of orders.
The backtest engine provides the ability to run the same stragegy offline against historical data.
aat has a variety of core classes and data structures, the most important of which are the
The core element of
aat is the trading strategy interface. It includes both data processing and order management functionality. Users subclass this class in order to implement their strategies. Methods of the form
onNoun are used to handle market data events, while methods of the form
onVerb are used to handle order entry events. There are also a variety of order management and data subscription methods available.
The only method that is required to be implemented is the
onTrade method. The full specification of a strategy is given in GETTING_STARTED.
aat also provides a complete limit-order book implementation, including flags like
all-or-nothing, which is used to power the synthetic testing exchange.
Thanks to the following organizations for providing code or financial support.
This software is licensed under the Apache 2.0 license. See the LICENSE file for details.