Skip to main content
skill CX Codex

stock-historical-index — Claude Code skill: market index history

stock-historical-index — a skill to fetch full daily price history for market indices via Octagon MCP. Runs when analyzing index performance, calculating returns, and benchmarking individual stocks against the market.

MIT 259 installs ★ 132 updated 2026-06-05

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add OctagonAI/skills --skill stock-historical-index -a claude-code
Open on GitHub

What stock-historical-index does

Available on Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode. The skill retrieves historical closing prices for any index—S&P 500, Dow Jones, NASDAQ, Russell 2000, or sector indices (Technology, Healthcare, etc.)—across any date range. It returns a complete daily table: date, open, high, low, close, volume, change, and VWAP. Octagon MCP must be installed on your agent.

For example, pulling S&P 500 data over a quarter yields 79 trading days with top moves (+9.90% up, -4.12% down) and peak volume. Use it to calculate period returns, spot volatility spikes, and compare your stock's alpha against the benchmark. The skill simply passes your query to the MCP; no setup needed beyond the index ticker (^GSPC for S&P, ^DJI for Dow) and date range.

What it helps with

  • fetch full index price history for any date range
  • calculate index returns and volatility metrics
  • measure stock performance relative to the market
  • identify peak volume days and largest price moves
  • detect trends and support-resistance levels

Example prompts for the agent

  • Get the full S&P 500 history for this year and show me the quarterly return
  • Fetch ^IXIC (NASDAQ) daily prices for the last 12 months
  • Load ^XLK (Technology sector) data from June 2024 to June 2025 to compare against my holdings

How to install stock-historical-index

1Skills CLI (Vercel)

npx skills add OctagonAI/skills --skill stock-historical-index -a claude-code

2Manually: put the files in place

~/.claude/skills/stock-historical-index/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/stock-historical-index/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about stock-historical-index

How do I install stock-historical-index in Claude Code?

Run npx skills add OctagonAI/skills --skill stock-historical-index -a claude-code, then open the skill config at ~/.claude/skills/stock-historical-index/SKILL.md.

What does stock-historical-index do?

It retrieves full daily price history for any market index—S&P 500, Dow, NASDAQ, Russell 2000, or sector indices. The output is a table with open, high, low, close, volume, and calculated fields (change, VWAP).

Which indices can I query?

Any index with a known ticker: major ones are ^GSPC (S&P 500), ^DJI (Dow Jones), ^IXIC (NASDAQ), ^RUT (Russell 2000); sector indices include ^XLK (Tech), ^XLF (Finance), ^XLV (Healthcare); volatility indices are ^VIX.

Source text

SKILL.md · MIT
---
name: stock-historical-index
description: Retrieve full historical end-of-day price data for market indices using Octagon MCP. Use when analyzing index performance over time, tracking market trends, calculating returns, and understanding market context for individual stock analysis.
---

# Stock Historical Index

Retrieve full historical end-of-day price data for market indices using the Octagon MCP server.

## Prerequisites

Ensure Octagon MCP is configured in your AI agent (Cursor, Claude Desktop, Windsurf, etc.). See [references/mcp-setup.md](references/mcp-setup.md) for installation instructions.

## Workflow

### 1. Identify Parameters

Determine your query parameters:
- **Index Symbol**: ^GSPC (S&P 500), ^DJI (Dow), ^IXIC (NASDAQ), etc.
- **Start Date**: Beginning of date range
- **End Date**: End of date range

### 2. Execute Query via Octagon MCP

Use the `octagon-agent` tool with a natural language prompt:

```
Retrieve full historical end-of-day price data for the <INDEX> index from <START_DATE> to <END_DATE>.
```

**MCP Call Format:**

```json
{
  "server": "octagon-mcp",
  "toolName": "octagon-agent",
  "arguments": {
    "prompt": "Retrieve full historical end-of-day price data for the ^GSPC index from 2025-01-01 to 2025-04-30."
  }
}
```

### 3. Expected Output

The agent returns comprehensive daily index data:

| Date | Open | High | Low | Close | Volume | Change | Change % | VWAP |
|------|------|------|-----|-------|--------|--------|----------|------|
| 2025-04-30 | 5,499.44 | 5,581.84 | 5,433.24 | 5,569.07 | 5.45B | +69.63 | +1.27% | 5,520.90 |
| 2025-04-29 | 5,508.87 | 5,571.95 | 5,505.70 | 5,560.82 | 4.75B | +51.95 | +0.94% | 5,536.84 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |

