Skip to content

Instantly share code, notes, and snippets.

@anthonymorast
Created July 3, 2022 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonymorast/e2030b089661a041ba2c67e5d34b5abb to your computer and use it in GitHub Desktop.
Save anthonymorast/e2030b089661a041ba2c67e5d34b5abb to your computer and use it in GitHub Desktop.
Document FMPCloudAPI::getStockQuote(const std::string& symbol) const
{
std::vector<std::string> symbols { symbol };
return getStockQuote(symbols);
}
Document FMPCloudAPI::getStockQuote(const std::vector<std::string>& symbols) const
{
if(symbols.size() > 50)
throw FMPCloudAPIError("ERROR (getStockQuote(vector)): Too many symbols. The maximum number of symbols is 50.");
std::string url = _baseUrl + "v3/quote/" + _toCommaDelimited(symbols) + "?apikey=" + _apiKey;
return _getNoCache(url, "quote");
}
Document FMPCloudAPI::getAvailableCrypto()
{
std::string url = _baseUrl + "v3/symbol/available-cryptocurrencies?apikey=" + _apiKey;
return _returnFromAndUpdateCache(url, "available crypto", "available_crypto", LONG);
}
Document FMPCloudAPI::getCryptoPrices() const
{
std::string url = _baseUrl + "v3/quotes/crypto?apikey=" + _apiKey;
return _getNoCache(url, "crypto_quotes");
}
Document FMPCloudAPI::getAvailableForex()
{
std::string url = _baseUrl + "v3/symbol/available-forex-currency-pairs?apikey=" + _apiKey;
return _returnFromAndUpdateCache(url, "available crypto", "available_crypto", LONG);
}
Document FMPCloudAPI::getAllForexPrices() const
{
std::string url = _baseUrl + "v3/quotes/forex?apikey=" + _apiKey;
return _getNoCache(url, "forex_quotes_all");
}
Document FMPCloudAPI::getAllForexTick() const
{
std::string url = _baseUrl + "v3/fx?apikey=" + _apiKey;
return _getNoCache(url, "all_forex_ohlc");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment