Stock Market Simulator main e8c3612
A game that provides a realistic stock buying experience with unpredictable trends to test investment strategies.
Loading...
Searching...
No Matches
random_price.h
Go to the documentation of this file.
1/// @file random_price.h
2/// Header file for random related functions.
3/*
4This program is free software: you can redistribute it and/or modify it under the
5terms of the GNU Lesser General Public License as published by the Free Software
6Foundation, either version 3 of the License, or (at your option) any later version.
7
8This program is distributed in the hope that it will be useful, but WITHOUT ANY
9WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
11
12You should have received a copy of the GNU Lesser General Public License along with this
13program. If not, see <https://www.gnu.org/licenses/>.
14*/
15
16#ifndef RANDOM_PRICE_H
17#define RANDOM_PRICE_H
18
19#include "events.h"
20#include "stock.h"
21
22/**
23 * @brief Initialize starting stock price.
24 * @details
25 * | a | mean | s.d. |
26 * |---|------|------|
27 * | 1 | 5 | 2 |
28 * | 2 | 50 | 20 |
29 * | 3 | 150 | 50 |
30 * @param a the profile of the stock price
31 * @return the initial stock price
32 */
33float init_stock_price(int price_profile);
34
35/**
36 * @brief Initialize the standard deviation of the stock price
37 */
38float init_sd(void);
39
40/**
41 * @brief Get the processed modifiers for the stock.
42 * @param stock the stock to get the processed modifiers
43 * @return the processed modifiers
44 * @note the values of the processed modifiers are final values that will be used to
45 * calculate the percentage change of the stock price
46 */
47std::map<stock_modifiers, float> getProcessedModifiers(Stock stock);
48
49/**
50 * @brief Calculate the percentage change of the stock price.
51 * @return the percentage change of the stock price
52 * @param stock the stock to calculate the percentage change
53 */
55
56/**
57 * @brief python randint like function
58 * @param max_integer the maximum integer + 1 that can be returned
59 * @return a random integer in `[0, max_integer - 1]`
60 */
61unsigned int random_integer(unsigned int max_integer);
62
63#endif
A class that represents a stock object in the game.
Definition stock.h:55
Implements event-related data structures and (declarations of) such functions.
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.
std::map< stock_modifiers, float > getProcessedModifiers(Stock stock)
Get the processed modifiers for the stock.
unsigned int random_integer(unsigned int max_integer)
python randint like function
float init_sd(void)
Initialize the standard deviation of the stock price.
Declaration of the Stock class.