Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
alpha-vantage-cli
Advanced tools
A command line app and Node.js api for retreiving data from Alpha Vantage.
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(http://www.the-data-wrangler.com/acquiring-stock-market-data-from-alpha-vantage/).
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
The examples that follow use the 'demo' API key, please be aware that this has very limited usage.
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:
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:
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:
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
Here are examples of use from a JavaScript code file. Don't forget to replace the API key with your own!
S
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 is very similar to JavaScript, but with the added advantage of static types and better intellisense in Visual Studio Code!
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);
});
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);
});
A blog post is coming soon that describes how this works!
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
If you are interested to get into TypeScript please take a look at my no-frills minimal Node.js typescript starter project.
FAQs
A command line app and Node.js api for retreiving data from Alpha Vantage.
The npm package alpha-vantage-cli receives a total of 14 weekly downloads. As such, alpha-vantage-cli popularity was classified as not popular.
We found that alpha-vantage-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.