forked from shxhid01/TradingSimulation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MeanReversion.h
25 lines (25 loc) · 970 Bytes
/
MeanReversion.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef MEANREVERSION_H
#define MEANREVERSION_H
#include "MarketNeutralStrategy.h"
//Class relationship
class MeanReversionStrategy : public MarketNeutralStrategy {
private:
double meanPrice = 100;
public:
//Constructor initalising strategy name
MeanReversionStrategy() : MarketNeutralStrategy("Mean Reversion") {}
//Executes mean reversion strategy
double execute(double currentPrice, const std::string& marketEvent) override {
double action = (meanPrice - currentPrice) * 0.01;
//Adjust mean price and action based on market events
if (marketEvent.find("market downturn") != std::string::npos) {
//Adjust mean price expectation during downturn
meanPrice *= 0.95;
} else if (marketEvent.find("bull market") != std::string::npos) {
//Adjust mean price expectation during bull market
meanPrice *= 1.05;
}
return action;
}
};
#endif //MEANREVERSION_H