Market Shield: Navigating Market Volatility with AI-Powered Geopolitical Insights
Inspiration
In today's interconnected world, global events unfold at a dizzying pace. A conflict in one region can ripple across the globe, affecting everything from the price of gas to the value of our retirement savings. Yet, for the average person, translating complex geopolitical news into tangible financial decisions is a daunting task. We were inspired by this challenge: to bridge the gap between abstract global events and the concrete financial realities of everyday life, empowering users to not just react to market changes, but to anticipate them.
What it does
Market Shield is an intelligent dashboard that provides clear, personalized, and actionable financial recommendations based on an AI's analysis of geopolitical conflicts. It ingests a user's unique profile—including their location, commute, spending habits, and travel plans—and cross-references it with real-time market data and conflict reports from the ACLED (Armed Conflict Location & Event Data Project). The result is a simple, actionable list of recommendations (e.g., "Postpone electronics purchases due to supply chain risks," or "Fill up your gas tank before an expected price hike") that helps users navigate market volatility, all generated by Anthropic's Claude.
Beyond AI-powered insights, Market Shield features a Community page where users can report and track local price changes in real-time. This crowdsourced intelligence allows users to see what others in their area are experiencing—from gas price spikes to grocery shortages—creating a collaborative early warning system that complements the AI analysis.
How we built it
Market Shield was built with a modern, modular architecture designed for performance and type safety.
Frontend: We used a React and Vite stack with TypeScript for robust type safety. The UI was crafted with shadcn/ui and Tailwind CSS for a sleek, modern look. All asynchronous data fetching and state management was handled by React Query, and user authentication was managed via the Supabase client library.
Backend: We chose FastAPI (Python) for its high performance, asynchronous capabilities, and automatic data validation with Pydantic. This backend serves as the brain, processing requests and orchestrating the AI.
AI Agent and Model Tuning: Our AI is powered by Anthropic's Claude through the Letta platform for our specific domain which we implemented with sophisticated prompt engineering for our AI Agents.
- Contextual Prompts: We developed a system to dynamically construct highly detailed prompts. This context provides the AI with a persona ("You are Market Shield, an expert AI..."), the user's complete financial profile, a summary of recent global conflicts sourced from the ACLED API, and crucial domain knowledge about how specific market assets react to conflict. We explicitly hardcoded these relationships to guide the AI's analysis, including:
-
GLD: Gold ETF - A safe haven during conflicts. -
XLE: Energy Sector ETF - Sensitive to oil/gas price impacts. -
JETS: Airlines ETF - A key indicator for travel disruption. -
SOXX: Semiconductor ETF - For tracking tech supply chain risks. -
^VIX: Volatility Index - The market's "fear gauge." -
USO: Oil ETF - For direct oil price exposure.
-
- Strict Output Formatting: A major part of the tuning was forcing the model to respond only in a specific JSON format. This was crucial for reliability, as it allowed our frontend to parse the recommendations without fail.
- Contextual Prompts: We developed a system to dynamically construct highly detailed prompts. This context provides the AI with a persona ("You are Market Shield, an expert AI..."), the user's complete financial profile, a summary of recent global conflicts sourced from the ACLED API, and crucial domain knowledge about how specific market assets react to conflict. We explicitly hardcoded these relationships to guide the AI's analysis, including:
Challenges we ran into
Database Synchronization: Our biggest initial hurdle was ensuring that a user created via Supabase Auth was also created in our custom
public.userstable. We solved this by creating a client-sideAuthInsertListener. During debugging, we even faced mysterious database hangs, which we eventually traced to a corrupted table that had to be entirely recreated.The Disappearing Modal: We hit a frustrating bug where our "User Preferences" modal refused to open. The browser's console provided a warning about
refforwarding, which led us to discover an incompatibility in how we nested our Tooltip and Dialog components. Correctly restructuring the component composition fixed the issue.Keeping the UI in Sync: After implementing the "Save Preferences" feature, we noticed the recommendations weren't updating. The frontend had no way of knowing the data on the server had changed. The solution was to use React Query's
queryClientto manuallyinvalidateQueries, which told our app to discard the old data and refetch, creating a seamless user experience.
Accomplishments that we're proud of
Full-Stack System Integration: We successfully built and integrated a complete system, connecting a React frontend, a Python backend, a Supabase database, and the Letta AI platform into a single, cohesive application.
A Truly Personalized AI: We're proud of creating an AI system that goes beyond generic advice. By dynamically injecting user data into detailed prompts, we were able to generate recommendations that are genuinely tailored to an individual's life and financial habits.
Solving Complex Bugs: We navigated several non-trivial challenges, from database corruption to subtle component library issues. Overcoming these hurdles taught us invaluable debugging skills and deepened our understanding of our tech stack.
What we learned
The Power of Prompt Engineering: By mastering prompt engineering, we were able to use Anthropic's Claude as an Agentic AI to create a specialized financial analyst.
Advanced State Management: We learned that for complex applications, simple state management isn't enough. Using a dedicated library like React Query is essential for handling server state, caching, and ensuring the UI stays in sync with the database.
The Importance of Modularity: From the separate frontend and backend to the modular UI components, our architecture made it easier to develop, debug, and scale the application.
What's next for Market Shield
Real-Time Push Notifications: Implement a system to send users critical alerts when a new global event directly impacts their personal profile.
Deeper Data Integration: Incorporate more data sources, such as social media sentiment analysis and shipping lane data, to provide even more accurate and timely recommendations.
Expanded Financial Products: Broaden our analysis to include recommendations for other asset classes, such as cryptocurrencies and commodities.
Interactive Visualizations: Enhance the dashboard with more interactive charts and maps that allow users to explore the connections between global events and market performance on their own.
Built With
- Languages: TypeScript, Python
- Frameworks: React, FastAPI, Vite
- Platforms & Cloud Services: Supabase (Database & Auth), Letta (AI Platform)
- Database: PostgreSQL (via Supabase)
- UI/UX: shadcn/ui, Radix UI, Tailwind CSS
- Frontend Libraries: React Query, React Router
- Backend Libraries: Pydantic, Uvicorn
- Version Control: Git & GitHub
Built With
- claude
- fastapi
- git
- github
- letta
- postgresql
- pydantic
- python
- radix
- react
- shadcn
- supabase
- tailwind
- typescript
- uvicorn
- vite
Log in or sign up for Devpost to join the conversation.