Inspiration: Finding the Signal in the Noise
Financial markets are a chaotic storm of information. Prices move not just on fundamentals, but on emotion, hype, and fear, especially in the age of social media. I was inspired to build an AI that could act like a seasoned financial analyst, one who could not only read charts but also understand the psychology of the market by listening to the global conversation. The goal was to build a tool that could perceive, reason, and act on this sentiment to provide a quantifiable edge.
How I Built It: A Dual-Agent System on AWS
MarketMind isn't a single application; it's a sophisticated system of two distinct AI agents powered by a serverless AWS backend.
- The Sentinel Agent (The Proactive Background Analyst): This is the core autonomous agent. It runs 24/7 in the cloud without any manual intervention.
An Amazon EventBridge rule triggers an AWS Lambda function (DataCollector) on an hourly schedule.
This function ingests a multi-modal data stream: emotional sentiment from Reddit and factual context from a News API.
The raw data is stored in an Amazon S3 bucket, which automatically triggers a second Lambda function (MarketMind-Analyzer).
This analyzer function constructs a detailed prompt with the collected data and sends it to Amazon Bedrock (Anthropic Claude 3 Sonnet) for deep analysis. The AI is instructed to identify overall market trends, detect sentiment towards specific stocks, and assign a risk level.
The AI's structured JSON analysis is saved back to a processed/ folder in S3, and if a "High" or "Medium" risk is detected, a formatted alert is immediately dispatched to a Telegram bot.
- The Oracle Agent (The Reactive Real-Time Analyst): This agent lives inside the live Streamlit Dashboard. It's an interactive tool that responds to user commands in real-time.
It uses the yfinance library to pull live and historical stock data.
When a user requests an analysis or comparison, the dashboard sends the stock's latest news and financial metrics to Amazon Bedrock.
The AI performs on-demand tasks like summarizing news, comparing stocks based on stability and risk/return profiles, and providing a forecast for the next day's price using a simple Prophet model.
Challenges I Faced
API Rate Limits: The initial 15-minute schedule quickly exhausted the free-tier limits of the News API. This forced a strategic change to an hourly schedule and taught me the importance of designing for API constraints.
Deployment & Cloud Permissions: The journey from a local script to a fully deployed cloud application was filled with classic DevOps challenges. Debugging NoCredentialsError and NoRegionError in Streamlit Cloud and fixing IAM permissions for Lambda functions was a huge learning experience in cloud security.
Prompt Engineering: Getting the Bedrock AI to consistently return a perfectly formatted, non-verbose JSON object required several iterations of prompt engineering. I learned to be extremely specific with instructions, asking it to respond only with the JSON.
What I Learned
This project was a deep dive into building a practical, end-to-end AI agent. I learned how to orchestrate multiple AWS services (Lambda, S3, EventBridge, Bedrock) into a cohesive, autonomous pipeline. Most importantly, I learned how to engineer prompts for generative AI not just for simple Q&A, but to perform structured analytical tasks and function as the "brain" of a larger system.
What's next for MarketMind: AI Financial Risk & Sentiment Agent
Built With
- amazon-web-services
- aws-event-bridge
- aws-iam
- aws-lambda
- bedrock
- boto3
- matplotlib
- news-api
- pandas
- plotly
- python
- streamlit
- telegrambotapi
- textblob
- wordcloud
- yfinance
Log in or sign up for Devpost to join the conversation.