Giter Site home page Giter Site logo

mda's Introduction

mda

MDA JS API Library

A JavaScript library for accessing stock data from Alpha Vantage and Twelvedata APIs.

Installation

To install the library, run the following command:

npm install mda

Usage

In order to use the library, you will need to obtain API keys from Alpha Vantage and Twelvedata.

To use the library, require it in your project and create a new instance of the mda class:

const mda = require('mda');

const api = mda();

You can then set the API keys and default symbol as follows:

api.alfav_key = 'your_alphavantage_key'; api.twelve_key = 'your_twelvedata_key'; api.symbol = 'your_default_symbol';

Alpha Vantage

To fetch stock data from Alpha Vantage, use the getStockAPV method:

const data = await api.getStockAPV({ symbol: 'your_symbol', range: 'TIME_SERIES_INTRADAY', interval: '60' });

The getStockAPV method takes an optional object with the following properties:

symbol: "The symbol of the stock to fetch data for (defaults to the default symbol set on the mda instance)."
range:  "TIME_SERIES_INTRADAY"
interval: The interval of data to fetch. Possible values are 1min, 5min, 15min, 30min, 60min, daily, weekly, and monthly.

range could also be: TIME_SERIES_DAILY, TIME_SERIES_DAILY_ADJUSTED, TIME_SERIES_WEEKLY, TIME_SERIES_WEEKLY_ADJUSTED, TIME_SERIES_MONTHLY, and TIME_SERIES_MONTHLY_ADJUSTED.

Twelvedata

To fetch stock data from Twelvedata, use the getStock12D method:

const data = await api.getStock12D({ symbol: 'your_symbol', startdate: '2021-10-14', interval: '1h' });

The getStock12D method takes an optional object with the following properties:

symbol: The symbol of the stock to fetch data for (defaults to the default symbol set on the mda instance).
startdate: The start date for the data to fetch, in the format YYYY-MM-DD.
interval: The interval of data to fetch. Possible values are 1min, 5min, 15min, 30min, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 1w, and 1M.

Finhub

To fetch stock data from Twelvedata, use the getStock12D method:

const data = await api.getStockFH({ symbol: 'your_symbol', range: 1, interval: '60' });

RUN TEST

node -e 'var mda = require("./mda.js"); mda.finhub_key = "YOUR_KEY"; mda.alfav_key = "YOUR_KEY"; mda.twelve_key="YOUR_KEY"; mda.test()'

mda's People

Contributors

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