Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alphavantage

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alphavantage - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/init.js

4

lib/data.js

@@ -19,4 +19,4 @@ 'use strict';

*/
const timeSeries = fn => (symbol, interval = 1, size = `compact`, type = `json`) =>
request.get(util.url(fn, symbol, interval.toString().concat('min'), size, type)).then(data => JSON.parse(data));
const timeSeries = fn => (symbol, size = `compact`, type = `json`, interval = 1) =>
request.get(util.url(fn, symbol, size, type, interval.toString().concat('min'))).then(data => JSON.parse(data));

@@ -23,0 +23,0 @@ return {

@@ -11,4 +11,2 @@ 'use strict';

* The stock symbol to use
* @param {String} interval
* The time interval to use
* @param {String} size

@@ -18,2 +16,4 @@ * The data size to get

* The data type to fetch
* @param {String} interval
* The time interval to use
*

@@ -23,10 +23,10 @@ * @returns {String}

*/
url: (fn, symbol, interval, size, type) =>
url: (fn, symbol, size, type, interval = undefined) =>
`${config.base}${[
`function=${fn}`,
`symbol=${symbol}`,
`interval=${interval}`,
`outputsize=${size}`,
`datatype=${type}`
].join('&')}`
`datatype=${type}`,
`interval=${interval}`
].filter(value => value !== undefined).join('&')}`
});
{
"name": "alphavantage",
"version": "0.0.1",
"version": "0.0.2",
"description": "A simple interface to the Alpha Vantage API.",

@@ -11,3 +11,4 @@ "main": "index.js",

"test": "jest",
"lint": "prettier --print-width 120 --single-quote --write \"./**/**.js\""
"lint": "prettier --print-width 120 --single-quote --write \"./**/**.js\"",
"coverage": "jest --coverage"
},

@@ -29,2 +30,5 @@ "keywords": [

"homepage": "https://github.com/zackurben/alphavantage",
"engines": {
"node": ">=6.0.0"
},
"dependencies": {

@@ -41,4 +45,6 @@ "request": "^2.81.0",

"verbose": true,
"testMatch": ["**/test/**.js"]
"testMatch": [
"**/test/**.js"
]
}
}

@@ -1,3 +0,91 @@

# WIP
# AlphaVantage
This is a WIP project for utilizing the Alpha Vantage API
```
Note: This is a WIP
```
This is a simple wrapper around the [Alpha Vantage API](https://www.alphavantage.co/documentation/). I have no affiliation with AlphaAdvantage.
All contributions are welcome! This is an open source project under the MIT license, see [LICENSE.md](LICENSE.md) for
additional information.
**Checkout the [API DOCS](/DOCS.md) for full API documentation**
### Roadmap
- [x] View basic symbol data
- [x] Add code linting
- [x] Add code coverage
- [x] Add documentation
- [x] Add more test coverage
- [ ] Add CI/CD support
- [ ] Add Sector Performance data
- [ ] Add Technical indicators data
- [ ] Add utils to clean up response data
#### Installation
```bash
npm i alphavantage
```
#### Usage
```javascript
/**
* Init alphavantage with your API key.
*
* @param {String} key
* Your AlphaVantage API key.
*/
const alpha = require('alphavantage')({ key: 'qweqweqwe' });
/**
* Data functions: Short term
*
* Types available: intraday
*
* All of the data functions have the same signature:
* alpha.data.intraday(symbol [, size [, type [, interval]]])
*
* @param {String} symbol
* The stock ticker symbol to get data for.
* @param [String] size
* The result size to fetch. Available: compact (last 100pts) and full (all, very large).
* @param [String] type
* The datatype to getch. Available: json and csv
* @param [Number] interval
* The time interval (mins) inbetween data points. Available: 1, 5, 15, 30, and 60
*
* @returns {Promise}
* The request promise.
*/
alpha.data.intraday(`msft`).then(data => {
console.log(data);
});
/**
* Data functions: Long Term
*
* Types available: daily, adjusted, weekly, and monthly
*
* All of the data functions have the same signature:
* alpha.data.<type>(symbol [, size [, type]])
*
* @param {String} symbol
* The stock ticker symbol to get data for.
* @param [String] size
* The result size to fetch. Available: compact (last 100pts) and full (all, very large).
* @param [String] type
* The datatype to getch. Available: json and csv
*
* @returns {Promise}
* The request promise.
*/
alpha.data.<type>(`msft`).then(data => {
console.log(data);
});
```
#### Contact
- Author: Zack Urben
- Twitter: https://twitter.com/zackurben (better)
- Contact: zackurben@gmail.com
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc