Skip to content

mesinger/alphavantagecpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alphavantagecpp

Cross platform C++ 17 wrapper for Alpha Vantage

Design goals

alphavantagecpp is designed to work like the official API documentation of Alpha Vantage. Naming of functions and parameters are exactly as mentioned in the documentation. All optional parameters have their corresponding default values.

Integration

#include "alphavantage.hpp"
  • network communication is implemented with cURL, so you will have to link their library to your project.
  • unit testing with Catch2 (the tests will not work with a free API key, as those are restricted to 5 API calls / minute)

Usage

With nlohmann/json you could do something like this.

// builds request object and sets the requiered parameters
auto request = av::TIME_SERIES_DAILY("AAPL", "apikey");

// sends the response to alphavantage and returns the json/csv response as an optional string
std::optional<std::string> response = request.fetch();

if (response) {

	auto jsonData = nlohmann::json::parse(response);

	for (const auto& entry : jsonData["Time Series (Daily)"]) {

		std::cout << entry["1. open"] << std::endl;
	}
}

About

C++ 17 wrapper for Alphavantage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published