Most of the code is written in Python. This was chosen due to its powerful machine-learning and statistic libraries, its popularity, as well as its suitability for rapid prototyping. In the far future the platform is likely to be ported to Rust.
Distributed Components:
Bigchap is the brain and orchestrator, and leads all other services like a conductor leading a symphony.
Weechap is the container service(s) that takes responsibility for worker tasks.
DataProcessor works with the main database. It also handles any low priority scheduled tasks.
More info on the distributed components here...
Modules:
TradeSequencer can sequence related market symbols and events into the correct order. One TradeSequencer per thread, avoiding the need for locks during live trading and backtesting, allowing for accurate pairs trading simulations without sacrificing on performance.
Broker handles buys and sell signals sent by the trading strategies, and turns them into orders. It also can split these orders into smaller ones depending on the market conditions and excecution strategy rules.
Portfolio keeps track of positions, margin, and PnL stats.
TradeStrategies help to define the rules of buying and selling with respect to positions.
ExecutionStrategies monitor market conditions and assist in breaking up large orders into smaller ones. They can be aggressive (get in and out of the market quickly at the cost of slippage) or passive (wait until the best price with the hope it does not run away from the target) as desired.
ExchangeBroker(s) help to abstract away the complexity of supporting multiple exchanges when presented to the main Broker.
UniverseSelector aids in rebalancing portfolios and reducing the number of traded pairs per strategy to a managable amount.
Collectors run continuously to capture live exchange data using a fast asyncio with uvloop implementation.
Batchers capture historical data from 3rd party API's when supported (and scrape alternative data sources). Currently these batch jobs are scheduled through Apache Airflow.
Parser sanitizes trade data as it is passed in, and removes or fixes any inconsistencies.
Cache contains the history of data in memory, in whatever format is desired.
MLIndicators are able to generate probabilities and buy/sell signals for TradeStrategies through a variety of machine-learning techniques and models. This can be at the end of a bar or on every tick.
Indicators handle traditional TA based calculations. RSI's, SMA's, EMA's: Yes! All the stuff that every other trading software out there can do! This can be at the end of a bar or on every tick.
Simplified modules and flow