All Projects → ashleydavis → alpha-vantage-cli

ashleydavis / alpha-vantage-cli

Licence: MIT license
Command line tool and API for retrieving stock market data from Alpha Vantage

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Batchfile
5799 projects

Projects that are alternatives of or similar to alpha-vantage-cli

robinhood.tools
📈🤑💰 Advanced trading tools and resources for Robinhood Web.
Stars: ✭ 27 (-18.18%)
Mutual labels:  stock-market, stock-data, stock-trading
StockScreener
A handy tool for screening stocks based on certain criteria from several markets around the world. The list can then be delivered to your email address (one-off or regularly via crontab).
Stars: ✭ 51 (+54.55%)
Mutual labels:  stock-market, stock-data, stock-trading
insomnia-workspace
An Insomnia Workspace for Alpaca API
Stars: ✭ 34 (+3.03%)
Mutual labels:  stock-market, stock-trading
Tushare
TuShare is a utility for crawling historical data of China stocks
Stars: ✭ 11,288 (+34106.06%)
Mutual labels:  stock-market, stock-data
Stocky
Machine Learning Stock Trading Risk Analysis (Spring 2017)
Stars: ✭ 27 (-18.18%)
Mutual labels:  stock-data, stock-trading
Simplestockanalysispython
Stock Analysis Tutorial in Python
Stars: ✭ 126 (+281.82%)
Mutual labels:  stock-market, stock-data
Sumzerotrading
A Java API for Developing Automated Trading Applications for the Equity, Futures, and Currency Markets
Stars: ✭ 128 (+287.88%)
Mutual labels:  stock-market, stock-data
Deep Learning Machine Learning Stock
Stock for Deep Learning and Machine Learning
Stars: ✭ 240 (+627.27%)
Mutual labels:  stock-market, stock-data
Algobot
A C++ stock market algorithmic trading bot
Stars: ✭ 78 (+136.36%)
Mutual labels:  stock-market, stock-data
stockbot
Alpaca algo stock trading bot
Stars: ✭ 105 (+218.18%)
Mutual labels:  stock-market, stock-trading
intrinio-realtime-java-sdk
Intrinio Java SDK for Real-Time Stock Prices
Stars: ✭ 22 (-33.33%)
Mutual labels:  stock-market, stock-data
mftool
Python library for getting real-time Mutual Funds data in India
Stars: ✭ 76 (+130.3%)
Mutual labels:  stock-market, stock-data
IQFeed.CSharpApiClient
IQFeed.CSharpApiClient is fastest and the most well-designed C# DTN IQFeed socket API connector available
Stars: ✭ 103 (+212.12%)
Mutual labels:  stock-market, stock-data
Robinhood
Unofficial Documentation of Robinhood Trade's Private API
Stars: ✭ 1,569 (+4654.55%)
Mutual labels:  stock-market, stock-data
pyEX
Python interface to IEX and IEX cloud APIs
Stars: ✭ 407 (+1133.33%)
Mutual labels:  stock-market, stock-data
Technicalindicators
A javascript technical indicators written in typescript with pattern recognition right in the browser
Stars: ✭ 1,328 (+3924.24%)
Mutual labels:  stock-market, stock-data
Stocks.js
💰 stocks.js is an easy-to-use stock market API for Javascript
Stars: ✭ 240 (+627.27%)
Mutual labels:  stock-market, stock-data
MarketCycles.jl
Digital Signal Processing Indicators For Market Data.
Stars: ✭ 26 (-21.21%)
Mutual labels:  stock-market, stock-trading
Financedatabase
This is a database of 180.000+ symbols containing Equities, ETFs, Funds, Indices, Futures, Options, Currencies, Cryptocurrencies and Money Markets.
Stars: ✭ 554 (+1578.79%)
Mutual labels:  stock-market, stock-data
Intrinio Realtime Node Sdk
Intrinio NodeJS SDK for Real-Time Stock & Crypto Prices
Stars: ✭ 30 (-9.09%)
Mutual labels:  stock-market, stock-data

alpha-vantage-cli

This is a command line tool and small Node.js API for retreiving data from Alpha Vantage.

