How abinav-kishore/vantic works
Purpose and entry points
Vantiq is a Next.js/React stock-intelligence application that runs explainable technical, fundamental, and sentiment analysis for a selected symbol. The primary UI is app/dashboard/page.tsx; app/page.tsx and app/layout.tsx establish application routing/layout. Server entry points are App Router handlers, especially app/api/analysis/route.ts for the full pipeline and app/api/evidence/route.ts for fundamental evidence retrieval.
API and orchestration boundary
app/api/analysis/route.ts accepts { symbol, profile }, validates/resolves the requested instrument through backend services, runs exactly three specialist agents concurrently, then performs synthesis and risk-profile adaptation. It returns both decision-oriented output and explainability data rather than exposing provider credentials or raw server implementation to the browser. Stock lookup and chart-data APIs are separated under app/api/stocks/route.ts, app/api/stocks/[symbol]/route.ts, and app/api/stocks/[symbol]/history/route.ts.
Market-data subsystem
The market layer provides a provider boundary around Yahoo Finance, with caching/client behavior in market/marketDataClient.ts and concrete provider access in market/yahooFinanceProvider.ts. It supplies snapshots and historical candles for stock APIs and technical analysis. Indicator computation is local and deterministic in market/indicators.ts, keeping RSI, MACD, EMA, momentum, volume, and support/resistance logic independent of external-provider response formats. Finnhub news access is isolated in market/finnhubProvider.ts.
Parallel specialist-agent stage
Three independently scoped agents consume distinct data sources and produce shared typed outputs:
• TECH-SPIDER: agents/technicalAgent.ts, using market history and indicators.
• FUND-SPIDER: agents/fundamentalAgent.ts, using RAG retrieval and source-grounded evidence.
• SENTI-SPIDER: agents/sentimentAgent.ts, using relevant Finnhub news.
Shared contracts in agents/types.ts normalize signals, confidence, evidence, availability, and failure/degraded states. The orchestration preserves unavailable states instead of inventing provider values, news, or document evidence.
Synthesis, personalization, and traceability
After the parallel agents finish, NEXUS combines their signals, confidence, and agreement/disagreement through agents/synthesis.ts. agents/personalization.ts reframes the result for conservative or aggressive profiles without replacing the underlying analysis. agents/reasoningTrace.ts records actual pipeline-stage status and latency; this trace is a first-class response artifact consumed by the dashboard.
RAG evidence pipeline
The fundamental-analysis boundary is a local, per-symbol document corpus backed by OpenAI embeddings. Ingestion flows through rag/ingest.ts, extraction/chunking, and rag/vectorIndex.ts; query-time semantic retrieval is handled by rag/retrievalService.ts. Document and evidence contracts live in types/documents.ts and data/types.ts. The evidence API and FUND-SPIDER must return unavailable/empty results when a symbol lacks corpus coverage, the index is absent, or embeddings cannot be generated.
Presentation and infrastructure
The browser dashboard composes analysis, evidence, charts, agent status, synthesis, and reasoning-trace views from app/dashboard/page.tsx and components such as components/AskVantic.tsx, components/EvidencePanel.tsx, and components/ReasoningTrace.tsx. The runtime is Next.js 15 App Router on Node.js with TypeScript. External services are Yahoo Finance (yahoo-finance2), Finnhub over fetch, and OpenAI Embeddings over fetch; secrets remain server-side via environment configuration.
Main entry points: route.ts Analysis API · page.tsx Dashboard · marketDataClient.ts Market data client · types.ts Agent contracts
Components 24
Browser UI
- Dashboard · Composes analysis, evidence, charts, status, and trace views.
app/dashboard/page.tsx - Analysis interaction
components/AskVantic.tsx - Evidence panel
components/EvidencePanel.tsx - Reasoning trace view
components/ReasoningTrace.tsx
App Router APIs
- Analysis API · Validates a symbol and returns decision output plus explainability artifacts.
app/api/analysis/route.ts - Evidence API
app/api/evidence/route.ts - Stock & history APIs · Lookup, quote, and chart-data endpoints.
app/api/stocks/route.ts
Analysis pipeline
- Agent contracts · Normalizes signals, confidence, evidence, and degraded states.
agents/types.ts - TECH-SPIDER
agents/technicalAgent.ts - FUND-SPIDER
agents/fundamentalAgent.ts - SENTI-SPIDER
agents/sentimentAgent.ts - NEXUS synthesis · Combines confidence and cross-agent agreement or disagreement.
agents/synthesis.ts - Risk adaptation · Reframes conclusions for conservative or aggressive profiles.
agents/personalization.ts - Pipeline trace · Records actual stage status and latency.
agents/reasoningTrace.ts
Market data
- Market data client · Caching and normalized market-data access.
market/marketDataClient.ts - Yahoo provider
market/yahooFinanceProvider.ts - Technical indicators · Computes RSI, MACD, EMA, momentum, volume, and levels.
market/indicators.ts - Finnhub provider
market/finnhubProvider.ts
Evidence RAG
- Corpus ingestion · Extracts and chunks per-symbol documents.
rag/ingest.ts - Vector index · Stores corpus embeddings per symbol.
rag/vectorIndex.ts - Evidence retrieval · Returns empty or unavailable when corpus or embeddings are absent.
rag/retrievalService.ts
Other components
- OpenAI embeddings
- Yahoo Finance
- Finnhub
Connections 29
- Dashboard → Analysis interaction
- Dashboard → Evidence panel
- Dashboard → Reasoning trace view
- Analysis interaction → Analysis API: analysis request
- Evidence panel → Evidence API: evidence request
- Dashboard → Stock & history APIs: quotes and charts
- Analysis API → TECH-SPIDER: parallel
- Analysis API → FUND-SPIDER: parallel
- Analysis API → SENTI-SPIDER: parallel
- TECH-SPIDER → Agent contracts: typed result
- FUND-SPIDER → Agent contracts: typed result
- SENTI-SPIDER → Agent contracts: typed result
- Agent contracts → NEXUS synthesis: specialist outputs
- NEXUS synthesis → Risk adaptation: base decision
- Risk adaptation → Analysis API: response
- Analysis API → Pipeline trace: stage status and latency
- Pipeline trace → Reasoning trace view: response artifact
- TECH-SPIDER → Market data client: history
- Market data client → Yahoo provider: provider access
- Yahoo provider → Yahoo Finance
- Market data client → Technical indicators: candles
- Stock & history APIs → Market data client: snapshots and history
- SENTI-SPIDER → Finnhub provider: relevant news
- Finnhub provider → Finnhub
- FUND-SPIDER → Evidence retrieval: grounded evidence
- Evidence API → Evidence retrieval: evidence query
- Evidence retrieval → Vector index: semantic search
- Corpus ingestion → Vector index: chunks and embeddings
- Corpus ingestion → OpenAI embeddings: generate embeddings