Project Story — Predict S&P500 with New Laws
About the Project
Predict S&P500 with New Laws is an AI-driven decision-support system that helps investors and analysts assess how new government regulations affect the financial markets.
The platform connects legal texts with financial data from S&P 500 companies, bridging the gap between policy interpretation and investment strategy. It turns complex legislation into actionable market insights.
Inspiration
Financial analysts often spend hours reviewing new laws, amendments, and government reports to estimate potential market impacts.
This process is slow, manual, and prone to bias, leading to delayed or missed opportunities.
We asked ourselves: What if we could instantly understand how a new regulation might influence key companies or sectors in the S&P 500?
That question became the foundation of this project — building a system that reads and interprets legal documents to forecast their financial implications.
What We Learned
- How to combine NLP and financial AI models for cross-domain reasoning.
- How to link laws and SEC filings (10-K, 10-Q) using embeddings and sentiment analysis.
- Techniques for financial text analysis with models like FinBERT and AWS Bedrock (Claude, Titan, Llama).
- How to orchestrate multiple models with LangChain to manage summarization, sentiment scoring, and portfolio simulation.
We also developed a useful concept for our analysis:
Risk Weight = Sentiment Score × Sector Exposure — a dynamic metric for adjusting S&P 500 weights based on changing sentiment and regulatory exposure.
How We Built It
Data Collection
- Parsed SEC filings (10-K, 10-Q) using sec-parser.
- Collected government regulations and law proposals in HTML, PDF, and XML formats.
AI Analysis Pipeline
- Law Summarization: Extracted key articles, industries, and entities using Amazon Comprehend and AWS Q Business.
- Financial Context: Mapped affected sectors to company fundamentals with AWS Aurora and FinBERT for tone detection.
- Investment Insights: Generated buy/sell weights for each S&P 500 company based on the combined analysis.
Deployment & Visualization
- Backend deployed on AWS Lambda and SageMaker for scalable inference.
- Interactive dashboard built with React and Tailwind CSS, featuring heatmaps and sector performance analytics.
Challenges
- Parsing complexity: SEC filings use inconsistent HTML structures; handling “Item 7” (MD&A) sections required extensive regex and fallback logic.
- Model alignment: Fine-tuning FinBERT for legal-financial tone proved challenging due to domain vocabulary differences.
- Data scaling: Some filings exceeded 50,000 tokens; we had to design chunking strategies that preserved semantic continuity.
- Latency: Balancing inference speed with accuracy during multi-model reasoning.
- Interpretability: Explaining why a law affects specific sectors required explainable AI mechanisms rather than black-box outputs.
Results
- Full pipeline from law upload to investment recommendation runs in under three minutes.
- Identifies top five sectors at risk and five sectors expected to benefit from each regulation.
- Generates AI-based reports combining sentiment scores, financial trends, and portfolio recommendations.
Future Work
- Integrate real-time market data to refine short-term predictions.
- Expand to multilingual analysis for international legislation.
- Add predictive layers using LSTM or transformer-based time-series models for sector ETFs.
Team Reflection
This project brought together expertise in finance, artificial intelligence, and software engineering.
It showed us that interpreting legislation isn’t just a legal or economic challenge — it’s a computational one. Understanding laws at scale requires reasoning systems that can bridge language, logic, and market behavior.
Built With
- amazon-cloudwatch
- amazon-dynamodb
- amazon-ec2
- amazon-q
- amazon-queue-service
- amazon-web-services
- anthropic
- aurora
- aws-bedrock
- aws-comprehend
- aws-textract
- claude-ai
- lambda
- mistral
- mysql
- python
- s3
- sagemaker
Log in or sign up for Devpost to join the conversation.