Retail investors and self-directed wealth managers face an acute information asymmetry: institutional hedge funds leverage Bloomberg terminals, multi-analyst research desks, and algorithmic portfolio optimizers, while retail participants are left with static stock charts, biased social media sentiment, and fragmented broker tools.
Prototyx democratizes institutional-grade portfolio intelligence by combining:
- Adversarial Multi-Agent Debate: A simulated live boardroom of 4 specialized AI financial agents (Macro, Fundamental, Technical, and Risk/Compliance) debating assets to reach unbiased consensus.
-
Parallel Agentic Asset Consultation: An orchestrator pattern that dispatches parallel workers for real-time quantitative telemetry (via
yFinance) and live sentiment/FUD discovery (viaDuckDuckGo Search), synthesized instantly via Groq LPUs. -
Quantitative Portfolio Risk Mesh: Mathematical cross-asset correlation analysis, Net Portfolio Exposure Index (
$\text{NEI}$ ), structural overlap alerts, and portfolio beta computation. - Mean-Variance Optimization (MVO): Markowitz Modern Portfolio Theory (MPT) rebalancing driven dynamically by AI return views with natural language rationales.
- Local-First Resilient Architecture: An offline-first Android client with Room database caching (30-minute auto-expiry), encrypted AES-256 credential storage, and seamless merge-sync with a cloud PostgreSQL database.
flowchart TB
subgraph Client["π± Android Native Client (Kotlin & Jetpack Compose)"]
UI["Bento-Grid UI Dashboard\n(Theme: Dark Neon & Gold)"]
VM["Architecture ViewModels\n(StateFlow & Coroutines)"]
Room["Room SQLite DB\n(Local-First Cache, 30m TTL)"]
SecStore["EncryptedSharedPreferences\n(AES-256 Master Key)"]
NetClient["Retrofit & OkHttp Engine\n(Auth Bearer Interceptor)"]
UI --> VM
VM --> Room
VM --> NetClient
SecStore -.-> NetClient
end
subgraph Gateway["βοΈ Backend Gateway (FastAPI on Render)"]
AuthMiddleware["OAuth2 & JWT Authenticator\n(Passlib & Bcrypt)"]
MergeSync["Merge-Sync State Engine"]
CloudDB[("PostgreSQL / SQLite Cloud DB\n(SQLModel ORM)")]
NetClient == "HTTPS / REST (JWT Bearer)" ==> AuthMiddleware
AuthMiddleware --> MergeSync
MergeSync <--> CloudDB
end
subgraph MultiAgentEngine["π€ Multi-Agent AI & Quant Engine"]
Committee["ποΈ Investment Committee Debate\n(Nvidia Nemotron-3 Ultra 550B via OpenRouter)"]
Orchestrator["π§ Manager Orchestrator\n(Groq LPU Qwen-3.8-27b)"]
DataWorker["π Data Analyst Worker\n(yFinance Real-Time Telemetry)"]
NewsWorker["π° News Researcher Worker\n(DuckDuckGo Live Search)"]
RiskMesh["πΈοΈ Quantitative Risk Mesh\n(NumPy Net Exposure & Correlation)"]
Optimizer["βοΈ Modern Portfolio Theory\n(Mean-Variance & Black-Litterman)"]
AuthMiddleware --> Committee
AuthMiddleware --> Orchestrator
AuthMiddleware --> RiskMesh
AuthMiddleware --> Optimizer
Orchestrator --> DataWorker
Orchestrator --> NewsWorker
end
Rather than relying on a single biased LLM prompt, Prototyx simulates a live, adversarial boardroom debate among four virtual financial specialists:
- π Macro Analyst Agent: Evaluates central bank interest rates, inflation regimes, currency headwinds, and macroeconomic indicators.
- π Fundamental Analyst Agent: Audits earnings quality, operating margins, Return on Equity (ROE), P/E ratios, and discounted cash flow dynamics.
- π Technical Analyst Agent: Analyzes multi-timeframe price action, 50/200-day moving average crossovers, and Relative Strength Index (RSI).
- π‘οΈ Compliance & Risk Agent: Enforces diversification mandates, sector exposure caps, maximum drawdown limits, and liquidity controls.
The debate is executed through Nvidia Nemotron-3 Ultra (550B) via OpenRouter. The backend parses the structured transcript in real time, extracts dialectical perspectives, and outputs a consensus vector of 12-month expected asset returns.
sequenceDiagram
autonumber
actor User as User (Android Client)
participant API as FastAPI Backend
participant LLM as OpenRouter (Nemotron-3 Ultra 550B)
participant Quant as Portfolio Optimizer
User->>API: POST /api/agents/debate { tickers: ["TCS", "RELIANCE"] }
API->>LLM: Ingest adversarial prompt & historical metrics
LLM-->>API: Stream multi-agent boardroom dialogue
Note over API: Parse [Macro], [Fundamental], [Technical], [Compliance] logs
Note over API: Extract JSON 12-Month Projected Return Views
API->>Quant: Feed return views into MVO / Black-Litterman
Quant-->>API: Optimal weights & Sharpe ratio
API-->>User: Structured debate logs + Rebalanced portfolio
Built on an asynchronous worker-orchestrator pattern:
- Manager Agent: Parses user natural language queries (e.g., "Should I buy Bitcoin?" or "Analyze NVDA"), isolates the target financial asset, and dispatches parallel worker routines.
- Data Analyst Worker: Asynchronously fetches spot prices, 30-day volatility, 52-week ranges, and trailing P/E from
yFinance. - News Researcher Worker: Conducts live web queries through
DuckDuckGo Search, aggregating breaking headlines, regulatory notices, and market FUD. - Synthesis Engine: Groq's high-speed LPU engine running
qwen/qwen3.8-27bsynthesizes the quantitative and qualitative inputs into:- Strategy Summary
- Risk Rating
- Action Verdict (
BUY|HOLD|SELL|WAIT)
The Risk Mesh mathematically prevents concentration risk and exposes hidden dependencies across user holdings:
- Cross-Asset Correlation Matrix: Evaluates pairwise sector and asset co-movements.
-
Net Portfolio Exposure Index (
$\text{NEI}$ ): Computes the inner-product risk density:$$\text{NEI} = \mathbf{w}^T \mathbf{C} \mathbf{w}$$ where$\mathbf{w}$ is the normalized portfolio weight vector and$\mathbf{C}$ is the cross-asset correlation matrix. -
Structural Redundancy Alerts: Automatically identifies and flags correlated asset clustering (e.g., holding heavy allocations in both
TCSandINFYwith$r = 0.85$ ). -
Portfolio Beta (
$\beta_p$ ):$$\beta_p = \sum_{i=1}^{N} w_i \beta_i$$ - Automated AI Risk Audit: Translates the matrix mathematics into a plain-English risk memo outlining vulnerabilities.
Implements Markowitz Modern Portfolio Theory (MPT) to calculate the efficient frontier:
- Ingests dynamic asset views
$\boldsymbol{\mu}$ produced by the AI Investment Committee. - Computes expected annual return, portfolio volatility, and optimal Sharpe ratio.
- Accompanied by an AI-generated rebalancing rationale explaining why specific asset weights were scaled or reduced.
- Android Client: Room SQLite database acts as the single source of truth for the UI. Market data is stamped with timestamps and expires after a 30-minute Time-To-Live (TTL), conserving battery and network bandwidth.
- Cloud Merge-Sync: When network connectivity is established, local weight adjustments are securely synced with the FastAPI backend over authenticated HTTPS endpoints.
- AES-256 Storage: User JWT access tokens and credentials are encrypted at rest using Android Jetpack
EncryptedSharedPreferences.
| Layer | Technology | Purpose |
|---|---|---|
| Mobile Client | Kotlin 2.0+ | Native Android execution, static typing, and coroutine concurrency |
| UI Framework | Jetpack Compose | Modern declarative Bento-style UI, dark aesthetic, interactive charts |
| Local Database | Room SQLite ORM | Local-first persistence, holding weights cache, 30-min TTL |
| Networking | Retrofit 2 + OkHttp 3 | REST communication with Bearer token interceptor and logging |
| Client Security | AndroidX Security Crypto | EncryptedSharedPreferences utilizing AES-256 keys |
| Backend API | FastAPI (Python 3.10+) | High-performance ASGI framework for routing and token validation |
| Backend ORM | SQLModel (SQLAlchemy) | Unified Pydantic and database schema modeling |
| Production Database | PostgreSQL / SQLite | Persistent relational storage for user accounts and portfolio states |
| LLM Inference (Debate) | Nvidia Nemotron-3 Ultra (550B) | Multi-agent boardroom debate via OpenRouter API |
| LLM Inference (Synthesis) | Qwen-3.8-27B on Groq LPU | Ultra-low latency asset consultation and worker orchestration |
| Market Telemetry | yFinance API | Real-time prices, historical volatility, and company fundamentals |
| Web Research | DuckDuckGo Search API | Live financial news retrieval and sentiment scraping |
| Mathematical Engine | NumPy & SciPy | Cross-asset matrix dot-products, Net Exposure Index, beta calculations |
| Hosting & Cloud | Render Cloud Platform | Fully managed deployment for containerized ASGI service |
Prototyx/
βββ android/ # Native Android Mobile Application
β βββ app/
β β βββ build.gradle.kts # Android dependencies & SDK configurations
β β βββ src/main/
β β βββ AndroidManifest.xml # Permissions & application declaration
β β βββ java/com/example/prototyx/
β β βββ MainActivity.kt # Main Compose entrypoint
β β βββ PrototyxApp.kt # App scaffold & navigation host
β β βββ Navigation.kt # Navigation graphs & routes
β β βββ data/
β β β βββ DataRepository.kt # Local-first repository pattern
β β β βββ local/ # Room DB entities, DAOs & database
β β β βββ model/ # Client domain data models
β β β βββ network/ # Retrofit instance & API endpoints
β β β βββ security/ # EncryptedSharedPreferences AuthManager
β β βββ theme/ # Color tokens, Typography & Dark Theme
β β βββ ui/
β β βββ components/ # Bento cards, buttons, dialogs
β β βββ screens/
β β βββ DashboardScreen.kt # Bento-grid holdings & quick actions
β β βββ CommitteeScreen.kt # Live 4-agent boardroom debate
β β βββ RiskMeshScreen.kt # Net exposure & correlation mesh
β β βββ OptimizerScreen.kt # MVO Sharpe optimizer & rebalancing
β β βββ EarningsScreen.kt # Transcripts & LLM summaries
β β βββ LoginScreen.kt # JWT authentication & registration
β βββ gradle/ # Gradle wrapper configuration
β βββ build.gradle.kts # Root Gradle build script
β βββ settings.gradle.kts # Project plugins & module definitions
β
βββ backend/ # Python FastAPI Cloud Backend
β βββ app.py # Main FastAPI gateway & route controllers
β βββ database.py # SQLModel engine & session management
β βββ models.py # Relational DB models & Pydantic schemas
β βββ auth_utils.py # Password hashing (Bcrypt) & JWT creation
β βββ requirements.txt # Python dependencies
β βββ test_backend.py # Quantitative & agent integration tests
β βββ test_auth.py # Authentication & holdings sync tests
β βββ .env # Environment variables & API credentials
β βββ agents/
β β βββ committee.py # Nemotron-3 Ultra investment committee
β β βββ orchestrator.py # Groq LPU Manager, Data & News workers
β βββ quant/
β β βββ risk_mesh.py # Net Exposure Index & correlation matrix
β β βββ optimizer.py # Mean-Variance Optimization engine
β βββ data/
β βββ market_data.py # yFinance market metric scrapers
β βββ earnings.py # Earnings transcript fetchers & parsers
βββ README.md # Master documentation & technical manual
Base URL (Production): https://prototyx.onrender.com
Base URL (Local Development): http://localhost:8000
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/api/auth/register |
No | Register a new user (email, password, name). Returns JWT. |
POST |
/api/auth/login |
No | Authenticate user credentials. Returns JWT access token. |
POST |
/api/holdings/sync |
Bearer Token | Merge-sync client holdings dictionary { "TICKER": weight }. |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/api/agents/debate |
Optional | Triggers the 4-agent boardroom debate for given ticker symbols. |
POST |
/api/agents/consult |
Optional | Natural-language query orchestrating Data & News workers via Groq. |
POST |
/api/quant/risk-mesh |
Optional | Computes correlation matrix, Net Exposure Index, beta, and structural alerts. |
POST |
/api/quant/optimize |
Optional | Computes MVO rebalancing weights, Sharpe ratio, and AI rationale. |
GET |
/api/market/indicators/{ticker} |
Optional | Fetches real-time price, RSI, moving averages, and volatility. |
GET |
/api/earnings/transcript/{ticker} |
Optional | Fetches earnings transcript and AI executive summary. |
curl -X POST "https://prototyx.onrender.com/api/agents/debate" \
-H "Content-Type: application/json" \
-d '{"tickers": ["TCS", "RELIANCE", "AAPL"]}'curl -X POST "https://prototyx.onrender.com/api/holdings/sync" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_JWT_ACCESS_TOKEN>" \
-d '{"holdings": {"NVDA": 0.35, "AAPL": 0.25, "MSFT": 0.40}}'- Android Studio: Ladybug (2024.2.1) or newer with Android SDK Platform 36
- Java Development Kit: JDK 17
- Python: Python 3.10 or higher
- Git: Version control
git clone https://github.com/MaxasOP/Prototyx.git
cd Prototyx-
Navigate to the
backend/directory:cd backend -
Create and activate a Python virtual environment:
# Windows python -m venv venv .\venv\Scripts\activate # macOS / Linux python3 -m venv venv source venv/bin/activate
-
Install required dependencies:
pip install -r requirements.txt
-
Configure environment variables in
backend/.env:OPENROUTER_API_KEY=your_openrouter_api_key GROQ_API_KEY=your_groq_api_key SECRET_KEY=your_random_jwt_secret_key DATABASE_URL=sqlite:///./prototyx.db # For PostgreSQL: postgresql://user:password@localhost:5432/prototyx
-
Run test suites to verify system health:
python test_backend.py python test_auth.py
-
Start the development server:
uvicorn app:app --host 0.0.0.0 --port 8000 --reload
Interactive Swagger UI will be available at:
http://localhost:8000/docs
- Open Android Studio.
- Select Open and select the
Prototyx/androiddirectory. - Allow Gradle to download dependencies and sync the project.
- Verify server endpoint configuration in
RetrofitInstance.kt:- By default, the app targets the live production cloud backend:
https://prototyx.onrender.com/ - To switch to local development, update the base URL to your machine's local IP or Android emulator loopback:
RetrofitInstance.updateBaseUrl("10.0.2.2:8000") // Android Emulator loopback
- By default, the app targets the live production cloud backend:
- Select a connected device or an Android Virtual Device (AVD running API 24+) and click Run (
Shift + F10).
- Cryptographic Password Hashing: Passwords stored on the server are hashed using standard
Bcryptwith salt rounds viapasslib. Plaintext passwords are never recorded. - Stateless JWT Authorization: API sessions utilize time-delimited HMAC-SHA256 tokens. Protected endpoints enforce bearer token validation.
- Encrypted Client Keystore: Tokens on the mobile client are held in
EncryptedSharedPreferences, utilizing the Android Keystore system with AES-256-GCM encryption. - Deterministic Fallbacks: If external LLM gateways experience latency or rate limits, the backend gracefully falls back to deterministic local quantitative algorithms without crashing.
- Markowitz, H. (1952). Portfolio Selection. The Journal of Finance, 7(1), 77β91. doi:10.1111/j.1540-6261.1952.tb01525.x
- Black, F., & Litterman, R. (1992). Global Portfolio Optimization. Financial Analysts Journal, 48(5), 28β43. doi:10.2469/faj.v48.n5.28
- FastAPI Project Documentation (2026). FastAPI: Modern, High-Performance Web Framework for Python. fastapi.tiangolo.com
- Google Android Developers (2026). Jetpack Compose Architecture and Room Database Guidelines. developer.android.com/jetpack/compose
- OpenRouter API Documentation (2026). Unified Interface for Large Language Models. openrouter.ai/docs
- Groq Cloud Documentation (2026). LPU Inference Engine and API Reference. groq.com
Distributed under the MIT License. See LICENSE for more information.