AI swarm-based financial sentiment simulation platform.
ArthaNETRA fetches market news, extracts financial entities, builds a knowledge graph, runs investor-agent simulations, scores sentiment, and generates a final scenario report. It is designed for research, demos, and experimentation around market narrative analysis.
- Market news intake with GDELT primary and Google News RSS fallback
- Local fallback/demo mode when external providers are unavailable
- Financial entity and event extraction
- Knowledge graph generation and React Flow visualization
- Multi-agent financial sentiment swarm simulation
- Sentiment scoring with bull, bear, confidence, agreement, and risk metrics
- Final report dashboard with Recharts visualizations
- JSON and Markdown report download
- Safety layer for PII masking, financial-advice language rewriting, and disclaimers
- Supabase/PostgreSQL schema and storage abstraction with in-memory fallback
Frontend
- Next.js App Router
- TypeScript
- Tailwind CSS
- shadcn-style reusable components
- React Flow
- Recharts
Backend
- FastAPI
- Python 3.11+
- Pydantic / pydantic-settings
- HTTPX
Planned infrastructure
- Supabase / PostgreSQL
- Qdrant
- Gemini, NVIDIA NIM, and Hugging Face provider fallbacks
apps/
web/ Next.js frontend
api/ FastAPI backend
packages/
shared/ Shared package placeholder
docs/ Architecture, agents, prompts, routing, and deployment notes
High-level pipeline:
Input topic/company
-> news fetch
-> market analysis
-> knowledge graph builder
-> agent swarm simulation
-> sentiment scoring
-> final report generation
The frontend stores local workflow state in localStorage for demo and MVP flows. The backend can persist data through Supabase REST when configured, otherwise it uses in-memory mock storage.
The simulation includes these personas:
- Retail Investor Agent
- Institutional Investor Agent
- Short Seller Agent
- Financial Analyst Agent
- News Media Agent
- Regulator Agent
- Long-Term Investor Agent
- Quant Momentum Agent
- Competitor Watch Agent
- Risk Manager Agent
- Chief Market Synthesizer
Each agent produces sentiment, confidence, reasoning, main risk, main opportunity, evidence used, and questions for other agents.
Install dependencies from the repo root:
npm installCreate environment files from the examples:
copy .env.example .env
copy apps\web\.env.example apps\web\.env.local
copy apps\api\.env.example apps\api\.envFor PowerShell on Windows, the commands above work as written. On macOS/Linux, use cp and forward slashes.
The MVP runs without AI, Supabase, or Qdrant keys. Leave provider secrets blank to use mock/demo mode.
Frontend:
NEXT_PUBLIC_API_URL=http://localhost:8000Backend:
GEMINI_API_KEY=
GEMINI_REASONING_MODEL=gemini-2.5-flash
NVIDIA_API_KEY=
NVIDIA_BASE_URL=https://integrate.api.nvidia.com/v1
NVIDIA_REASONING_MODEL=
NVIDIA_EMBEDDING_MODEL=
NVIDIA_PII_MODEL=
HUGGINGFACE_API_KEY=
HUGGINGFACE_REASONING_MODEL=Qwen/Qwen2.5-7B-Instruct
SUPABASE_URL=
SUPABASE_SERVICE_KEY=
DATABASE_URL=
QDRANT_URL=
QDRANT_API_KEY=
CORS_ORIGINS=http://localhost:3000Required for MVP:
NEXT_PUBLIC_API_URLCORS_ORIGINS
Optional:
- Gemini, NVIDIA, and Hugging Face keys for real model calls
- Supabase/PostgreSQL values for persistence
- Qdrant values for future vector search
From the repo root:
npm run dev:webOr from apps/web:
npm run devOpen:
http://localhost:3000
From apps/api:
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python -m uvicorn main:app --reload --port 8000Open:
http://localhost:8000/health
http://localhost:8000/docs
The app includes a stable demo simulation for:
NVIDIA AI chip demand
Demo mode includes curated mock:
- articles
- market summary
- graph nodes and edges
- swarm rounds
- agent outputs
- scores
- final report
Use it from the landing page:
Open landing page -> Demo Simulation
Demo mode works without NVIDIA, Hugging Face, Supabase, Qdrant, or live news access.
ArthaNETRA uses a professional token-based light/dark theme driven by CSS variables. The landing page uses a lightweight WebGL shader background for brand impact, while dashboard pages use static themed surfaces with subtle grid and radial glow layers for performance. Knowledge graph colors are domain-specific and intentionally preserved for node types, sentiment edges, and legend readability.
With both frontend and backend running:
- Open
http://localhost:3000 - Go to New Simulation
- Enter a topic or company
- Click Fetch candidate news
- Select articles
- Open the knowledge graph
- Run the swarm simulation
- Review the final report
If external news providers are unavailable, the backend returns local fallback articles so the MVP flow still works.
GET /healthPOST /api/news/fetchPOST /api/simulation/runGET /api/simulation/{simulation_id}
Initial PostgreSQL/Supabase schema:
apps/api/migrations/001_initial_schema.sql
Tables:
simulationsarticlesmarket_summariesgraph_nodesgraph_edgesagent_outputssimulation_roundsfinal_reports
When Supabase env vars are missing, the backend uses in-memory mock storage.
Recommended deployment path:
- Deploy
apps/apias a FastAPI service. - Deploy
apps/webas a Next.js app. - Configure
NEXT_PUBLIC_API_URLto point to the deployed API. - Apply
apps/api/migrations/001_initial_schema.sqlto Supabase/PostgreSQL. - Add provider secrets through the deployment platform secret manager.
- Enable Qdrant once vector retrieval is implemented.
- Add monitoring, request logging, and rate limits before production use.
ArthaNETRA generates AI-assisted scenario analysis. It is not financial advice and does not recommend buying, selling, or holding any security.
Reports must include:
This is AI-generated scenario analysis, not financial advice.
The backend safety layer masks common PII patterns, rewrites direct financial-advice commands into safer scenario language, and adds input quality warnings when evidence is weak, sparse, stale, or conflicting.
- Real Supabase persistence in the deployed environment
- Qdrant vector retrieval for article and entity context
- Expanded Gemini, NVIDIA NIM, and Hugging Face model routing
- Better entity resolution and duplicate merging
- Historical simulation comparison
- Portfolio/watchlist support
- Authentication and saved workspaces
- Export to PDF
- CI tests for frontend, backend, and API contracts
- Observability, rate limiting, and production hardening