You can use this from the command line to download stock data from Alpha Vantage to a CSV file.

You can use it from your Node.js app as a reusable code module.

Data is returned as is from Alpha Vantage with no modification.

For more information please see my blog post on the Data Wrangler.

If you like this project, please star this repo and support my work

Getting an Alpha Vantage API key

Alpha Vantage is free, but to use it you must sign up for an API key. Please follow this link to sign up:

https://www.alphavantage.co/support/#api-key

For general guidance on working with financial market data, please refer to this finance API guide

The examples that follow use the 'demo' API key, please be aware that this has very limited usage.

Node.js installation

To use this tool you need to have Node.js installed. This is quite straight forward, please see the Node.js web site for more details:

http://nodejs.org/

Usage from the command line

alpha-vantage-cli's main purpose is to be used from the command line to download stock data to a CSV file.

Once you have Node.js installed you can install the command line tool via npm by running the following command:

npm install -g alpha-vantage-cli

This installs the tool globally so that you can run it from any directory.

Minimal usage looks like this:

alpha-vantage-cli --type=<data-type> --symbol=<code-for-the-instrument> --api-key=<your-api-key> 

Options:

  • --type -> The type of data to download (daily or intraday).
  • --symbol -> The symbol for the company or instrument you are interested in (eg MSFT)
  • --api-key -> Your Alpha Vantage API key.
  • --out -> Sets the name of the output file. CSV data is written to this file.

For example to download daily data for Microsoft:

alpha-vantage-cli --type=daily --symbol=MSFT --api-key=demo --out=MSFT-daily.csv

Or to download intraday data:

alpha-vantage-cli --type=intraday --symbol=MSFT --api-key=demo --out=MSFT-intraday.csv

Optional options:

  • --output-data-size -> Sets the output data size (full or compact).
  • --interval -> Sets the interval for intraday data (1min, 5min, 15min, 30min or 60min)
  • --verbose -> Display verbose information while the tool is running.
  • --version -> Display the version of the tool.
  • --help -> Display help.

Usage from a Node.js script

alpha-vantage-cli can also be imported into a Node.js script to be used from code.

To use please install locally in your Node.js project using npm as follows:

npm install --save alpha-vantage-cli

Usage from JavaScript

Here are examples of use from a JavaScript code file. Don't forget to replace the API key with your own!

Daily data

S

Intraday data

var AlphaVantageAPI = require('alpha-vantage-cli').AlphaVantageAPI;

var yourApiKey = 'demo';
var alphaVantageAPI = new AlphaVantageAPI(yourApiKey, 'compact', true);

alphaVantageAPI.getIntradayData('MSFT', '15min')
    .then(intradayData => {
        console.log("Intraday data:");
        console.log(intradayData);
    })
    .catch(err => {
        console.error(err);
    });

Usage from TypeScript

Usage from TypeScript is very similar to JavaScript, but with the added advantage of static types and better intellisense in Visual Studio Code!

Daily data

import { AlphaVantageAPI } from 'alpha-vantage-cli';

var yourApiKey = 'demo';
var alphaVantageAPI = new AlphaVantageAPI(yourApiKey, 'compact', true);

alphaVantageAPI.getDailyData('MSFT')
    .then(dailyData => {
        console.log("Daily data:");
        console.log(dailyData);
    })
    .catch(err => {
        console.error(err);
    });

Intraday data

import { AlphaVantageAPI } from 'alpha-vantage-cli';

var yourApiKey = 'demo';
var alphaVantageAPI = new AlphaVantageAPI(yourApiKey, 'compact', true);

alphaVantageAPI.getIntradayData('MSFT', '15min')
    .then(intradayData => {
        console.log("Intraday data:");
        console.log(intradayData);
    })
    .catch(err => {
        console.error(err);
    });

How it works

A blog post is coming soon that describes how this works!

Testing the code from the repository

ts-node cli.ts --type=daily --symbol=STW.AX --api-key=<put-your-api-key-here> --out=./test.csv

or

npm run test:daily
npm run test:intraday

TypeScript template

If you are interested to get into TypeScript please take a look at my no-frills minimal Node.js typescript starter project.

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