This project is a capstone for the Udacity C++ Nanodegree. The option chosen was "Capstone Option 1." This project is a stock portfolio simulator that loads stock data and perform two algorithms to compare the portfolio performance after iterating through all the available data. After processing the data, the program reports each portfolio's performance relative to the starting balance.
The porfolios use two algorithms for randomly placing purchase/sell on available stock based on the current balance. PortfolioRandom
implements a random purchase/sell algorithm, whereas PortfolioRandom2
performs the same algorithm as well as offloading any stocks which fall below the purchase value.
Result | Criteria | Notes |
---|---|---|
✅ | The submission must compile and run. | The project compiles and runs. |
Result | Criteria | Notes |
---|---|---|
✅ | The project demonstrates an understanding of C++ functions and control structures. | |
✅ | The project reads data from a file and process the data, or the program writes data to a file. | src/main.cpp:109 Read in CSV file. |
✅ | The project accepts user input and processes the input. | src/main.cpp:89 The user can pass in a command line argument specifying the portfolio's starting balance. |
Result | Criteria | Notes |
---|---|---|
✅ | The project uses Object Oriented Programming techniques. | types/include/Types/Portfolio.hpp |
✅ | Classes use appropriate access specifiers for class members. | types/include/Types/Portfolio.hpp:61 |
✅ | Class constructors utilize member initialization lists. | types/include/Types/Portfolio.hpp:42 |
✅ | Classes abstract implementation details from their interfaces. | |
✅ | Classes encapsulate behavior. | |
✅ | Classes follow an appropriate inheritance hierarchy. | |
✅ | Overloaded functions allow the same function to operate on different parameters. | types/include/Types/Portfolio.hpp:51 |
✅ | Derived class functions override virtual base class functions. | types/include/Types/PortfolioRandom2.hpp:8 |
✅ | Templates generalize functions in the project. | utils/include/Utils/Queue.hpp:9 |
Result | Criteria | Notes |
---|---|---|
✅ | The project makes use of references in function declarations. | |
✅ | The project uses destructors appropriately. | |
✅ | The project uses scope / Resource Acquisition Is Initialization (RAII) where appropriate. | |
✅ | The project follows the Rule of 5. | |
✅ | The project uses move semantics to move data, instead of copying it, where possible. | utils/include/Utils/Queue.hpp:24 |
✅ | The project uses smart pointers instead of raw pointers. | src/main.cpp:111 |
Result | Criteria | Notes |
---|---|---|
✅ | The project uses multithreading. | src/main.cpp:167 |
🔲 | A promise and future is used in the project. | |
✅ | A mutex or lock is used in the project. | utils/include/Utils/Queue.hpp:16 |
✅ | A condition variable is used in the project. | utils/include/Utils/Queue.hpp:19 |
This project depends on CMake
, google tests
, and spdlog
. All dependencies, except for CMake
are included in the vendor directory.
To compile this project, run the following commands:
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
From the root of the project, run ./build/bin/stockSim
to run the default program with a balance of $ 10,000. To specify a different starting balance, provide the balance as a command line parameter, ./build/bin/stockSim 5000
.