BLOG

Behind the numbers.

Code examples, market analysis, and data quality deep-dives.

Does Skipping the Most Recent Month Improve Momentum? S&P 500 Decile Sorts in Python
Does Cointegration Survive Out of Sample? Pairs Trading Validation in Python
Which Dividends Are Not Covered by Cash? Free-Cash-Flow Coverage Screening in Python
GICS vs SIC vs NAICS: Which Industry Classification to Use
How Many Stocks Does It Take to Diversify? Random Portfolio Simulation in Python
How Many Days of Data Does a Volatility Estimate Need? Range-Based Estimators in Python
How Much of S&P 500 Cash Flow Is Stock Compensation? Cross-Sectional Analysis in Python
What Is a 13F Filing? Institutional Holdings Explained
Does Revenue Growth Explain Profit Growth? Cross-Sectional Decomposition in Python
How Much of the Nasdaq 100 Is Already in the S&P 500? Index Overlap Analysis in Python
How Often Does a 99% Value-at-Risk Limit Actually Break? VaR Backtesting in Python
Real-Time vs End-of-Day Market Data: Which Do You Need?
How Concentrated Are S&P 500 Earnings? Point-in-Time Index Analysis in Python
Does Volatility Scale With the Square Root of Time? Variance Ratio Test in Python
Does Goodwill Distort the Price-to-Book Screen? Goodwill-Adjusted Valuation in Python
How Are Shares Outstanding Reported (and Why They Disagree)
Do Low-Volatility Stocks Deliver Better Risk-Adjusted Returns? S&P 500 Quintile Sorts in Python
Does Trend Following Beat Buy and Hold? Time-Series Momentum in Python
Has the Stock-Bond Correlation Flipped? 60/40 Portfolio Risk in Python
What API to Use for a Stock Screener
Which Assets Hedge Inflation Shocks? Macro Factor Betas in Python
Does Covariance Shrinkage Beat the Sample Covariance? Minimum-Variance Portfolios in Python
Do Faster Inventory Turns Mean Thinner Margins? Gross Margin Return on Inventory in Python
SEC EDGAR API vs Fundamentals API: Which to Use
Does Fast Earnings Growth Persist? Rank Correlation Analysis in Python
Split Adjustment Explained: Adjusted Close vs Close
Which Trading Day of the Month Pays Best? Turn-of-the-Month Analysis in Python
Can You Use Yahoo Finance Data Commercially?
How Many Independent Bets Does a Nine-Sector Portfolio Give You? Eigenvalue Analysis in Python
Which Volatility Forecast Wins One Month Ahead? HAR vs EWMA in Python
How Concentrated Are Institutional Equity Portfolios? Form 13F Concentration Analysis in Python
Do Stocks Earn Their Returns Overnight or Intraday? Return Decomposition in Python
When Do Corporate Insiders Actually Trade? Form 4 Timing Analysis in Python
Data Requirements for Backtesting a Trading Strategy
What Is Survivorship Bias in Backtesting?
Do High Dividend Yields Come From Bigger Payouts or Falling Prices? Yield Decomposition in Python
Do Stocks Fall Harder Than They Rise? Downside Beta vs Upside Beta in Python
Does Volatility Targeting Improve Sharpe Ratios? Seven-Asset Backtest in Python
Free Stock Market Data APIs: What You Actually Get
How to Give an LLM Financial Data With an MCP Server
Does Post-Earnings Announcement Drift Survive Real Filing Dates? PEAD Event Study in Python
Do Insider Buying Clusters Predict Returns? Signal Testing in Python
Does the S&P 500 Index Effect Still Exist? Event Study in Python
Are Companies Leaving the S&P 500 Faster Than They Used To? Index Survival Analysis in Python
Does Gross Profitability Predict Stock Returns? Quintile Factor Test in Python
What Growth Rate Is the Market Pricing In? Reverse DCF in Python
Does a Strong Balance Sheet Cushion Drawdowns? Leverage and Downside Risk in Python
Does Ticker Recycling Corrupt a Mean-Reversion Backtest? Entity-Resolved Z-Scores in Python
How Much of a Growth Screen's Backtested Edge Is Survivorship Bias? Point-in-Time Index Testing in Python
Why Do Leveraged ETFs Decay? Measuring Volatility Drag in Python
Are Consumer Staples Margins Shrinking Under Inflation? Gross Margin Trend Analysis in Python
Do Weak Jobs Reports Predict Market Drawdowns? NFP Surprise Event Study in Python
Is the Rotation From Tech to Industrials Backed by Earnings? Relative EPS Growth Analysis in Python
Is the Semiconductor Rally Broadening Beyond NVIDIA? Return Dispersion Analysis in Python
Which Stocks Benefit Most When Oil Prices Fall? Oil Beta Screening in Python
Do Bond Returns Predict Stock Returns? Granger Causality Test in Python
Which Stocks Actually Drive Portfolio Returns? Shapley Value Attribution in Python
Does "Sell in May" Still Work? Calendar Anomaly Backtest in Python
How to Build Complete Price History Through Ticker Changes? Entity Resolution in Python
Are KO and PEP Cointegrated? Pairs Trading Signal Construction in Python
Which Commodities Have the Strongest Momentum? Rotation Backtest in Python
Which Commodity ETFs Have the Worst Tail Risk? Expected Shortfall in Python
Are Gold Miners Leveraged Gold Bets? Rolling Beta Analysis in Python
Does the Base-Metals-to-Gold Ratio Lead Cyclical Stocks? Signal Test in Python
Can Risk Parity Tame Commodity Volatility? Portfolio Optimization in Python
Are Power Stocks Becoming an AI Infrastructure Trade? Momentum Screening in Python
Which AI Chip Stocks Have Margin Momentum? Profitability Trend Analysis in Python
Which AI Stocks Are Cheapest Relative to Growth? Growth-Adjusted Valuation in Python
Does AI Stock Leadership Persist? Momentum Backtest in Python
Which AI Stocks Have the Cleanest Balance Sheets? Net Cash Screening in Python
Can Risk Parity Reduce Mega-Cap Drawdowns? Portfolio Optimization in Python
Which Growth Stocks Are Self-Funding? Cash-Flow Quality Screening in Python
Which Sectors Struggle When the Dollar Rallies? Sector Rotation Analysis in Python
Do Cheap Stocks Hold Up When Bonds Sell Off? Valuation Rotation in Python
Does the Nasdaq 100 Have Better Growth Quality Than the Dow? Index Constituent Analysis in Python
Do Healthcare Cash-Flow Margins Predict Returns? Signal Evaluation in Python
Which Dividend Stocks Survive a Cash-Flow Stress Test? Dividend Screening in Python
Does Heavy Insider Selling Predict Weak Returns? Insider Flow Test in Python
Can Quality Screens Reduce Small-Cap Balance-Sheet Risk? Russell 2000 Test in Python
Which Retailers Have Positive Operating Leverage? Margin Screening in Python
Is MSTR a Leveraged Bitcoin Proxy? Rolling Beta Analysis in Python
Is Micron's Memory Cycle Recovering? Inventory and Margin Forecasting in Python
Which Sectors Work When Bonds Rally? Rate-Sensitive Rotation in Python
Do One-Month Price Extremes Reverse? Signal Evaluation in Python
Do Low-Volatility S&P 500 Stocks Reduce Drawdowns? Factor Test in Python
Is AI Capex Paying Back Fast Enough? Revenue Hurdle Forecasting in Python
Could Shorter AI Asset Lives Hit Earnings? Depreciation Stress Test in Python
How Much AI Capex Risk Can a Portfolio Remove? Constrained Optimization in Python
Is the AI Capex Trade Crowded? Rolling Volatility and Sector Rotation in Python
Did the AI Boom Come From Existing S&P 500 Members? Point-in-Time Momentum Test in Python
Is AI Revenue Circular? Customer-Vendor Capex Loop Analysis in Python
Is the AI Trade Connected to Private Credit? Rolling Correlation Network in Python
Is Apollo More Balance-Sheet Sensitive Than Peers? Leverage Screen in Python
Are AI Earnings Supported by Cash Flow? Accrual and Capex Screen in Python
Can Defensive Stocks Hedge AI Drawdowns? Basket Regime Test in Python
How Fast Does the Market Price In Fed Decisions? FOMC Event Study in Python
How Much Are Options Sellers Overpaid? The Variance Risk Premium in Python
Which Companies Have the Worst Earnings Quality? Sloan Accrual Screen with Geographic Revenue Data in Python
Does the Oil-to-Gold Ratio Signal Recessions? XLE/GLD Backtest in Python
Is AI Spending Crowding Out Free Cash Flow? Capex Sustainability Across the Mag 7 in Python
Does a Long Energy / Short Bonds Portfolio Capture Inflation Surprises? Factor Construction in Python
Can a Hidden Markov Model Detect Oil Market Regimes? HMM Analysis in Python
Do Grain Prices Predict Food Inflation? Granger Causality Test in Python
Does the Corporate Credit Spread Predict Stock Market Crashes? BAA-AAA Spread Analysis in Python
Do Oil Stocks Hedge Inflation? Rolling Beta Analysis in Python
Which Stocks Are Most Rate-Sensitive? Equity Duration via Bond Beta in Python
Which Companies Have the Highest Accrual Ratios? Earnings Quality Screening in Python
Is Alpha Persistent or Decaying? Rolling Sharpe Ratio Analysis in Python
Are Markets Trending or Mean-Reverting? Hurst Exponent Analysis in Python
Is Consumer Discretionary vs Staples a Leading Indicator? XLY/XLP Ratio Analysis in Python
Does Heavy Capex Predict Future Stock Returns? Capital Expenditure Analysis in Python
How to Estimate Cost of Equity Using CAPM in Python
Is Volatility Predictable? Testing for Volatility Clustering in Python
Which Industrials Are Overleveraged? Net Debt to EBITDA Screening in Python
GM Before and After Bankruptcy: Why Entity Resolution Matters for Financial Data
What Is Adjusted Beta? Merrill Lynch Beta Shrinkage in Python
How Good Is a Stock Pick? Information Ratio and Tracking Error in Python
Do Stock Returns Follow a Normal Distribution? Testing for Fat Tails in Python
Which Large Caps Have the Highest Free Cash Flow Yield? FCF Screening in Python
Which Sectors Won Over 5 Years? Sector Rotation Analysis in Python
How to Forecast Stock Volatility with GARCH Models in Python
Are Stock Prices Mean-Reverting? Augmented Dickey-Fuller Test in Python
How to Calculate CAPM Alpha and Beta with Regression in Python
How to Compare Sector Sharpe Ratios and Sortino Ratios in Python
DELL: Why Stitching Historical Price Data Together Is Wrong
How to Analyze Drawdown and Recovery for Bank Stocks in Python
How to Screen SaaS Stocks by Revenue Growth and Cash Flow in Python
How to Screen REITs by Dividend Yield and Valuation in Python
How Correlated Are the Magnificent 7? Intra-Group Correlation in Python
AAPL vs XOM: Do Individual Stocks Have Seasonal Patterns?
How to Rank Large-Cap Stocks by Momentum in Python
How to Build a Multi-Endpoint Financial Dashboard in Python
How to Compare Volatility Across Energy Stocks in Python
How to Screen Healthcare Stocks by Valuation in Python
How to Build a Sector Correlation Matrix for Portfolio Diversification in Python
How to Find Oversold and Overbought Stocks Using Z-Scores in Python
How to Measure Earnings Quality: Cash Flow vs Net Income in Python
How to Build a Multi-Factor Stock Screen in Python (Value + Momentum + Quality)
How to Build a Simple DCF Model for Any Stock in Python
How to Screen Tech Stocks by Revenue Growth in Python
How to Screen Stocks by Balance Sheet Health in Python
Is "Sell in May" Real? SPY Monthly Seasonality Over 10 Years
How to Compare Sector Performance YTD Using Python
How to Screen Dividend Stocks by Yield and Quality in Python
How to Calculate Max Drawdown and Recovery Time for Any Stock in Python
How to Compare Profitability Across Mega-Cap Tech Stocks in Python
Why Ticker Symbols Are Unreliable: The Recycling Problem Every Quant Should Know
How to Calculate and Compare Stock Volatility in Python
How to Screen Blue-Chip Stocks by P/E Ratio in Python
How to Track Companies Through Ticker Changes, Bankruptcies, and Renames in Python
S&P 500 Turnover: How Much the Index Has Changed Since 2010
How to Calculate Stock Beta and Correlation in Python
← All articles

