RSS Feeds

class quotek::datasource::rss

rss is a class which allows to fetch rss feeds inside quotek strategies in order to process them (and potentially dedude positions to take).

Inherits from quotek::datasource::datasource

Public Functions

rss(std::string source)

rss class constructor

~rss()

rss class destructor

std::vector<quotek::data::news> fetch(int nb_news)

fetches the the RSS stream passed inside the RSS object constructor.

Return
a vector of quotek news objects.
Parameters
  • nb_news -

    The number of news to fetch (sorted by descending date)

Example

You will find below a sample source code about how to use the Quotek RSS client to fetch news from wall-street journal Market RSS feed */

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

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

  //We declare a new rss client.
  rss r1("http://www.wsj.com/xml/rss/3_7031.xml");

  //we fetch the last five news of the feed.
  std::vector<news> nvect = r1.fetch(5);

  //Then we iterate through them to display their content on stdout.
  for(int i=0;i<nvect.size();i++) {
    std::cout << nvect[i].content << std::endl;
  }

}