# sp500 overnight vs intraday

> Does your stock earn its returns overnight or during the session? Check any ticker in seconds, or scan the whole S&P 500 in about a minute.

sp500 overnight vs intraday is a free AI agent skill on Agensi by Marcin Dec, in Research & Analysis. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Marcin Dec](https://www.agensi.io/creators/marcin-dec)
- Category: [Research & Analysis](https://www.agensi.io/skills/research-analysis)
- Version: 1.0
- Last updated: 2026-11-20
- Security: scan passed (2026-11-20); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/sp500-overnight-vs-intraday
- Tags: trading-investing, python, pandas, data-analysis, yfinance

## About this skill

Stock market returns are rarely distributed evenly throughout the day. This skill identifies whether a stock's performance is driven by overnight price gaps or intraday price action, helping you spot the overnight anomaly in the S&P 500.

### What it does
- **Performance splitting** calculates separate cumulative and annualized returns for overnight (close-to-open) and intraday (open-to-close) windows.
- **Statistical testing** runs Welch and Mann-Whitney U tests to compare return distributions across sectors, market caps, and beta levels.
- **Index-wide scanning** downloads and processes the entire S&P 500 to rank companies by their overnight vs. intraday dominance.
- **Volatility analysis** provides mean daily returns in basis points (bps) and calculates daily beta relative to SPY.
- **Visual reporting** generates a comprehensive dashboard with charts showing return divergence for the top performers.

### How it works
1. Run the script in **Quick Mode** by providing specific tickers to get immediate performance splits.
2. Execute a **Full Scan** to analyze the current S&P 500 index members for broader market anomalies.
3. Review the **JSON summary** to identify dominant return types and statistical significance (p-values).
4. Analyze the generated **CSV and Parquet** files for deeper data exploration or integration into other tools.

### Frameworks & tools
The skill utilizes Python 3.11 or 3.12 with `yfinance` for price data, `pandas` and `numpy` for vectorised returns, `scipy` for statistical tests, and `matplotlib` for data visualization.

### Why this beats prompting it yourself
Accurately compounding overnight returns requires precise handling of adjusted close prices and open gaps across hundreds of tickers, which LLMs cannot do mathematically in context. This skill provides a verified Python engine that handles survivorship bias warnings, session dropping for live markets, and rigorous statistical validation.

### Use cases
- Identify if a specific growth stock earns its premium primarily through earnings gaps.
- Rank S&P 500 sectors to see which are most sensitive to overnight news flow.
- Compare high-beta stocks against low-beta stocks to test for the overnight anomaly.
- Generate data for research papers or newsletters regarding market microstructure.

### Known limitations
Results are gross and do not include trading costs, taxes, or slippage. Calculations use current index members, introducing survivorship bias into historical scans. Short-history stocks under 500 days are excluded by default.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the sp500 overnight vs intraday skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill help identify the 'overnight anomaly'?

This skill separates the S&P 500's performance into two distinct components: the overnight gap (close-to-open) and intraday action (open-to-close), allowing you to identify if a stock's gains are driven by pre-market sentiment or active trading hours.

### Which AI agents or platforms can run this skill?

The skill is a Python-based engine compatible with any AI agent or environment that supports Python 3.11+ and standard data libraries like Pandas and Scipy. It can be integrated into custom LLM agents, local development environments, or automated trading research workflows.

### What exactly is included in the purchase?

You receive the complete source code, a configuration guide, and sample output files (CSV/JSON/Parquet). This includes the 'Quick Mode' script for specific tickers and the 'Full Scan' engine for processing the entire S&P 500 index.

### Does the skill handle data cleaning and missing price points automatically?

The skill uses the yfinance library to pull historical adjusted close and open prices; it includes built-in logic to handle data cleaning, such as dropping incomplete live sessions and filtering out stocks with short trading histories (under 500 days).

### Are transaction costs or slippage included in the performance results?

The analysis provides 'gross returns' based on price action; it does not factor in brokerage fees, bid-ask spreads, or overnight margin costs, which are essential to consider before applying these insights to a live trading strategy.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