GICS vs SIC vs NAICS: Which Industry Classification to Use

Three industry classification systems turn up in equity work, and each was built to answer a different question. GICS, maintained by MSCI and S&P Dow Jones Indices, groups companies the way investors compare them, and its owners describe it as a scheme built to give investors consistent industry definitions. SIC is the code carried in a company’s EDGAR filing header, so it is the right key when the work has to line up with the filing. NAICS is the federal statistical standard, which makes it the key that joins a company to government economic data. Screens, peer sets and factor neutralisation belong to GICS. Filing-level work belongs to SIC. Anything that has to meet Census or Bureau of Labor Statistics tables belongs to NAICS.

The trap sits one level below that. Many market data APIs return a field called sector that follows none of the three, and the strings look close enough to a standard that nobody checks.

Who maintains each scheme?

GICS is jointly run by two index providers. MSCI states that “MSCI and S&P Dow Jones Indices developed this classification standard to provide investors with consistent and exhaustive industry definitions”, and the GICS methodology book dated August 2024 describes four levels containing “11 Sectors, 25 Industry Groups, 74 Industries, and 163 Sub-Industries”. A company’s full classification is “an 8-digit code with text description”, and the structure is reviewed annually. Both pages were read on 5 August 2026.

SIC is the oldest of the three and no longer has a federal owner. The Bureau of Labor Statistics puts its span plainly: “For over 60 years, the Standard Industrial Classification (SIC) system served as the structure for the collection, presentation, and analysis of the U.S. economy”, and NAICS “was introduced in 1997”. The Office of Management and Budget finished the job in a Federal Register notice dated 21 December 2021, which states that “Statistical Policy Directive No. 9, Standard Industrial Classification of Enterprises, will be eliminated effective immediately”.

