-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simulator.h
56 lines (41 loc) · 1.48 KB
/
Simulator.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once
#include "PortfolioTotalsStack.h";
#include "SimulatorConfiguration.h"
#include "SimulationStatObj.h"
#include "TradeOutcome.h"
class Simulator
{
// Vars from config
SimulatorConfiguration originalProps;
SimulatorConfiguration simProps;
// Vars for internal processes
PortfolioTotalsStack totalsStack;
SimulationStatObj statObj;
int cumulativeTradeCount;
int cumulativeSimCount;
// Returns the average portfolio total
double calcPortfolioAverage();
// Decide if trade was won or lost
bool determineOutcome(double winDecimal);
public:
// Default constructor
Simulator(SimulatorConfiguration config);
// Pop the last calculated portfolio added to the stack
double popLastPortfolio();
// Add another portfolio to the stack
void addPortfolio(TradeOutcome result);
// Get the current number of comleted trades
int getTradeCount();
// Get the current number of completed simulations
int getSimulationCount();
// Runs a single trade and push the result to the inner stack
TradeOutcome runSingleTrade();
// Runs a single simulation of specified number of trades and adds the total to the stack
void runSingleSimulation();
// Compress the history of stacks so that only the final one remains in totalStacks, and statsStack holds statistical information
void compressTotalsStack();
// Completes the desired number of simulations back-to-back
void runSimulations();
// Export all simulation totals for use in data visualization
double* exportPortfolioTotals();
};