mcpField
S
stock-historical-index

stock-historical-index

github.com/octagonaiData & databases130253 installsUpdated 21w ago
Repository

About stock-historical-index

A skill for retrieving historical end-of-day price data for market indices through Octagon MCP. It supports market trend, return, volume, and volatility analysis over a chosen date range.

Key features

  1. 01Query index data by symbol and date range
  2. 02Retrieve daily OHLCV and VWAP fields
  3. 03Review daily changes and trading volume
  4. 04Analyze returns, trends, and volatility

Use cases

  1. 01Check market performance during a selected period
  2. 02Compare historical returns across indices
  3. 03Identify large moves and high-volume days
  4. 04Put an individual stock move in market context

MCP support

Requires Octagon MCP configured in an AI agent and uses the `octagon-agent` tool on `octagon-mcp` to retrieve index data.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/octagonai/skills --skill stock-historical-index

After installing, type/stock-historical-indexin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

marketplace.json
README.md
references/
interpreting-results.md
mcp-setup.md

Details

From the project README

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 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:

{
  "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:

DateOpenHighLowCloseVolumeChangeChange %VWAP
2025-04-305,499.445,581.845,433.245,569.075.45B+69.63+1.27%5,520.90
2025-04-295,508.875,571.955,505.705,560.824.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 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
SymbolIndexDescription
^GSPCS&P 500500 large-cap US stocks
^DJIDow Jones30 blue-chip stocks
^IXICNASDAQ CompositeAll NASDAQ stocks
^NDXNASDAQ 100100 largest NASDAQ
^RUTRussell 20002000 small-cap stocks
Sector Indices
SymbolIndexDescription
^XLKTechnologyTech sector
^XLFFinancialsFinancial sector
^XLVHealthcareHealthcare sector
^XLEEnergyEnergy sector
^XLIIndustrialsIndustrial sector
Volatility Indices
SymbolIndexDescription
^VIXVIXMarket volatility
^VXNVXNNASDAQ volatility

Understanding Index Data

Price Components
FieldDescription
OpenFirst trade price of day
HighHighest price of day
LowLowest price of day
CloseLast trade price of day
VolumeTotal shares traded
ChangePoint change from prior close
Change %Percentage change
VWAPVolume-weighted average price
Daily Range Analysis
MetricCalculation
Daily RangeHigh - Low
Range %(High - Low) / Open
Position in Range(Close - Low) / (High - Low)

Return Calculations

Period Returns
PeriodFormula
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
PatternInterpretation
High volume + upStrong buying
High volume + downStrong selling
Low volume + upWeak rally
Low volume + downLack of sellers
Volume Metrics
MetricPurpose
Average daily volumeBaseline
Volume spikeUnusual activity
Volume trendParticipation 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
PatternCharacteristics
UptrendHigher highs, higher lows
DowntrendLower highs, lower lows
ConsolidationRange-bound
ReversalTrend change
Moving Averages
MAUse
50-dayShort-term trend
200-dayLong-term trend
Golden Cross50 > 200 (bullish)
Death Cross50 < 200 (bearish)

Volatility Analysis

Measuring Volatility
MetricCalculation
Daily Range %(High - Low) / Close
Daily ChangeAbsolute daily change
Std DeviationDispersion 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
CriteriaThreshold
Big up day>2% gain
Big down day>2% loss
Volume spike>2x average
Range expansion>2x normal range
Event Analysis
From DataEvent
+9.90% on Apr 9Major rally
-4.12% on Apr 4Significant selloff
9.49B volumeHighest participation

Benchmarking Use

Stock vs. Index
ComparisonFormula
AlphaStock Return - Index Return
BetaStock Vol / Index Vol × Correlation
Relative StrengthStock / 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

SkillCombined Use
stock-performanceStock vs. index comparison
sector-performance-snapshotSector vs. index
stock-quoteCurrent vs. historical
historical-market-capMarket cap vs. index

Comments

Markdown supported