The SEC did not follow. Its own code list page, read on 5 August 2026, says that “The Standard Industrial Classification Codes that appear in a company’s disseminated EDGAR filings indicate the company’s type of business”, and that “These codes are also used in the Division of Corporation Finance as a basis for assigning review responsibility for the company’s filings”. A classification retired from federal statistics in 2021 still decides which SEC staff read your 10-K.

NAICS is the live government standard. The same Federal Register notice records that Mexico’s INEGI, Statistics Canada and OMB “jointly developed NAICS in 1997 and continue to collaborate”, that “Revisions are considered every five years in calendar years ending with 2 and 7”, and that federal establishment data for reference years from 1 January 2022 should be published on 2022 NAICS codes. The next revision lands on the 2027 cycle.

Scheme Maintained by Structure Built for
GICS MSCI and S&P Dow Jones Indices 11 sectors, 25 industry groups, 74 industries, 163 sub-industries; 8-digit code Comparing companies as investments
SIC No current federal owner; still assigned in EDGAR 4-digit codes on the filing header Filing-level identification and SEC review routing
NAICS INEGI, Statistics Canada and OMB, revised in years ending 2 and 7 Hierarchical codes up to 6 digits Publishing and joining government economic statistics

Sources, all read on 5 August 2026: the MSCI GICS page and its GICS methodology book, the BLS NAICS page, the Federal Register notice of 21 December 2021 on govinfo, and the SEC’s SIC code list.

