Giter Site home page Giter Site logo

quandl-java's Introduction

quandl-java

githalytics.com alpha This is a Java API for the Quandl data service. It's goal is to make it easy for you to use Quandl's data in a Java application.

Our first step is to open a connection to Quandl using an API key. This connection will facilitate the creation of dataset objects (dataset downloads).

Login to Quandl and go to http://www.quandl.com/users/edit

Click "API" and you will see your key. You will want to use this as the rate limits are higher if you are using a key.

//open connection with key
QuandlConnection q = new QuandlConnection("my key");

If you don't provide a key (or supply a bad one), you can still open a connection. You'll just be notified that your rate limit is significantly smaller.

//open connection without key
QuandlConnection r = new QuandlConnection();

QDataset is the basic quandl-java object. It downloads data in JSON form and converts it into a Java object. The minimal setting you must supply is the "Quandle Code"... which is available on Quandl dataset pages.

//get dataset from keyrange
QDataset data1 = q.getDataset("PRAGUESE/PX");

//get dataset between two sets of dates... don't forget to use this format for the date.
QDataset data2 = q.getDatasetBetweenDates("PRAGUESE/PX","2012-01-01","2012-11-26");

This version lets you set your custom parameters. You can pick from any parameters on the Quandl API page.

//get dataset with custom parameters
HashMap<String, String> params = new HashMap<String, String>();
params.put("trim_start","2012-09-30");
QDataset data3 = q.getDatasetWithParams("PRAGUESE/PX");

A few examples of extracting the data from a QDataset.

//get Dataset as List matrix
List<List<String>> data3Matrix = data3.getMatrix();

//get Dataset as String Matrix
String[][] data3StringMatrix = data3.getStringMatrix();

To build, simply run:

mvn package

And Jars will be availible in target/. Note that this does not run remote tests. To run all tests, including hitting Quandl's API and verifying the response, run:

mvn integration-test

quandl-java's People

Contributors

dimo414 avatar iamtrask avatar

Watchers

 avatar

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.