All Projects → wagenaartje → Stocks.js

wagenaartje / Stocks.js

Licence: mit
💰 stocks.js is an easy-to-use stock market API for Javascript

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Stocks.js

Yahooquery
Python wrapper for an unofficial Yahoo Finance API
Stars: ✭ 288 (+20%)
Mutual labels:  api, stock-market, stock-data
Ystockquote
Fetch stock quote data from Yahoo Finance
Stars: ✭ 502 (+109.17%)
Mutual labels:  stock-market, stock-data
Stonks
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal. See how fast your stonks will crash.
Stars: ✭ 405 (+68.75%)
Mutual labels:  stock-market, stock-data
Intrinio Realtime Node Sdk
Intrinio NodeJS SDK for Real-Time Stock & Crypto Prices
Stars: ✭ 30 (-87.5%)
Mutual labels:  stock-market, stock-data
Pysnowball
雪球股票数据接口 python edition
Stars: ✭ 256 (+6.67%)
Mutual labels:  api, stock-data
Pyex
Python interface to IEX and IEX cloud APIs
Stars: ✭ 311 (+29.58%)
Mutual labels:  stock-market, stock-data
Iex Api
The IEX API provides any individual or academic, public or private institution looking to develop applications that require stock market data to access near real-time quote and trade data for all stocks trading on IEX.
Stars: ✭ 683 (+184.58%)
Mutual labels:  api, stock-market
stocktwits-sentiment
Stocktwits market sentiment analysis in Python with Keras and TensorFlow.
Stars: ✭ 23 (-90.42%)
Mutual labels:  stock-market, stock-data
Technicalindicators
A javascript technical indicators written in typescript with pattern recognition right in the browser
Stars: ✭ 1,328 (+453.33%)
Mutual labels:  stock-market, stock-data
Robinhood
Unofficial Documentation of Robinhood Trade's Private API
Stars: ✭ 1,569 (+553.75%)
Mutual labels:  stock-market, stock-data
Simplestockanalysispython
Stock Analysis Tutorial in Python
Stars: ✭ 126 (-47.5%)
Mutual labels:  stock-market, stock-data
robinhood.tools
📈🤑💰 Advanced trading tools and resources for Robinhood Web.
Stars: ✭ 27 (-88.75%)
Mutual labels:  stock-market, stock-data
Tushare
TuShare is a utility for crawling historical data of China stocks
Stars: ✭ 11,288 (+4603.33%)
Mutual labels:  stock-market, stock-data
Finance Go
📊 Financial markets data library implemented in go.
Stars: ✭ 392 (+63.33%)
Mutual labels:  stock-market, stock-data
GoPlan-app
An intuitive portfolio mangaer !
Stars: ✭ 27 (-88.75%)
Mutual labels:  stock-market, stock-data
Financedatabase
This is a database of 180.000+ symbols containing Equities, ETFs, Funds, Indices, Futures, Options, Currencies, Cryptocurrencies and Money Markets.
Stars: ✭ 554 (+130.83%)
Mutual labels:  stock-market, stock-data
stock-market-scraper
Scraps historical stock market data from Yahoo Finance (https://finance.yahoo.com/)
Stars: ✭ 110 (-54.17%)
Mutual labels:  stock-market, stock-data
getbhavcopy
Free NSE and BSE data downloader
Stars: ✭ 93 (-61.25%)
Mutual labels:  stock-market, stock-data
Algobot
A C++ stock market algorithmic trading bot
Stars: ✭ 78 (-67.5%)
Mutual labels:  stock-market, stock-data
Sumzerotrading
A Java API for Developing Automated Trading Applications for the Equity, Futures, and Currency Markets
Stars: ✭ 128 (-46.67%)
Mutual labels:  stock-market, stock-data

Stocks.js

Easy-to-use stocks API for Node.js and the browser

stocks.js allows easy retrieval of stock data - without having to pay a single dollar. The library uses Alpha Vantage as its data source. Next to regular time series data, there are a bunch of technical indicators that can be tracked with this library.

💡 This library is very new, so you might experience issues. If you do, please report them at the issues section.

This is an example of regular stock time series retrieval (click to run):

// Let's get the stock data of Tesla Inc. for the last 10 minutes
var result = await stocks.timeSeries({
  symbol: 'TSLA',
  interval: '1min',
  amount: 10
 });

And this is an example of how to retrieve a technical indicator (click to run):

// Let's get the directional movement index of Microsoft Corporation for the
// last 20 years, with 10 data points used to calculate every point
var result = await stocks.technicalIndicator({
  symbol: 'MSFT',
  interval: 'monthly',
  indicator: 'ADX',
  time_period: 10
});

Getting started

The first step is downloading the dist/stocks.js file to your local machine. Sadly, we don't host this file yet, but we will get to that soon. Link the file in your .html file:

<script src="stocks.js"></script>

You can also install stocks.js with npm (latest version required):

npm install stocks.js --save

Now you have to request your personal API Key at Alpha Vantage. Claim your API Key here. Now in another .js file, write the following code:

var stocks = new Stocks('XXXX'); // replace XXXX with your API Key

Basically, you're good to go! You can use any of the functions without a hassle now. View the Usage paragraph below to see how you can fetch data.

Usage

At this moment, stocks.js supports 3 stock market data functions. Be sure to read through the 'Getting Started' section before reading this!

stocks.timeSeries()

This function allows you to retrieve data from now, up to 20 years to the past. The basic usage is as follows:

var result = await stocks.timeSeries(options);

where options is an object containing any of the following options:

  • REQ symbol, the symbol of the stock you want to follow. An example of this is 'TLSA'. There is no list of symbols, I have requested a list at Alpha Vantage.
  • REQ interval, the interval of the data points you want to retrieve. Choose from any of the following intervals: '1min', '5min', '15min', '30min', '60min', 'daily', 'weekly' and 'monthly'. Intervals 1min-60min typically span back to the past 10 to 15 active trading days. Intervals daily-monthly span up to 20 years.
  • amount, the amount of data points to fetch. If not specified, will return all possible data points up to a maximum twenty years ago.
  • start & end, the start and end dates from which to get data from in between. Cannot be used in combination with the amount option. For any interval shorter than daily, specify intraday dates.

So an example of options could be:

var options = {
  symbol: 'AAPL',
  interval: 'weekly',
  amount: 52
};

Or to get data in between two dates (click to run):

var options = {
  symbol: 'TSLA',
  interval: 'daily',
  start: new Date('2017-07-01'),
  end: new Date('2017-07-09')
}

The result of such a request is an array with amount elements (or every element between start and end), every element is an object that includes the following keys and corresponding values:

close, high, low, open, volume, date

stocks.technicalIndicator()

This function allows you to fetch certain technical indicators regarding the stock. The basic usage is as follows:

var result = await stocks.technicalIndicator(options);

where options is an object containing any of the following options:

  • REQ symbol, the symbol of the stock you want to follow. An example of this is 'TLSA'. There is no list of symbols, I have requested a list at Alpha Vantage.
  • REQ indicator, the indicator of which you want to fetch data. The list of indicators can be found here.
  • REQ interval, the interval of the data points you want to retrieve. Choose from any of the following intervals: '1min', '5min', '15min', '30min', '60min', 'daily', 'weekly' and 'monthly'. Any interval shorter than daily will only fetch the data points of the current day.
  • REQ time_period, the time period to calculate certain indicators from. For example, if set to 10, the indicator value will be calculated using 10 data points. Does not affect all indicators.
  • amount, the amount of data points to fetch. If not specified, will return all possible data points up to a maximum twenty years ago.
  • start & end, the start and end dates from which to get data from in between. Cannot be used in combination with the amount option. For any interval shorter than daily, specify intraday dates.
  • series_type, can be either close, open, high or low. Not all indicators require this

So an example of options could be:

var options = {
  symbol: 'NOK',
  interval: '60min',
  amount: 24,
  time_period: 3,
  indicator: 'ADX'
};

The result of such a request is an array with amount elements, every element is an object that includes the following keys and corresponding values:

(indicator name), date

stocks.sectorPerformance()

This function will fetch the US sector performance calculated from S&P500 incumbents. The basic usage is as follows:

var result = await stocks.sectorPerformance(options);

where options is an object containing any of the following options:

  • REQ timespan, the timespan of which to get the sector performance. Choose from any of the following timespans: 'real-time', '1day', '5day', '1month', '3month', 'year-to-date', '1year', '3year', '5year', '10year'

So an example of options could be (click to run):

var options = {
  timespan: 'year-to-date'
};

The result of such a request will be an object containing the following values:

Utilities, Consumer Staples, Real Estate, Consumer Discretionary,
Communication Services, Materials, Financials, Health Care,
Information Technology, Industrials, Energy

Contributing

If you want to contribute to this project, please read the contributing guide over here. You can also participate in the discussions at the issues section, every opinion we can get is useful.

Further notices

All the data comes from Alpha Vantage, although they exist for some time now, it is quite unclear what their business model is. They also do not provide a lot of information on their sources and why an API Key is needed. So please note the risk that from one day to the other their service might stop.


You made it all the way down! If you appreciate this repo and want to support the development of it, please consider donating 👍 Donate

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].