Skip to content

yfinance-cpp is a C++ implementation of the popular Python library yfinance, designed to provide easy access to historical market data, stock prices, and financial information from Yahoo Finance.

Notifications You must be signed in to change notification settings

merckhung/yfinance-cpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YFINANCE (C++)

Quick Start

This is a quick and simple repository which is still in development. Its aim is to simplify the interaction between the Yahoo Finance API and C++.

Version Updates

v-0.1 (09-30-2022): Added the get_quotes and get_options member functions for the Symbol class.

v-0.2 (10-05-2022): Added the get_profile and get_summary member functions for the Symbol class.

v-0.3 (10-23-2022): Added the get_news member functions for the Symbol class.

Approach

The core element of the "pseudo" library is the Symbol class which is initialized through the asset's symbol. An exemple with the keyword new, therefore a pointer to the Symbol class is initialized:

yfinance::Symbol* sym = new yfinance::Symbol("GS");

In order to load quotes from the Symbol object you call the member function get_quotes with arguments interval, start and end. The interval argument is mandatory. If start or end are not specified the last available amount of data will be queried.

Structures::Quotes quotes = sym->get_quotes("5m");

In order to load options from the Symbol object you call the member function get_options wich does not take arguments:

std::vector<Structures::Option> options = sym->get_options();

Working within the quoteSummary endpoint, to load the assetProfile from the Symbol object you call the member function get_profile wich does not take arguments:

Structures::Profile profile = sym->get_profile();

Otherwise, if you want to extract some module from the quoteSummary endpoint, call the the member function get_summary with the name of the module as argument:

nlohmann::json financials = sym->get_summary("financialData");

About

yfinance-cpp is a C++ implementation of the popular Python library yfinance, designed to provide easy access to historical market data, stock prices, and financial information from Yahoo Finance.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 96.8%
  • Starlark 3.2%