GnistAI GnistAI
Log in

Getting Started with Alpha Vantage (Finance)

Stock quotes, historical OHLCV, FX rates, and crypto prices.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Finance

Data source: Alpha Vantage

Overview

Alpha Vantage (Finance) wraps Alpha Vantage, handling authentication, pagination, and rate limits for you. This tutorial covers all 5 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-alpha-vantage": {
      "url": "https://context.gnist.ai/mcp/alpha-vantage/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (5)

get_price

Get the latest market quote for a stock or ETF. Uses Alpha Vantage (requires ALPHA_VANTAGE_API_KEY env var). Args: ticker: Stock ticker symbol (e.g. "AAPL", "TSLA", "SPY"). Returns: Latest price, open/high/low, volume, previous close, and change %.

ParameterTypeRequiredDescription
tickerstringrequiredStock ticker symbol (e.g. "AAPL", "TSLA", "SPY").
curl -X POST "https://context.gnist.ai/mcp/alpha-vantage/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_price", "arguments": {"ticker": "AAPL"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/alpha-vantage/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'ticker': 'AAPL'}, 'name': 'get_price'}},
)
print(resp.json())

get_historical

Get historical OHLCV data for a stock or ETF. Args: ticker: Stock ticker symbol (e.g. "AAPL", "MSFT"). start: Start date in YYYY-MM-DD format (inclusive). end: End date in YYYY-MM-DD format (inclusive). interval: Data interval — "daily", "weekly", or "monthly" (default: "daily"). Returns: Symbol, interval, count, and list of OHLCV entries (open, high, low, close, volume).

ParameterTypeRequiredDescription
tickerstringrequiredStock ticker symbol (e.g. "AAPL", "MSFT").
startstringrequiredStart date in YYYY-MM-DD format (inclusive).
endstringrequiredEnd date in YYYY-MM-DD format (inclusive).
intervalstringoptionalData interval — "daily", "weekly", or "monthly" (default: "daily"). (default: daily)
curl -X POST "https://context.gnist.ai/mcp/alpha-vantage/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_historical", "arguments": {"ticker": "AAPL", "start": "example", "end": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/alpha-vantage/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'end': 'example',
                          'start': 'example',
                          'ticker': 'AAPL'},
            'name': 'get_historical'}},
)
print(resp.json())

get_fx_rate

Get the daily exchange rate between two currencies. Uses ECB reference rates (updated daily ~16:00 CET on business days). Supports all major currencies. Cross-rates are derived from EUR-based data. Args: base: Base currency ISO 4217 code (e.g. "USD", "EUR", "GBP"). quote: Quote currency ISO 4217 code (e.g. "NOK", "JPY", "CHF"). Returns: Exchange rate (1 base = N quote), with the ECB reference date.

ParameterTypeRequiredDescription
basestringrequiredBase currency ISO 4217 code (e.g. "USD", "EUR", "GBP").
quotestringrequiredQuote currency ISO 4217 code (e.g. "NOK", "JPY", "CHF").
curl -X POST "https://context.gnist.ai/mcp/alpha-vantage/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_fx_rate", "arguments": {"base": "USD", "quote": "NOK"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/alpha-vantage/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'base': 'USD', 'quote': 'NOK'},
            'name': 'get_fx_rate'}},
)
print(resp.json())

get_crypto_price

Get the current price and market data for a cryptocurrency. Accepts common ticker symbols (e.g. "BTC", "ETH", "SOL") or CoinGecko IDs (e.g. "bitcoin", "ethereum"). Prices are in USD via CoinGecko's free API. Args: symbol: Cryptocurrency symbol (e.g. "BTC") or CoinGecko ID (e.g. "bitcoin"). Returns: Current USD price, market cap, and 24-hour change percentage.

ParameterTypeRequiredDescription
symbolstringrequiredCryptocurrency symbol (e.g. "BTC") or CoinGecko ID (e.g. "bitcoin").
curl -X POST "https://context.gnist.ai/mcp/alpha-vantage/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_crypto_price", "arguments": {"symbol": "BTC"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/alpha-vantage/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'symbol': 'BTC'}, 'name': 'get_crypto_price'}},
)
print(resp.json())

report_feedback

Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/alpha-vantage/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/alpha-vantage/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())

FAQ

What data does Alpha Vantage (Finance) provide?

Stock quotes, historical OHLCV, FX rates, and crypto prices. It exposes 5 tools: get_price, get_historical, get_fx_rate, get_crypto_price, report_feedback.

What do I need to get started?

A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.

What format does the Alpha Vantage (Finance) API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials