Inspiration
Self-directed investors rarely suffer from a lack of information. The real problem is fragmentation.
Portfolio data lives in one platform, market prices in another, news and earnings in several feeds, and research notes somewhere else. Even after collecting everything, investors still need to answer the questions that actually matter:
- What changed today?
- Why does it matter to my portfolio?
- Which claims are supported by evidence?
- What should I monitor next?
- What would invalidate my current investment thesis?
I started building MarketLens AI after experiencing this problem firsthand. Existing market dashboards are good at displaying data, while generic AI assistants are good at summarizing text, but neither consistently connects portfolio context, market events, evidence, risk, and decision-making in one workflow.
MarketLens AI is designed as an evidence-first research workspace rather than an automated trading bot. Its purpose is not to tell users what to buy or sell. It helps them understand the market, challenge their assumptions, and make more structured decisions.
What it does
MarketLens AI turns fragmented market and portfolio information into a personalized, evidence-backed daily research brief.
The application:
- Collects major index, watchlist, earnings, macro-event, and portfolio data
- Connects securely to Interactive Brokers for read-only portfolio context
- Identifies the market developments most relevant to the user's holdings and watchlist
- Generates a structured daily market brief using GPT-5.6
- Separates facts, interpretations, and conclusions
- Assigns confidence levels to important claims
- Surfaces risks, counterarguments, and thesis invalidation conditions
- Produces trade setups as research scenarios rather than direct buy or sell instructions
- Stores snapshots and reports so users can review how prior analysis performed
Instead of producing a generic market summary, MarketLens AI answers a more useful question:
What changed, why does it matter to me, and what evidence should I monitor next?
How we built it
MarketLens AI is a full-stack application built with Next.js, TypeScript, React, Supabase, OpenAI, and multiple financial-data integrations.
The system is organized as an agentic research workflow:
- A market snapshot collector gathers index, watchlist, earnings, macro, and portfolio context.
- A market analysis agent uses GPT-5.6 to identify important developments and generate structured research.
- A verification layer checks whether conclusions are supported by the available evidence.
- A portfolio-fit layer evaluates how each development relates to the user's current holdings and allocation.
- Structured outputs are stored in Supabase as reports, evidence items, risks, and trade setups.
- A Next.js dashboard presents the results as a coherent daily workflow.
Interactive Brokers is integrated through its Client Portal API in read-only mode. The application also supports scheduled morning capture workflows and graceful fallback behavior when a provider or model is unavailable.
Codex was used throughout the engineering process to:
- Audit and understand the existing codebase
- Design the agentic data model and workflow
- Implement API routes and service layers
- Refactor provider integrations
- Create database schemas and validation logic
- Debug structured-output and authentication issues
- Build PowerShell automation for daily portfolio capture
- Review code quality and maintain project documentation
- Iterate on the dashboard experience
Rather than using Codex only to generate isolated snippets, I used it as an engineering collaborator across architecture, implementation, debugging, testing, documentation, and product iteration.
Challenges we ran into
One major challenge was grounding AI-generated analysis in real evidence. A market summary can sound convincing even when the underlying evidence is incomplete. To reduce this risk, I separated raw evidence, interpretation, conclusion, confidence, and thesis invalidation into distinct structured fields.
Another challenge was integrating Interactive Brokers. Its local Client Portal Gateway requires authentication, session handling, and a running local process. I built scripts for starting the gateway, checking authentication, capturing portfolio data, handling failures, and stopping the process safely.
Financial-data providers also have different schemas, coverage, rate limits, and failure modes. The application therefore needed provider abstraction, fallback handling, freshness metadata, and clear labeling of mock or unavailable data.
Structured model output presented another challenge. The application needs reliable JSON rather than attractive but inconsistent prose. I added schema validation, parsing safeguards, deterministic fallbacks, and verification steps.
Finally, I had to balance useful investment research with responsible product design. MarketLens AI avoids pretending that a research score is a trading signal and clearly separates company quality, valuation, portfolio fit, and trade setup.
Accomplishments that we're proud of
I am especially proud that MarketLens AI is more than a chatbot placed on top of a dashboard.
It includes:
- A working end-to-end market research workflow
- Personalized portfolio context through Interactive Brokers
- Structured GPT-5.6 outputs rather than unbounded prose
- Evidence items and confidence levels attached to conclusions
- Explicit counterarguments and thesis invalidation conditions
- Persistent market snapshots and analyst reports
- Trade setups separated from fundamental research
- Automated daily portfolio capture
- Failure handling when APIs, authentication, or model calls are unavailable
- A product experience designed around a real daily investing routine
The most important accomplishment is the project's research philosophy:
Good company does not automatically mean good stock. Good asset does not automatically mean good price. A high research score does not automatically mean buy.
What we learned
This project reinforced that the hardest part of an AI product is often not generating an answer. It is designing the system around the answer.
I learned that reliable agentic applications need:
- Explicit schemas
- Observable evidence
- Confidence and uncertainty
- Provider freshness checks
- Deterministic fallback behavior
- Clear boundaries between data, interpretation, and action
I also learned that Codex is most valuable when it has access to persistent project context, coding standards, progress documentation, and clearly scoped tasks. It became significantly more effective when I treated it as part of an engineering workflow rather than as a one-shot code generator.
From a product perspective, I learned that investors need prioritization more than additional information. A useful market tool should reduce noise, expose uncertainty, and help users ask better questions.
What's next for MarketLens AI
The next phase is to make the research workflow more complete and measurable.
Planned improvements include:
- Additional market-data providers and stronger source redundancy
- Direct citations for every important generated claim
- Historical evaluation of prior briefs and trade setups
- Post-market review agents that compare predictions with outcomes
- Portfolio exposure, concentration, and scenario analysis
- User-defined investment research frameworks
- Contribution-based portfolio rebalancing guidance
- Improved earnings and macro-event monitoring
- More personalized alerts based on thesis invalidation conditions
- A production deployment that removes the need for local infrastructure
The long-term vision is to create a personal market intelligence operating system: one that remembers the investor's portfolio, research framework, assumptions, and prior decisions, while keeping evidence and uncertainty visible.
Built With
- api
- brokers
- codex
- finance
- finnhub
- gpt-5.6
- interactive
- next.js
- node.js
- openai
- postgresql
- powershell
- react
- responses
- rest
- supabase
- typescript
- yahoo
- zod
Log in or sign up for Devpost to join the conversation.