Why does one company carry three different sector labels?

Take IBM. Under GICS the sector is Information Technology. The SEC’s submissions API, queried on 5 August 2026, returns SIC 3570, described as “Computer & office Equipment”. Alpha Vantage’s OVERVIEW endpoint, called the same day against its own demo key, returns Sector as TECHNOLOGY and Industry as INFORMATION TECHNOLOGY SERVICES, and its 40-plus field response carries no SIC or NAICS code at all. The yfinance documentation, also read on 5 August 2026, exposes Sector and Industry classes whose keys look like technology and software-infrastructure, and it names no classification standard anywhere.

Three labels for one company, and they do not resolve to each other. TECHNOLOGY is not a GICS sector name; GICS calls that sector Information Technology, and the difference matters the moment code tries to match strings against an index provider’s sector list. Nothing here is wrong on any vendor’s part. A field called sector is only a promise about grouping, not about which scheme did the grouping, and the question worth asking of any data source is which of the three it follows, if any.

Amazon shows the same gap in the other direction. EDGAR returns SIC 5961, “Retail-Catalog & Mail-Order Houses”, read on 5 August 2026. The code is accurate to the filing header and says nothing about the cloud business, because the SIC vocabulary was fixed in an era that ended before that business began. GICS places the company in Consumer Discretionary, which is a claim about how investors should compare it rather than about what its filing cover page says.

