CPFin is a C++ library for financial analysis and currently supports historical data downloads, creation of custom indicators, and plotting and exporting to various formats.
To download data, construct some indicators, and export the results; run the following:
#include "priceseries.hpp"
int main() {
// Fetch data
const auto ps = PriceSeries::getPriceSeries("AAPL", "2020-01-01", "2020-12-31");
// Add indicators
ps->addRSI();
ps->addBollingerBands();
// View and export results
ps->plot();
ps->exportCSV("aapl.csv");
return 0;
}
For more examples, check the examples
directory and refer to the README.md
for instructions on running them.
Clone the project with the following command:
git clone https://github.com/Angus-Toms/CPFin
We are trying to minimise the number of dependencies required. Most are shipped with CPFin in the third_party
dir. The current distribution does require working distributions of the fmt and NLOpt libraries as well as Python3.
To run tests, navigate to the root directory, and call:
make test
- Price scraper
- Basic indicators
- Pretty printing and plotting
- Exporting to various formats (.csv, .png)
- More technical analysis
- Reduce need for prerequisites
- More stringent tests
- Better documentation, website
Contributions, questions, and issues found are all welcome. Please submit a PR or open an issue. Thank you!