Git Product home page Git Product logo

node-quandl's Introduction

node-quandl

##About

###Description A nodejs module for interacting with the Quandl API.

###Author Norman Joyner - [email protected]

##Getting Started

###Installation npm install quandl

###Configuration Simply require the quandl module, instantiate a new Quandl object, configure it if necessary, and start making calls. The auth token and api version are configurable.

New Quandl objects can be instantiated with configuration parameters. Here is an example:

var Quandl = require("quandl");
var quandl = new Quandl({
    auth_token: "dsahFHUiewjjd",
    api_version: 3,
    proxy: "http://myproxy:3128"
});

Quandl objects can also be configured via the .configure(options) method. Here is an exmaple:

var Quandl = require("quandl");
var quandl = new Quandl();

var options = {
    auth_token: "dsahFHUiewjjd"
}

quandl.configure(options);

The auth_token parameter defaults to undefined (anonymous access). Be aware of the Quandl Usage Rules. The api_version parameter defaults to 3, for v3 api access. The proxy parameter routes all requests through the specfied proxy.

###Supported API versions

  • v1
  • v3

###Supported API Methods

###Examples Fetch Mt. Gox Bitcoin dataset, and print response:

quandl.dataset({ source: "BITCOIN", table: "MTGOXUSD" }, function(err, response){
    if(err)
        throw err;

    console.log(response);
});

Fetch dataset metadata, and print response:

quandl.metadata("ZILLOW", "ZIP_ALLHOMES_15235", function(err, response){
    if(err)
        throw err;

    console.log(response);
});

Search for datasets pertaining to "crude oil", and print xml response:

quandl.search("crude oil", { format: "xml" }, function(err, response){
    console.log(err);
    console.log(response);
});

###Passing Search Parameters It's possible to make simple transformations of the data prior to retrieving it. For example, you can trim the data by excluding certain fields, slice the data using start and end dates, and even sort the data in ascending or descending order.

In the following example, only the closing prices for Facebook between January 30, 2015 and January 29, 2016 are retrieved. In this case, the closing prices are presented in ascending order.

var quandl = new Quandl({
  auth_token: "MY API TOKEN",
  api_version: 3
});

quandl.dataset({
  source: "WIKI",
  table: "FB"
}, {
  order: "asc",
  exclude_column_names: true,
  // Notice the YYYY-MM-DD format
  start_date: "2015-01-30",
  end_date: "2016-01-29",
  column_index: 4
}, function(err, response){
    if(err)
        throw err;

    console.log(response);
});

You can customize the dataset object by adding extra parameters. For more information about these optional parameters, please take a look at Quandl's API Docs.

If you don't want to hard code the start and/or end dates, use Moment to capture and manipulate the current date and time.

###Running Tests npm test

node-quandl's People

Contributors

normanjoyner avatar stephenmayeux avatar

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  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  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  avatar  avatar  avatar

node-quandl's Issues

ES6

Can this library be used with ES6?

passing options

Is it possible to pass additional options when I instantiate the Quandl object? I'd really like the data to be displayed in ascending order, and I only want the date and closing stock prices. I can achieve this by making a simple GET request in jQuery:

https://www.quandl.com/api/v3/datasets/WIKI/FB.json?order=asc&exclude_column_names=true&start_date=2015-01-30&end_date=2016-01-29&column_index=4

But I can't find anywhere in the docs that show me how to limit and configure my results using the node module. I tried this:

var quandl = new Quandl({
  auth_token: 'MY API TOKEN',
  api_version: 3,
  order: 'asc',
  exclude_column_names: true,
  start_date: '2015-01-30',
  end_date: '2016-01-29',
  column_index: 4
});

But the additional options do not change the output.

Please let me know if it's possible, and thank you!

search dataset on the basis of database

This is the basic code for searching a dataset

quandl.search("crude oil", { format: "xml" }, function(err, response){ console.log(err); console.log(response); })

It will result in dataset corresponding to crude oil in all the databases.

How we can make a search for a dataset in particular database say yahoo.
for example search crude oil in yahoo or ZEP database

getaddrinfo ENOTFOUND error

While giving the code examples provided a go. The following error popped up:

{ [Error: getaddrinfo ENOTFOUND] code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'getaddrinfo' }
undefined

Module not found

Following error when used in a project created with Vue-CLI:

quandl sync?9281:2 Uncaught Error: Cannot find module '//quandl'
    at webpackEmptyContext (eval at ./node_modules/quandl sync recursive (app.js:1765), <anonymous>:2:10)
    at Object.eval (main.js?a574:2)
    at eval (main.js:11)
    at Object../node_modules/quandl/main.js (app.js:1776)
    at __webpack_require__ (app.js:724)
    at fn (app.js:101)
    at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/QuandlData.vue?vue&type=script&lang=js&:2)
    at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/QuandlData.vue?vue&type=script&lang=js& (app.js:840)
    at __webpack_require__ (app.js:724)
    at fn (app.js:101)

Is this a problem with webpack?

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.