Git Product home page Git Product logo

meteor-finance's Introduction

Meteor Finance

Provides Meteor collections for common stock market instruments, allowing synced data with a market data provider, currently Yahoo Finance.

Overview

There are four collections provided by this package:

  • Stocks
  • Trades
  • Holdings
  • Dividends

There is an additional configuration object:

  • MarketDataProvider

Each collection is a raw Meteor collection, which is extended with methods listed below, in order to sync data pulled from market data provider.

Unless specified by an overriden method below, you can still call any of the methods for regular Meteor collections, as per the Meteor Docs.

MarketDataProvider

This allows you to configure your own market data provider by setting the provider URLs and field mappings.

YahooFinance

This is currently the default provider. The (unofficial) API can be viewed here and a full list of the stock field mappings can be found here.

Field Mappings currently provided can be viewed here.

Basic Usage

Instantiate a specific market data provider like so:

YahooFinance = new MarketDataProvider({
  fields: {
    'change'            : 'c1',
    'changePercent'     : 'p2',
    'daysRange'         : 'm',
    'dividendYield'     : 'y',
  },
  getDividends: function(symbols, startDate, endDate, callback) {
    ...
  },
  getStockQuotes: function(symbols, fields, callback) {
    ...
  },
  getHistoricPrices: function(symbols, startDate, endDate, callback) {
    ...
  }
};

Then call provider methods on the specific provider object:

YahooFinance.convertFields(['symbol', 'name']);

Methods

  • MarketDataProvider.convertField(field) - Takes a field name, e.g. 'symbol', returns the provider-specific field code, e.g. 's'.
  • MarketDataProvider.convertFields(fields) - Takes an array of field names, e.g. ['symbol', 'name'], returns an array of provider-specific field codes, e.g. ['s', 'n'].

Dividends

Collection Schema

{
  'symbol' : 'BHP.AX', // Valid Yahoo Finance ticker
  'date'   : new Date("Aug 9, 2013"), // JS Date object indicating the ex-dividend date
  'amount' : 0.64325 // Dividend amount
}

Methods

  • Dividends.refresh(selector, callback) - Asyncronously calls market data provider to refresh dividend info for dividends given by selector, which is any Mongo-style Selector. Upon completion, executes callback(error, results).

meteor-finance's People

Contributors

francisbyrne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jaymjordan

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.