This is the module/library regarding the strategies.
This folder contains all files related to the strategies that are to be implemented in the assignment. This entire module/library is defined under the namespace Strategies
.
There are two Base classes that can be inherited by the strategies.
Strategy
abstract class is the base class for those strategies which depend on a single stockPairsStrategy
abstract class is the base class for those strategies which depend on a pair of stocks.Adx_Strategy
class is a specific class made for the strategies that require high and low values of the stock in addition.LinearRegressionStrategy
class is a specific class made for the training a linear regression model on train data.
Following from the assignment, x, and n are taken as int. This contains the following two pure virtual functions.
Before the simulation starts, we need to process the previous n days of data. This function is called to do that.
This function is called to get the action to be taken on the current day.
Follows the same structure as the Strategy
class. The only difference is that the init_first_n_days
function takes in a two vector of doubles and get
function takes in two doubles as input and outputs a pair . This is because the pairs strategy depends on two stocks.
There is dedicated function to train the model.
The model is trained using normal equation method. Hence the inputs needed are two matrices.
The Action get(double)
function works as usual as the other base strategies.
This is an enum to signal whether to buy, sell, or hold the stock for a given day.
The structure of the folder is as follows:
This file should contain all the base classes that are to be inherited by the strategies.
This is the header of all the classes that are present in this folder. Think of this as rust's mod.rs
file.
This bundles all the cpp files. This file exists because g++ cannot create object files from multiple source files.
These files provide an implementation for a particular strategy.