Giter Site home page Giter Site logo

inductor.io's Introduction

StockPrices API

Include in your project (ECMA)

import StockPricesAPI from 'inductor.io';

Initialize Prices Database (via JSONL file format)

const api = new StockPricesAPI("/path/to/db.jsonl")

try {
    await api.init()
} catch (FileNotFoundError e) {
    console.log(e)
}

Retrieve Prices for Single Stock Ticker Symbol

const results = await api.getPricesSingle("AAPL")

console.log(results.prices)

// API Example Output
    {
        "dates": [
            "1/17/2014",
            "1/21/2014",
            "1/22/2014",
            "1/23/2014",
            "1/24/2014",
            "1/27/2014",
            "1/28/2014",
            "1/29/2014",
            "1/30/2014",
            "1/31/2014",
            "2/3/2014"
        ],
        "prices": [
            19.31,
            19.61,
            19.7,
            19.86,
            19.5,
            19.66,
            18.09,
            17.88,
            17.85,
            17.88,
            17.91
        ]
    }

Retrieve Prices for Single Stock Ticker Symbol within a Date Range (inclusive)

const results = await api.getPricesSingle("AAPL", "1/21/2014", "1/27/2014")

console.log(result.prices)

// API Example Output
    {
        "dates": [
            "1/21/2014",
            "1/22/2014",
            "1/23/2014",
            "1/24/2014",
            "1/27/2014"
        ],
        "prices": [
            19.61,
            19.7,
            19.86,
            19.5,
            19.66
        ]
    }

Retrieve Prices for Multiple Stock Ticker Symbols

const results = await api.getPricesMultiple(["AAPL", "MSFT"])

console.log(results.prices)

// API Example Output
    {
        "dates": [
            "1/17/2014",
            "1/21/2014",
            "1/22/2014",
            "1/23/2014",
            "1/24/2014",
            "1/27/2014",
            "1/28/2014"
        ],
        "prices": {
            "AAPL": [
                19.31,
                19.61,
                19.7,
                19.86,
                19.5,
                19.66,
                18.09
            ],
            "MSFT": [
                36.38,
                36.17,
                35.93,
                36.06,
                36.81,
                36.03,
                36.27
            ]
        }
    }

inductor.io's People

Contributors

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