ATS
An algorithmic trading system completely written in C++
|
Defines an abstract interface for trading strategies. More...
#include <Strategy.h>
Public Member Functions | |
Strategy (std::string symbol, MarketData &data, OrderManager &orderManager, std::vector< double > prices={}) | |
Constructs a Strategy object. More... | |
virtual | ~Strategy () |
Destructs the Strategy object. | |
virtual void | start () |
Starts the strategy thread. | |
virtual void | run () |
Runs the strategy. | |
virtual void | stop () |
Stops the strategy. | |
bool | isRunning () |
Returns whether the strategy is running. More... | |
Protected Member Functions | |
virtual void | updatePrice ()=0 |
Updates the historical price vector. | |
virtual double | getSignal ()=0 |
Gets the trading signal. More... | |
virtual void | buy ()=0 |
Sends a buy order to the OrderManager. | |
virtual void | sell ()=0 |
Sends a sell order to the OrderManager. | |
Protected Attributes | |
MarketData & | mData |
MarketData object to get market information. | |
OrderManager & | mOrderManager |
OrderManager object to create and manage orders. | |
std::string | mSymbol |
The symbol the strategy is trading. | |
std::vector< double > | mPrices |
Vector of historical prices. | |
std::thread | mStrategyThread |
Thread for running the strategy. | |
bool | mRunning |
Flag indicating if the strategy is running. | |
Defines an abstract interface for trading strategies.
ats::Strategy::Strategy | ( | std::string | symbol, |
MarketData & | data, | ||
OrderManager & | orderManager, | ||
std::vector< double > | prices = {} |
||
) |
Constructs a Strategy object.
symbol | The symbol the strategy will trade |
data | MarketData object to get market information |
orderManager | OrderManager object to create and manage orders |
prices | Vector of historical prices (default empty) |
|
protectedpure virtual |
Gets the trading signal.
bool ats::Strategy::isRunning | ( | ) |
Returns whether the strategy is running.