npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@gviper/alphavantage-api

v1.0.2

Published

TypeScript SDK for Alpha Vantage API with comprehensive type safety and all endpoint support

Downloads

50

Readme

📊 Alpha Vantage API SDK

npm version TypeScript License: MIT

⚠️ IMPORTANT NOTICE: This SDK was generated using Claude Code AI. While most functionality has been verified, please thoroughly test all features in your specific use case before production deployment. Users should validate API responses and error handling according to their requirements.

A professional TypeScript SDK for the Alpha Vantage Financial API featuring complete endpoint coverage, full type safety, and enterprise-grade reliability.

🌟 Key Features

  • 🎯 Complete Coverage — All Alpha Vantage API endpoints with consistent interface
  • 🔒 Type Safety — Full TypeScript support with strict mode compliance
  • ⚡ Modern Architecture — Built with latest TypeScript best practices
  • 🔑 Secure Authentication — Built-in API key management and validation
  • 📊 Rich Data Types — Comprehensive type definitions for all response formats
  • 🚀 Developer Experience — IntelliSense support and detailed error handling

🚀 Quick Start

Installation

# npm
npm install @gviper/alphavantage-api

# pnpm
pnpm add @gviper/alphavantage-api

# yarn
yarn add @gviper/alphavantage-api

Quick Setup

import { AlphaVantage } from '@gviper/alphavantage-api';

// Initialize with your API key - all endpoints ready to use
const av = new AlphaVantage({ 
  apiKey: process.env.ALPHA_VANTAGE_API_KEY 
});

// Start using immediately
const stockData = await av.stocks.daily({ symbol: 'AAPL' });
const companyInfo = await av.fundamental.companyOverview({ symbol: 'AAPL' });
const exchangeRate = await av.forex.exchangeRate({ 
  from_currency: 'USD', 
  to_currency: 'EUR' 
});

📈 API Coverage

📊 Stock Market Data

// Real-time and historical stock prices
const intradayData = await stocks.intraday({ 
  symbol: 'AAPL', 
  interval: '5min' 
});

const dailyData = await stocks.daily({ symbol: 'AAPL' });
const weeklyData = await stocks.weekly({ symbol: 'AAPL' });
const monthlyData = await stocks.monthly({ symbol: 'AAPL' });

🏢 Fundamental Analysis

// Company financials and metrics
const overview = await fundamental.companyOverview({ symbol: 'AAPL' });
const income = await fundamental.incomeStatement({ symbol: 'AAPL' });
const balance = await fundamental.balanceSheet({ symbol: 'AAPL' });
const cashflow = await fundamental.cashFlow({ symbol: 'AAPL' });
const earnings = await fundamental.earnings({ symbol: 'AAPL' });

💱 Foreign Exchange

// Currency exchange rates and data
const rate = await forex.exchangeRate({ 
  from_currency: 'USD', 
  to_currency: 'EUR' 
});

const fxIntraday = await forex.intraday({ 
  from_symbol: 'EUR', 
  to_symbol: 'USD', 
  interval: '5min' 
});

₿ Cryptocurrency

// Digital currency market data
const btcDaily = await crypto.daily({ 
  symbol: 'BTC', 
  market: 'USD' 
});

const cryptoRate = await crypto.exchangeRate({ 
  from_currency: 'BTC', 
  to_currency: 'USD' 
});

📊 Technical Indicators

// 50+ technical analysis indicators
const sma = await technicals.sma({ 
  symbol: 'AAPL', 
  interval: 'daily', 
  time_period: 20, 
  series_type: 'close' 
});

const rsi = await technicals.rsi({ 
  symbol: 'AAPL', 
  interval: 'daily', 
  time_period: 14, 
  series_type: 'close' 
});

const macd = await technicals.macd({ 
  symbol: 'AAPL', 
  interval: 'daily', 
  series_type: 'close' 
});

🏛️ Economic Indicators

// Macroeconomic data
const gdp = await economic.realGDP();
const cpi = await economic.cpi();
const unemployment = await economic.unemployment();
const federalFunds = await economic.federalFundsRate();

🔍 Market Intelligence

// News sentiment and market insights
const sentiment = await intelligence.newsSentiment({ 
  tickers: 'AAPL,TSLA' 
});

const topGainers = await intelligence.topGainersLosers();

🛢️ Commodities & Options

// Commodity prices
const oil = await commodities.crudeOilWTI();
const gold = await commodities.copper();

// Options data
const optionsData = await options.realtime({ symbol: 'AAPL' });

🔧 Utilities

// Search and lookup tools
const search = await util.symbolSearch({ keywords: 'Microsoft' });
const listing = await util.listingStatus();

📚 API Reference

Available Endpoint Modules

| Module | Description | Key Methods | |--------|-------------|-------------| | Stocks | Real-time & historical stock data | intraday(), daily(), weekly(), monthly() | | Fundamental | Company financials & metrics | companyOverview(), incomeStatement(), balanceSheet() | | Forex | Foreign exchange rates | exchangeRate(), intraday(), daily() | | Crypto | Cryptocurrency market data | daily(), weekly(), monthly(), exchangeRate() | | Technicals | 50+ technical indicators | sma(), rsi(), macd(), bbands(), adx() | | Economic | Macroeconomic indicators | realGDP(), cpi(), unemployment(), inflation() | | Intelligence | Market news & sentiment | newsSentiment(), topGainersLosers() | | Options | Options market data | realtime() | | Commodities | Commodity prices | crudeOilWTI(), naturalGas(), copper() | | Util | Search & utility functions | symbolSearch(), listingStatus() |

Type Safety

All methods include comprehensive TypeScript definitions:

// Full IntelliSense support
const data = await stocks.intraday({
  symbol: 'AAPL',     // string (required)
  interval: '5min',   // '1min' | '5min' | '15min' | '30min' | '60min'
  adjusted: true,     // boolean (optional)
  extended_hours: true, // boolean (optional)
  month: '2024-01',   // string (optional)
  outputsize: 'full'  // 'compact' | 'full' (optional)
});

🛡️ Error Handling

The SDK provides structured error handling for common API scenarios:

try {
  const data = await stocks.daily({ symbol: 'INVALID' });
} catch (error) {
  if (error.message.includes('Invalid API call')) {
    console.log('Invalid symbol or API parameters');
  } else if (error.message.includes('API call frequency')) {
    console.log('Rate limit exceeded');
  }
}

🔑 Authentication

Get your free API key from Alpha Vantage:

// Environment variable (recommended)
const client = new AlphaVantageClient({ 
  apiKey: process.env.ALPHA_VANTAGE_API_KEY 
});

// Direct assignment (for testing only)
const client = new AlphaVantageClient({ 
  apiKey: 'YOUR_API_KEY_HERE' 
});

📦 Requirements

  • Node.js: 16.0+
  • TypeScript: 4.5+ (for TypeScript projects)
  • Alpha Vantage API Key: Get yours free

🤝 Contributing

This package is part of a monorepo. Please refer to the root README for development guidelines and contribution instructions.

📄 License

MIT License - see the LICENSE file for details.


Alpha Vantage APIDocumentationGet API Key