Code Monkey home page Code Monkey logo

quandlapi_c's Introduction

QuandlAPI_C

Quandl API (C/C++) is developed to download numeric data from quandl.com, making it easy for those C/C++ developers.

The API is encapsulated within a header file: 1) quandl (windows).h for the Windows environment; or 2) quandl (linux).h for the Linux environment.

It is reccommended that users sign up on http://www.quandl.com/users/sign_up, to obtain an authentication token for downloading increased volume of data per day.

1.After downloading the right header file, please include it in your code by:

//The name by default is quandl (windows).h / quandl (linux).h. 
//You can change it to quandl.h as follows if you like.
//You might also put a full directory depending on the location of the header, e.g.: "#include "C:\Users\MyName\Desktop\API\quandl (windows).h"
#include "quandl.h"

2.Now you can verify your account by by following command. This step can be skipped if you don't have an token or your don't want to use it.

//to register with the authentication token denote by the string "code".
quandl::auth(code);

3.Then you can download the csv file by specifying the Quandl code.

//to download the csv file defined by the quandlcode of a stock
quandl::get(quandlcode);

Alternatively, you can set your preferred values for the available parameters by:

//to download the file specified by eight parameters:
//quandlcode -- quandl code for a stock;
//order -- "asc" / "desc";
//StartDate -- in the format of YYYY-MM-DD, the date from which prices are recorded; 
//EndDate -- in the format of YYYY-MM-DD, the date until prices are recorded;
//transformation -- "cummul" / "diff" / "rdiff" / "normalize" / "cumulative";
//collapse -- "daily" / "weekly" / "monthly" / "quarterly" / "annual";
//rows  -- the number of rows to record;
//type  -- the type of downloaded files ("csv" / "json" / "xml" );
quandl::get(quandlcode, order, StartDate, EndDate, transformation, collapse, rows, type); 

A case study: download the stock price of TENCENT HOLDINGS LTD (TCTZF). The quandlcode is GOOG/PINK_TCTZF. Then you might write the following code:

//#include "quandl (windows).h"
int main() {
    quandl ql;
    ql.auth("<code>"); // Replace <code> with your own token.
    ql.get("GOOG/PINK_TCEHY");
    return 0;
}

Please visit http://www.quandl.com/help/api to better understand the Quandl API design.

quandlapi_c's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

quandlapi_c's Issues

Not actually c/c++

This code will not compile with any version of C because it is a definition for a class.

HTTP/1.1 400 Bad Request

I am getting this output for the recv call in the quandl class download function for any quandl code I have tried so far.

I tried updating the website to 'v3' - using 'curl ' from command line with the quandl class website definition returns the correct output.

The overall output from the quandl::get() function call is as follows (preceeded by the socket value, and the iRecv value):

3
1338
HTTP/1.1 400 Bad Request
Content-Type: text/html
Cache-Control: no-cache, no-store
Connection: close
Content-Length: 840
X-Iinfo: 11-213082683-0 0NNN RT(1605134354103 0) q(0 -1 -1 24) r(0 -1) b1
Set-Cookie: visid_incap_2261005=OMrzfonOQwW8X0v5nZQy6xJorF8AAAAAQUIPAAAAAACjyuO7wBSowc8H0v6TsDb8; expires=Thu, 11 Nov 2021 13:35:04 GMT; HttpOnly; path=/; Domain=.quandl.com
Set-Cookie: incap_ses_978_2261005=qj1AFOI6IGwGjKctB46SDRJorF8AAAAAvBsO/rURKlIhoVJQgiRUCg==; path=/; Domain=.quandl.com

<script type="text/javascript" src="/_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3"></script><iframe id="main-iframe" src="/_Incapsula_Resource?CWUDNSAI=2&xinfo=11-213082683-0%200NNN%20RT%281605134354103%200%29%20q%280%20-1%20-1%2024%29%20r%280%20-1%29%20b1&incident_id=978000230574689286-1028704762638501323&edet=3&cinfo=03000000&pe=100005&rpinfo=0" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 978000230574689286-1028704762638501323</iframe>

3
0
HTTP/1.1 400 Bad Request
Content-Type: text/html
Cache-Control: no-cache, no-store
Connection: close
Content-Length: 840
X-Iinfo: 11-213082683-0 0NNN RT(1605134354103 0) q(0 -1 -1 24) r(0 -1) b1
Set-Cookie: visid_incap_2261005=OMrzfonOQwW8X0v5nZQy6xJorF8AAAAAQUIPAAAAAACjyuO7wBSowc8H0v6TsDb8; expires=Thu, 11 Nov 2021 13:35:04 GMT; HttpOnly; path=/; Domain=.quandl.com
Set-Cookie: incap_ses_978_2261005=qj1AFOI6IGwGjKctB46SDRJorF8AAAAAvBsO/rURKlIhoVJQgiRUCg==; path=/; Domain=.quandl.com

<script type="text/javascript" src="/_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3"></script><iframe id="main-iframe" src="/_Incapsula_Resource?CWUDNSAI=2&xinfo=11-213082683-0%200NNN%20RT%281605134354103%200%29%20q%280%20-1%20-1%2024%29%20r%280%20-1%29%20b1&incident_id=978000230574689286-1028704762638501323&edet=3&cinfo=03000000&pe=100005&rpinfo=0" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 978000230574689286-1028704762638501323</iframe>

Unable to download using CPP library

I have been successfully using the CPP library in my application for about 2 months. The last download session using my app was 8/21/2014. Sometime after 9/1/2014, the app refused to download. I've downloaded the most recent windows header file but no change. I am not able to get even the simplest request to work. ( ql.get("CME/SK2014");) The app just hangs up on the window that says "Downloading Quandl Data for CME/SK2014. The CSV file is initialized with 0 bytes, then after a couple minutes, completes the process. The contents of the CSV file is: HTTP/1.1 504 Gateway Timeout Content-length:0. When the problem first started, it said HTTP/1.1 400 BAD_REQUEST I've tried this on 2 windows 7 machines and one SQL Server 2012 machine. Does anyone have any suggestions? Thanks. LaVerne Sanders ([email protected])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.