Stock Market Simulator main e8c3612
A game that provides a realistic stock buying experience with unpredictable trends to test investment strategies.
|
Random price generator for stock market simulation. More...
#include "random_price.h"
#include <algorithm>
#include <cstdlib>
#include <random>
#include <iostream>
Go to the source code of this file.
Functions | |
std::map< stock_modifiers, float > | getProcessedModifiers (Stock stock) |
Get the processed modifiers for the stock. | |
float | init_sd (void) |
Initialize the standard deviation of the stock price. | |
float | init_stock_price (int price_profile) |
Initialize starting stock price. | |
float | percentage_change_price (Stock stock) |
Calculate the percentage change of the stock price. | |
unsigned int | random_integer (unsigned int max_integer) |
python randint like function | |
Random price generator for stock market simulation.
Definition in file random_price.cpp.
std::map< stock_modifiers, float > getProcessedModifiers | ( | Stock | stock | ) |
Get the processed modifiers for the stock.
stock | the stock to get the processed modifiers |
Definition at line 54 of file random_price.cpp.
References defaultLowerLimit, defaultUpperLimit, Stock::get_base_attribute(), Stock::get_event_attribute(), Stock::get_history_size(), Stock::get_initial_price(), Stock::get_price(), Stock::get_total_attribute(), lower_limit, lowerLimitMultiplier, mean, meanMultiplier, sdMultiplier, standard_deviation, upper_limit, and upperLimitMultiplier.
Referenced by percentage_change_price(), and print_table().
float init_sd | ( | void | ) |
Initialize the standard deviation of the stock price.
Definition at line 36 of file random_price.cpp.
Referenced by Stock::Stock().
float init_stock_price | ( | int | price_profile | ) |
Initialize starting stock price.
a | mean | s.d. |
---|---|---|
1 | 5 | 2 |
2 | 50 | 20 |
3 | 150 | 50 |
a | the profile of the stock price |
Definition at line 23 of file random_price.cpp.
Referenced by Stock::Stock().
float percentage_change_price | ( | Stock | stock | ) |
Calculate the percentage change of the stock price.
stock | the stock to calculate the percentage change |
Definition at line 114 of file random_price.cpp.
References Stock::get_split_count(), getProcessedModifiers(), lower_limit, mean, random_integer(), standard_deviation, and upper_limit.
Referenced by Stock::next_round().
unsigned int random_integer | ( | unsigned int | max_integer | ) |
python randint like function
max_integer | the maximum integer + 1 that can be returned |
[0, max_integer - 1]
Definition at line 45 of file random_price.cpp.
Referenced by Stock::Stock(), new_events_next_round(), percentage_change_price(), pick_events(), and pickUniqueNames().