Skip to content

A C++ financial analysis and visualisation library.

License

Notifications You must be signed in to change notification settings

Angus-Toms/CPFin

Repository files navigation

CPFin

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.

QuickStart Guide

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.

Download

Clone the project with the following command:

git clone https://github.com/Angus-Toms/CPFin

Prerequisites

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.

Testing

To run tests, navigate to the root directory, and call:

make test

Roadmap

  • 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

Contributing

Contributions, questions, and issues found are all welcome. Please submit a PR or open an issue. Thank you!