| title | Tradeverse AI |
|---|---|
| emoji | 📈 |
| colorFrom | blue |
| colorTo | green |
| sdk | docker |
| app_port | 7860 |
Tradeverse AI is a full-stack simulated trading platform. It lets users manage a virtual wallet, buy and sell equities in a paper portfolio, view live market prices, and run an experimental decision engine that combines news sentiment, vector search, and technical indicators.
The project is intended as a trading education and engineering showcase. It does not execute real trades and does not predict the future.
The application is split into three services:
- Frontend: React, Vite, Tailwind CSS v4, React Router, Axios, and Lucide React.
- Backend: Node.js, Express, MongoDB, Mongoose, JWT cookies, Redis price caching, and Finnhub API integrations.
- AI Engine: Python, FastAPI, Pinecone, Sentence Transformers, FinBERT, Finnhub news, Yahoo Finance (yfinance) for technical indicators, volatility filters, and market-regime heuristics.
graph TD
Client[React Frontend] --> Backend[Express Backend]
Backend --> AI[FastAPI AI Engine]
Backend --> MongoDB[(MongoDB)]
Backend --> Redis[(Redis Cache)]
Backend --> Finnhub[Finnhub API]
AI --> Pinecone[(Pinecone)]
AI --> Finnhub
AI --> Yahoo[Yahoo Finance]
- HttpOnly-cookie authentication with access and refresh tokens
- Virtual wallet and paper-trading portfolio
- Buy and sell order execution with MongoDB transactions
- Weighted average price calculation for repeated buys
- Trade history and portfolio endpoints
- Redis-backed live price caching
- Five-page trading dashboard: overview, markets, portfolio, AI engine, and auto-pilot
- Light and dark themes with a runtime token system and no flash on load
- TradingView chart, holdings table, allocation donut, and a live execution log
- AI signal endpoint combining sentiment and technical indicators
- Auto-pilot bot with risk-based position sizing, stop-loss, and take-profit guardrails
- Backend controller tests for core trade behavior
Tradeverse-Frontend/ React dashboard
src/components/ Layout (TopNav, TickerTape), charts, and UI primitives
src/context/ Auth and theme providers
src/hooks/ Data layer: wallet, live prices, AI execution, bot
src/pages/dashboard/ The five dashboard pages
Tradeverse-Backend/ Express API and MongoDB models
Tradeverse-AI/ FastAPI decision engine and market-news scripts
Tradeverse-AI/notebooks/ Standalone Colab notebooks for model experiments
docker-compose.yml Redis-only local helper
The interface is a warm-paper trading desk in light mode with a fully derived dark mode, typeset in DM Sans and JetBrains Mono.
Theming is a three-layer token system rather than scattered hex values:
- Semantic tokens (
--tv-page,--tv-card,--tv-ink,--tv-accent, ...) are declared insrc/index.csson:root, on:root[data-theme="dark"], and underprefers-color-scheme: dark. - Tailwind v4
@theme inlinemaps those tokens onto utilities such asbg-card,text-ink, andborder-line. Theinlinekeyword matters: without it, Tailwind bakes literal colour values into the utilities and runtime theme switching breaks. - Components reference utilities only, never raw tokens, so flipping the theme repaints the whole app without a React re-render.
Dark mode is a re-derivation, not an inversion: surfaces step up in lightness for elevation, the accent desaturates, and shadows give way to borders.
Two implementation notes worth knowing before editing the UI:
- SVG colours must be applied through a
styleprop. Presentation attributes such asstroke="var(--tv-up)"do not resolve CSS variables, so every themed chart setsstyle={{ stroke: ... }}instead. - The stored theme is applied by a small inline script in
index.htmlbefore first paint, so a dark preference never flashes light on load.
Create .env files from the provided examples:
Tradeverse-Frontend/.env.exampleTradeverse-Backend/.env.exampleTradeverse-AI/.env.example
Key variables include:
- Frontend:
VITE_API_URL(Backend API URL, all AI traffic is proxied here)
- Backend:
MONGODB_URI(MongoDB connection string)ACCESS_TOKEN_SECRET/REFRESH_TOKEN_SECRET(JWT authentication secrets)REDIS_URL(Redis cache URL for live price caching)FINNHUB_API_KEY(Finnhub API key for live price quotes)AI_SERVICE_URL/AI_SERVICE_SECRET(AI Engine endpoint and shared secret)- Cloudinary avatar-upload keys (
CLOUDINARY_CLOUD_NAME,CLOUDINARY_API_KEY,CLOUDINARY_API_SECRET)
- AI Engine:
PINECONE_API_KEY(Pinecone API key for news vector search)FINNHUB_API_KEY(Finnhub API key for fetching real-time market news)API_SECRET(Shared secret, must match backend'sAI_SERVICE_SECRET)
Install dependencies in each service:
cd Tradeverse-Backend
npm install
cd ../Tradeverse-Frontend
npm install
cd ../Tradeverse-AI
pip install -r requirements.txtStart Redis if you want price caching:
docker-compose up -dThis compose file intentionally starts Redis only. Full multi-service Docker orchestration is not included because the project is currently optimized for local development on limited disk space.
Run the services:
cd Tradeverse-Backend
npm run devcd Tradeverse-Frontend
npm run devcd Tradeverse-AI
uvicorn main:app --host 0.0.0.0 --port 8001POST /api/v1/users/registerPOST /api/v1/users/loginPOST /api/v1/users/logoutPOST /api/v1/users/refresh-tokenPOST /api/v1/users/wallet/addPOST /api/v1/users/wallet/withdrawGET /api/v1/users/balance
GET /api/v1/trades/price/:symbolPOST /api/v1/trades/buyPOST /api/v1/trades/sellGET /api/v1/trades/portfolioGET /api/v1/trades/history
POST /api/v1/ai/ask(Query news memory via Pinecone)POST /api/v1/ai/predict(Get ensemble trading recommendation)GET /api/v1/ai/health(Upstream connection health and warmup status)
POST /api/predict(Ensemble strategy prediction)POST /search(Embeds and queries news memory)GET /(Liveliness check)GET /warmup(Trigger embedding models lazy load)
The AI engine is a heuristic decision system, not a guaranteed market predictor. It combines:
- FinBERT sentiment from recent market headlines
- Pinecone vector search for relevant news memory
- RSI and moving-average signals
- Volatility guardrails
- Market-regime weighting
- A bounded Kelly-style risk allocation value
The output should be treated as a paper-trading signal for experimentation.
When the bot acts on a BUY signal, the position is sized by the engine's risk_pct
applied to cash buying power, then trimmed by the "Max capital / trade" setting:
riskDollars = buyingPower × risk_pct / 100
cappedDollars = min(riskDollars, maxCapital)
quantity = floor(cappedDollars / livePrice)
maxCapital is therefore a ceiling, not a budget — raising it can only ever trim
a position, never enlarge one. Because whole shares are the smallest unit, a small
balance combined with a conservative risk_pct can size to zero shares on a
high-priced symbol. When that happens the bot buys a single share, provided that
share fits inside both the per-trade cap and available buying power, and logs that it
did so. Without that fallback the bot skipped such symbols on every cycle
indefinitely.
Known limitation: sizing uses cash only and ignores the market value of open holdings, so an account holding positions is sized more conservatively than a pure-equity risk model would suggest.
The repository includes Tradeverse-AI/colab_backtester.py as a backtesting experiment,
plus Tradeverse-AI/notebooks/sentiment_backtest_colab.ipynb, a standalone Colab
notebook that exercises the FinBERT sentiment model in isolation against historical
prices with no backend running. Use them to reproduce and update performance claims
before adding any specific return or drawdown numbers to a resume.
Current limitation: the backtest is educational and should be reviewed for assumptions such as transaction costs, slippage, lookahead bias, and survivorship bias before presenting results as rigorous.
Backend:
cd Tradeverse-Backend
npm testFrontend (Vitest configured; currently contains no test files):
cd Tradeverse-Frontend
npm run lint
npm test # Runs vitest; exits with 1 if no tests are found
npm run build # Verify the production bundle compilesAI Engine:
cd Tradeverse-AI
# Run tests inside virtual environment
pytest tests/ -v- Full Docker orchestration is intentionally omitted to save local disk space.
- The AI service depends on external APIs and model downloads.
- MongoDB transactions require a deployment that supports transactions.
- The app is a simulator and is not connected to a real broker.
- Demo data is not seeded automatically yet.
- Add a seed script for demo users and sample portfolios
- Add integration tests around auth and wallet flows
- Add full Docker Compose or a cloud deployment recipe
- Add broker-sandbox integration, such as Alpaca paper trading
- Improve backtesting rigor and publish reproducible results