**Key Statistics**:
- Highest single-day volume: 9.49B on 2025-04-09
- Largest daily gain: +9.90% on 2025-04-09
- Largest daily loss: -4.12% on 2025-04-04
- Trading days covered: 79

**Data Sources**: octagon-stock-data-agent

### 4. Interpret Results

See [references/interpreting-results.md](references/interpreting-results.md) for guidance on:
- Analyzing index price trends
- Calculating period returns
- Understanding volume patterns
- Identifying significant market moves

## Example Queries

**S&P 500 History:**
```
Retrieve full historical end-of-day price data for the ^GSPC index from 2025-01-01 to 2025-04-30.
```

**NASDAQ Composite:**
```
Get historical data for ^IXIC from 2024-01-01 to 2024-12-31.
```

**Dow Jones:**
```
Show ^DJI historical prices for Q1 2025.
```

**Russell 2000:**
```
Retrieve historical data for ^RUT from 2024-06-01 to 2025-06-01.
```

**Multiple Indices:**
```
Compare ^GSPC and ^IXIC performance from 2025-01-01 to 2025-03-31.
```

## Common Index Symbols

### US Major Indices

| Symbol | Index | Description |
|--------|-------|-------------|
| ^GSPC | S&P 500 | 500 large-cap US stocks |
| ^DJI | Dow Jones | 30 blue-chip stocks |
| ^IXIC | NASDAQ Composite | All NASDAQ stocks |
| ^NDX | NASDAQ 100 | 100 largest NASDAQ |
| ^RUT | Russell 2000 | 2000 small-cap stocks |

### Sector Indices

| Symbol | Index | Description |
|--------|-------|-------------|
| ^XLK | Technology | Tech sector |
| ^XLF | Financials | Financial sector |
| ^XLV | Healthcare | Healthcare sector |
| ^XLE | Energy | Energy sector |
| ^XLI | Industrials | Industrial sector |

### Volatility Indices

| Symbol | Index | Description |
|--------|-------|-------------|
| ^VIX | VIX | Market volatility |
| ^VXN | VXN | NASDAQ volatility |

## Understanding Index Data

### Price Components

| Field | Description |
|-------|-------------|
| Open | First trade price of day |
| High | Highest price of day |
| Low | Lowest price of day |
| Close | Last trade price of day |
| Volume | Total shares traded |
| Change | Point change from prior close |
| Change % | Percentage change |
| VWAP | Volume-weighted average price |

### Daily Range Analysis

| Metric | Calculation |
|--------|-------------|
| Daily Range | High - Low |
| Range % | (High - Low) / Open |
| Position in Range | (Close - Low) / (High - Low) |

## Return Calculations

### Period Returns

| Period | Formula |
|--------|---------|
| Daily | (Close - Prior Close) / Prior Close |
| Weekly | (Friday Close - Monday Open) / Monday Open |
| Monthly | (Month End - Month Start) / Month Start |
| YTD | (Current - Year Start) / Year Start |

### Example

From the data:
- Start (Jan 2): 5,868.56
- End (Apr 30): 5,569.07
- Return: (5,569.07 - 5,868.56) / 5,868.56 = -5.10%

### Cumulative Returns

```
Cumulative = (1 + r1) × (1 + r2) × ... × (1 + rn) - 1
```

## Volume Analysis

### Volume Patterns

| Pattern | Interpretation |
|---------|----------------|
| High volume + up | Strong buying |
| High volume + down | Strong selling |
| Low volume + up | Weak rally |
| Low volume + down | Lack of sellers |

### Volume Metrics

| Metric | Purpose |
|--------|---------|
| Average daily volume | Baseline |
| Volume spike | Unusual activity |
| Volume trend | Participation changes |

### Example

From the data:
- Highest volume: 9.49B on 2025-04-09
- This coincided with +9.90% gain (major rally)

## Trend Analysis

### Trend Identification

| Pattern | Characteristics |
|---------|-----------------|
| Uptrend | Higher highs, higher lows |
| Downtrend | Lower highs, lower lows |
| Consolidation | Range-bound |
| Reversal | Trend change |

### Moving Averages

