Git Product home page Git Product logo

d3fc-financial-feed's Introduction

d3fc-financial-feed

An API for fetching financial time-series data from different sources including Quandl and GDAX.

Main d3fc package

Installing

npm install d3fc-financial-feed

API Reference

GDAX

import { feedGdax } from 'd3fc-financial-feed';

const gdax = feedGdax()
  .product('BTC-GBP');

gdax()
  .then(data => { console.log(data); });

// [
//   {
//     date: 2016-05-11T08:51:00.000Z,
//     open: 317.99,
//     high: 317.99,
//     low: 317.99,
//     close: 317.99,
//     volume: 0.24
//   },
//   ...
// ]

https://docs.gdax.com/#get-historic-rates

# fc.feedGdax()

Constructs a new GDAX feed.

# feedGdax()

Makes a request to the GDAX API, returns a Promise which resolves with data. Data returned from the API is mapped to an array of objects with numeric open, high, low, close and volume properties, and a Date instance date property.

# feedGdax.product([value])

If value is specified, sets the product id to the specified string and returns this feed instance. If value is not specified, returns the current product id, which defaults to "BTC-USD".

# feedGdax.start([value])

If value is specified, sets the start date to the specified Date object and returns this feed instance. If value is not specified, returns the current start date, which defaults to null.

# feedGdax.end([value])

If value is specified, sets the end date to the specified Date object and returns this feed instance. If value is not specified, returns the current end date, which defaults to null.

# feedGdax.granularity([value])

If value is specified, sets the granularity to the specified number of seconds and returns this feed instance. If value is not specified, returns the current granularity, which defaults to null.

Quandl

import { feedQuandl } from 'd3fc-financial-feed';

const quandl = feedQuandl()
  .database('WIKI')
  .dataset('AAPL')
  .rows(10)
  .descending(true)
  .collapse('weekly');

quandl()
  .then(data => { console.log(data); });

// [
//   {
//     date: 2016-05-15T00:00:00.000Z,
//     open: 93.33,
//     high: 93.57,
//     low: 92.11,
//     close: 93.39,
//     volume: 33217012,
//     'ex-Dividend': 0,
//     'split Ratio': 1,
//     'adj. Open': 93.33,
//     'adj. High': 93.57,
//     'adj. Low': 92.11,
//     'adj. Close': 93.39,
//     'adj. Volume': 33217012
//   },
//   ...
// ]

https://www.quandl.com/docs/api#datasets

# fc.feedQuandl()

Constructs a new quandl feed.

# feedQuandl()

Makes a request to the Quandl API, returns a Promise which resolves with data. Data returned from the API is mapped to an array of objects with properties for all non-null names mapped by feedQuandl.columnNameMap, with date column values converted to Date instances.

# feedQuandl.database([value])

If value is specified, sets the unique database code to the specified string and returns this feed instance. If value is not specified, returns the current database code, which defaults to "YAHOO".

# feedQuandl.dataset([value])

If value is specified, sets the unique dataset code to the specified string and returns this feed instance. If value is not specified, returns the current dataset code, which defaults to "GOOG".

# feedQuandl.apiKey([value])

If value is specified, sets the API key to the specified string and returns this feed instance. This is required for premium set or high frequency requests. If value is not specified, returns the current API key, which defaults to null.

# feedQuandl.start([value])

If value is specified, sets the start date to the specified Date object and returns this feed instance. If value is not specified, returns the current start date, which defaults to null.

# feedQuandl.end([value])

If value is specified, sets the end date to the specified Date object and returns this feed instance. If value is not specified, returns the current end date, which defaults to null.

# feedQuandl.rows([value])

If value is specified, sets the row limit to the specified number and returns this feed instance. If value is not specified, returns the current row limit, which defaults to null.

# feedQuandl.descending([value])

If value is specified, sets the ordering of the data (descending if true, ascending if false) and returns this feed instance. If value is not specified, returns the current ordering value, which defaults to false.

# feedQuandl.collapse([value])

If value is specified, sets the periodicity of the data ("none", "daily" | "weekly" | "monthly" | "quarterly" | "annual") and returns this feed instance. If value is not specified, returns the current periodicity, which defaults to null.

# feedQuandl.columnNameMap([value])

If value is specified, sets the function used to map Quandl column names to property names and returns this feed instance. If value is not specified, returns the current column name map, which defaults to feedQuandl.defaultColumnNameMap. If the supplied function returns null for a column, then that column will be omitted from the output data. Setting value to null will preserve the original column names.

# feedQuandl.defaultColumnNameMap

Returns the default column name mapping function. This function returns the supplied column name with a lower case first letter (e.g. it maps "Close" to "close").

d3fc-financial-feed's People

Contributors

alisd23 avatar chrisprice avatar colineberhardt avatar greenkeeperio-bot avatar jleft avatar tlsim avatar

Stargazers

 avatar  avatar

Watchers

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