Quandl

Quandl data service Logo.






Below lies the documentation of the Quotek SDK quandl API Client. With it will be able to enrich your algos with premium financial data, to later process them with the help of the other SDK functions.

You can go to https://www.quandl.com/ to signup for a Free account, and you can also check https://www.quandl.com/blog/ for extra information and resources on the API.

class quotek::datasource::quandl

quandl is a class meant to provide a simple quandl API client. Quandl is a very useful service for retrieving lots of financial data coming from various sources.

Inherits from quotek::datasource::datasource

Public Functions

quandl(std::string api_key)

quandl class constructor. Note: you can add an empty api_key “” but then are limited to 50 queries/day.

Parameters
  • api_key -

    Account API Key provided by quandl.

~quandl()

quandl class destructor.

std::vector<quotek::datasource::quandl_db> get_databases(const int pgnum = 0)

get_databases retrieves the full list of databases available on the quandl service.

Return
the list of available databases on quandl service , as quotek::datasource::quandl_db objects.
Parameters
  • pgnum -

    Starting page number you want to get data from. Mostly for recursion, you shouldn’t take care of this.

quotek::datasource::quandl_meta get_metadata(std::string database, std::string dataset)

get_metadatas allows to retrieve the metadata associated with a given dataset. database to get metadata from. dataset to get metadata from.

Return
a quotek::datasource::quandl_meta object containing the metadata info.

std::string query(std::string database, std::string dataset, std::string format, const std::string start_date = "", const std::string end_date = "", const std::string collapse = "", const std::string transform = "", const std::string sort_order = "", const int nb_rows = -1, const int column_num = -1, const bool exclude_colnames = false)

query() performs a direct query to the quandl API and returns its output without parsing it, as a string.

Return
the resulting dataset returned by quandl API, as a string.
Parameters
  • database -

    database to query from.

  • dataset -

    dataset in database to get data from.

  • format -

    return format needed. Can be “csv”, “json” and “xml”.

Parameters
  • start_date -

    YYYY-mm-dd string representation of the first day of data you want in the set.

  • end_date -

    YYYY-mm-dd string representation of the last day of data you want in the set.

  • collapse -

    aggregation of your data. Can be “daily”, “weekly”, “monthly”, “quarterly”, “annual”.

  • transform -

    data arithmetic, can be “diff”,”rdiff”,”cumul”,”normalize”.

  • sort_order -

    order in which data will be returned. Can be “asc” or “desc”.

  • nb_rows -

    number of rows to return in the dataset.

  • column_num -

    If you want to return only a specific column of the dataset, use this parameter.

  • exclude_colnames -

    Put this at true if you want to remove the columns names at the begining of the dataset.

quotek::data::records query_prices(std::string database, std::string dataset, const std::string start_date = "", const std::string end_date = "", const std::string collapse = "")

Performs a query on a prices dataset and returns its result in a quotek::data::records container. Note that this query only takes the close price. If you want more data you can make a query_fullprices query.

Return
a quotek::data::records container, containing all the datas of the set.
Parameters
  • database -

    database to query prices from.

  • dataset -

    dataset to query prices from.

Parameters
  • start_date -

    YYYY-mm-dd string representation of the first day of cotation you want in the set.

  • send_date -

    YYYY-mm-dd string representation of the last day of cotation you want in the set.

  • collapse -

    aggregation level of your data. Can be “daily”, “weekly”, “monthly”, “quarterly”, “annual”.

std::vector<quotek::data::history> query_fullprices(std::string database, std::string dataset, const std::string start_date = "", const std::string end_date = "", const std::string collapse = "")

Performs a query on a prices dataset and returns its result in a vector of quotek::data::history objects (open high low close).

Return
a vector of quotek::data::history objects, containing all the datas of the set.
Parameters
  • database -

    database to query prices from.

  • dataset -

    dataset to query prices from.

Parameters
  • start_date -

    YYYY-mm-dd string representation of the first day of cotation you want in the set.

  • send_date -

    YYYY-mm-dd string representation of the last day of cotation you want in the set.

  • collapse -

    aggregation level of your data. Can be “daily”, “weekly”, “monthly”, “quarterly”, “annual”.

std::vector<float> get_column(std::string database, std::string dataset, int column_num, const std::string start_date = "", const std::string end_date = "", const std::string collapse = "")

Returns a specific data column of float values.

Return
a list of float values.
Parameters
  • database -

    database to get data from.

  • dataset -

    dataset to get data from.

  • column_num -

    column number to fetch.

Parameters
  • start_date -

    YYYY-mm-dd string representation of the first day of data you want in the set.

  • send_date -

    YYYY-mm-dd string representation of the last day of data you want in the set.

  • collapse -

    aggregation level of your data. Can be “daily”, “weekly”, “monthly”, “quarterly”, “annual”.

Example

You will find below and sample source code about how to use the Quotek’s quandl client.

#include <quotek/quotek.hpp>
#include <quotek/datasources/quandl.hpp>
using namespace quotek::datasource;
using namespace quotek::data;

int main(int argc, char** argv) {

  //creates a new quandl object
  quandl qc("my-ApI-kEy");

  /*fetches weekly aggregated values for the Facebook stock and
    stores it in a quotek::data::records container. */
  records recs = qc.query_values("WIKI","FB","weekly");
  return 0;
}