| MA | Use |
|----|-----|
| 50-day | Short-term trend |
| 200-day | Long-term trend |
| Golden Cross | 50 > 200 (bullish) |
| Death Cross | 50 < 200 (bearish) |

## Volatility Analysis

### Measuring Volatility

| Metric | Calculation |
|--------|-------------|
| Daily Range % | (High - Low) / Close |
| Daily Change | Absolute daily change |
| Std Deviation | Dispersion of returns |

### Volatility Context

| Daily Change % | Market Condition |
|----------------|------------------|
| <0.5% | Low volatility |
| 0.5-1% | Normal |
| 1-2% | Elevated |
| >2% | High volatility |
| >4% | Extreme |

### Example

From the data:
- Largest gain: +9.90%
- Largest loss: -4.12%
- Range: 14.02%
- **Interpretation**: Period of elevated volatility

## Key Market Events

### Identifying Significant Days

| Criteria | Threshold |
|----------|-----------|
| Big up day | >2% gain |
| Big down day | >2% loss |
| Volume spike | >2x average |
| Range expansion | >2x normal range |

### Event Analysis

| From Data | Event |
|-----------|-------|
| +9.90% on Apr 9 | Major rally |
| -4.12% on Apr 4 | Significant selloff |
| 9.49B volume | Highest participation |

## Benchmarking Use

### Stock vs. Index

| Comparison | Formula |
|------------|---------|
| Alpha | Stock Return - Index Return |
| Beta | Stock Vol / Index Vol × Correlation |
| Relative Strength | Stock / Index |

### Example Use

- Your stock returned +15%
- S&P 500 returned -5.10%
- Alpha: +20.10% outperformance

## Common Use Cases

### Market Context
```
What was the overall market doing when my stock fell?
```

### Return Comparison
```
How did the S&P 500 perform in Q1 2025?
```

### Volatility Assessment
```
What were the biggest up and down days for the market in 2024?
```

### Trend Analysis
```
Is the market in an uptrend or downtrend?
```

### Volume Analysis
```
What were the highest volume days for the S&P 500?
```

## Analysis Tips

1. **Use for context**: Index performance explains stock moves.

2. **Calculate alpha**: Your returns vs. market.

3. **Watch volume**: High volume days are significant.

4. **Track extremes**: Big up/down days signal sentiment.

5. **Compare indices**: Different indices, different signals.

6. **Consider VIX**: Volatility index for fear gauge.

## Integration with Other Skills

| Skill | Combined Use |
|-------|--------------|
| stock-performance | Stock vs. index comparison |
| sector-performance-snapshot | Sector vs. index |
| stock-quote | Current vs. historical |
| historical-market-cap | Market cap vs. index |

© OctagonAI · MIT · OctagonAI/skills

Similar skills

All skills for Finance and business →

From the same set67

The whole set →
historical-market-cap A skill for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode that pulls historical market capitalization data for any stock ticker via Octagon MCP. CX Codex +1 260installs ratings-snapshot The ratings-snapshot skill fetches an overall rating and key financial metrics (DCF, ROE, ROA, debt-to-equity, P/E, P/B) for public companies. Use it to screen stocks by fundamentals and compare companies side by side. CX Codex +1 260installs sector-pe-ratios Retrieves sector P/E ratios across stock exchanges using Octagon MCP. Helps compare equity valuations against sector baselines. CX Codex +1 260installs sec-annual-comparison sec-annual-comparison compares financial metrics and risk factors between annual 10-K filings using Octagon MCP. Use it to analyze year-over-year changes in revenue, profitability, risks, and business strategy. CX Codex +1 259installs price-target-consensus price-target-consensus fetches consensus price targets for any stock: average, median, high and low analyst projections. Use it to evaluate upside potential and measure how widely analysts' views diverge. CX Codex +1 259installs sec-mda-analysis sec-mda-analysis parses MD&A sections from SEC 10-K and 10-Q filings through the Octagon MCP server to track corporate strategy and risks. CX Codex +1 258installs sec-8k-analysis sec-8k-analysis extracts material corporate events and disclosures from SEC 8-K filings using the Octagon MCP server. CX Codex +1 258installs price-target-summary price-target-summary is a skill that retrieves analyst consensus price targets for stocks via Octagon MCP, with trends by month, quarter, year and all time. CX Codex +1 258installs

Project sponsors

Companies that keep this analytics open