|
curl_stocks
|
Classes | |
| class | Api |
| Wraps alphavantage API. Fetches stock data using curl. More... | |
Functions | |
| size_t | callback (void *contents, size_t size, size_t nmemb, std::string *s) |
| A call back function to be used with curl. | |
| Api::Api () | |
| Default constructor. | |
| Api::Api (std::string apikey, std::string cert_path) | |
| Constructor. | |
| void | Api::fetch (std::string const &function, std::string const &symbol, std::string &stock_data) |
| Fetch stock data. | |
| Api::~Api () | |
| Destructor cleans up curl objects. | |
| Api::Api | ( | ) |
Default constructor.
| Api::Api | ( | std::string | apikey, |
| std::string | cert_path | ||
| ) |
Constructor.
| apikey | |
| cert_path |
| size_t callback | ( | void * | contents, |
| size_t | size, | ||
| size_t | nmemb, | ||
| std::string * | s | ||
| ) |
A call back function to be used with curl.
Curl needs a function pointer as an argument which writes data to a string. Unfortunately, a pointer pointing to a member function is of a different type than a pointer pointing to a normal function. Curl needs a pointer to a normal function. Therefore this function cannot be a member function of the class Api and is declared separately.
| contents | |
| size | |
| nmemb | |
| s |

| void Api::fetch | ( | std::string const & | function, |
| std::string const & | symbol, | ||
| std::string & | stock_data | ||
| ) |
Fetch stock data.
| function | Daily / weekly / monthly data |
| symbol | Stock symbol |
| stock_data | Fetched data is stored here |


| Api::~Api | ( | ) |
Destructor cleans up curl objects.