When is each one the right key?

Reach for SIC when the unit of analysis is the filing. Anything that has to reconcile against EDGAR, or that follows how the SEC itself routes a registrant, should use the code EDGAR carries, straight from the filing header. The guide on SEC EDGAR API vs a fundamentals API covers what that endpoint returns and what it costs in engineering.

Reach for NAICS when the equity data has to meet an economic series. Employment, output, price indices and establishment counts are published on NAICS, so a study linking company results to industry conditions needs the code the statistical agency used, on the vintage it used.

Everything cross-sectional in equities points at GICS: sector weights, peer sets, sector-neutral factor sorts, dispersion between industries. Comparing companies as investments is the job MSCI states the scheme was designed for, and it is the only one of the three subject to an annual review of its own structure. Two of these schemes describe what a company files; the third describes how a portfolio is compared.

How do you get a sector-keyed universe in Python?

The awkward part of sector work is rarely the classification itself. It is the join: a mapping table that has to be sourced, refreshed, and kept aligned with ticker changes. Data that arrives already carrying its sector removes that step.

import xfinlink as xfl

xfl.set_api_key("YOUR_API_KEY")  # free at https://xfinlink.com/signup

names = ["AAPL", "MSFT", "IBM", "KO", "DIS", "GE", "JPM", "XOM"]
df = xfl.prices(names, period="1w", fields=["close"])

latest = df.sort_values("date").groupby("ticker", as_index=False).tail(1)
print(latest[["ticker", "entity_name", "gics_sector", "date", "close"]]
      .sort_values("gics_sector").to_string(index=False))
ticker                          entity_name            gics_sector       date  close
   DIS                       DISNEY WALT CO Communication Services 2026-08-04  98.18
    KO                         COCA COLA CO       Consumer Staples 2026-08-04  86.56
   XOM                     EXXON MOBIL CORP                 Energy 2026-08-04 153.96
   JPM                  JPMORGAN CHASE & CO             Financials 2026-08-04 357.52
    GE                  GENERAL ELECTRIC CO            Industrials 2026-08-04 377.28
  MSFT                       MICROSOFT CORP Information Technology 2026-08-04 492.81
   IBM INTERNATIONAL BUSINESS MACHINES CORP Information Technology 2026-08-04 235.15
  AAPL                            Apple Inc Information Technology 2026-08-04 309.38

The GICS sector rides on the price row itself, next to the permanent entity identifier, so grouping by sector is a groupby rather than a merge. xfl.search(gics_sector="Information Technology") runs the same idea in reverse and returns the entities in a sector, which is how a sector-restricted screen starts. The stock screener guide covers the rest of that loop, and the docs list the fields each endpoint returns.

FAQ

Who owns GICS?
MSCI and S&P Dow Jones Indices, jointly. Both publish the methodology book free, and terms for any use of the structure itself come from those two owners rather than from a data vendor.

Why does EDGAR still use SIC when the government retired it?
Because the SEC uses it operationally rather than statistically. The SIC code on a filing header tells the Division of Corporation Finance which staff review the filing, a job the code does whether or not any statistical agency still publishes on it.

Which classification should a backtest use?
GICS, for any test whose portfolios are built or neutralised by sector, since it is the one of the three built around how investors compare companies and the one whose structure is reviewed every year. Use SIC or NAICS when the test has to reconcile against filings or government series.

Built with xfinlink — free financial data API for Python. pip install -U xfinlink

Built with xfinlink — free financial data API for Python. pip install -U xfinlink
← All articles