A quantitative research and trading platform for market data, factor intelligence, strategy backtesting, risk analytics, and decision-ready reporting.
TradeFin Quant Intelligence connects the full quantitative workflow:
Market and alternative data
|
v
Data ingestion -> processing -> factors and signals -> backtesting
| |
v v
Trading data store risk and performance analytics
| |
+------------+-------------------------+
v
FastAPI operations UI | Streamlit research UI
|
Metabase operational analytics | Power BI executive reporting
The project is designed as a research and engineering platform. It is not a broker-certified execution system, and the current web API contains demonstration responses in several routes. Replace those fixtures with persisted data and authenticated broker adapters before using it with real capital.
- Market data: Yahoo Finance, Binance, Alpha Vantage, and WebSocket-oriented realtime components.
- Quant research: momentum, value, quality, size, and volatility factors; screening; portfolio optimization; and performance analysis.
- Strategy development: registry-based strategies, backtesting, parameter optimization, and extensible strategy interfaces.
- AI-assisted research: NLP preprocessing, sentiment analysis, news/social monitoring components, LLM integration, and sentiment factors.
- Risk analytics: position sizing, drawdown, VaR/CVaR, leverage, concentration, and portfolio monitoring components.
- Interfaces: a Streamlit research dashboard, a FastAPI service, and a responsive static web client.
- Persistence: SQLite by default, PostgreSQL support in the database manager, Redis-oriented realtime support, CSV/JSON/Excel exports, and local backtest artifacts.
- Performance path: a C++17 backend for data loading, order execution, risk management, and strategy-related components.
BI tools should read a stable analytics contract, not internal Python objects or live exchange endpoints. The recommended design is:
Trading services -> PostgreSQL operational store -> analytics views/materialized views
| |
Metabase Power BI
| Tool | Best fit in this project | Initial connection mode |
|---|---|---|
| Metabase | Team-facing operations: trade activity, system health, strategy runs, data freshness, and risk alerts | PostgreSQL database connection; SQLite only for local exploration |
| Power BI | Executive and portfolio reporting: attribution, monthly returns, drawdown, exposure, factor contribution, and scheduled packs | PostgreSQL Import mode first; DirectQuery when freshness and database capacity justify it |
| Streamlit | Research workflows and interactive model experimentation | Native Python integration |
| FastAPI | Commands, orchestration, and application-facing APIs | REST/OpenAPI |
The existing database tables provide a useful starting point:
market_data: OHLCV observations by symbol and timestamptrades: order and fill recordssignals: strategy signals and strengthperformance: daily P&L, returns, drawdown, Sharpe ratio, win rate, and trade counts
The first BI slice is implemented in bi/analytics_views_postgresql.sql, with views for trade facts, daily performance, latest market state, signal activity, and data quality. Include UTC timestamps, strategy identifiers, benchmark returns, data freshness timestamps, and a source-system/run identifier as the operational schema expands. Power BI and Metabase should consume these views with read-only credentials.
- Foundation: run PostgreSQL, migrate persisted market/trade/performance data from SQLite, and add indexes on symbol, timestamp, strategy, and date.
- Semantic layer: create analytics views with consistent definitions for return, P&L, drawdown, exposure, and trade status. Test them against the Python performance analyzer.
- Metabase: connect a read-only PostgreSQL user, curate collections for Operations, Risk, Strategies, and Data Quality, then add freshness and failed-run alerts.
- Power BI: connect through the PostgreSQL connector, build a star-shaped model around trade/performance facts and date, symbol, and strategy dimensions, then publish an executive report with row-level security where required.
- Reliability: schedule ETL/materialized-view refreshes, monitor row counts and freshness, document metric ownership, and keep BI credentials outside
config.json.
The repository now provides the storage primitives, curated PostgreSQL views, and a local export utility for this design. The BI connectors, deployment manifests, authentication, and production refresh jobs remain deployment work.
See bi/README.md for setup instructions, CSV export commands, and dashboard ideas inspired by Next Ventures' public focus on trader performance, execution, compliance, and global fintech operations.
backend/ C++17 engine components
data_service/
fetchers/ market and exchange integrations
processors/ cleaning and feature preparation
factors/ factor calculation, screening, optimization
strategies/ strategy registry and implementations
backtest/ simulation and performance analysis
ai/ NLP, sentiment, LLM, and alternative data
storage/ database and file persistence
realtime/ streaming and WebSocket components
dashboard/ Streamlit research dashboard
web/ FastAPI server and dashboard data endpoints
static/ browser client assets
tests/ Python test suite
backend/tests/ C++ component tests
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -e ".[test,visualization,realtime,web,bi]"
python examples\fetch_public_data.pyFor AI features, install the optional group:
pip install -e ".[ai]"Create a local configuration from config.example.json and add credentials only through environment-specific secret management. Do not commit API keys.
# Streamlit research dashboard: http://localhost:8501
python run_dashboard.py
# FastAPI web interface: http://localhost:8000
python run_web_interface.pyThe FastAPI application also exposes OpenAPI documentation at /docs when the server is running.
python bi\export_datasets.py --database data\trading_system.db --output bi_exportsFor a PostgreSQL deployment, use --db-type postgresql --connection-string "...". Metabase should connect directly to the curated PostgreSQL views; Power BI can use PostgreSQL Import mode or the generated CSVs for an offline prototype.
cmake -S backend -B backend/build
cmake --build backend/build --config Releasefrom data_service.backtest import BacktestEngine
from data_service.fetchers import BinanceFetcher
fetcher = BinanceFetcher()
print(fetcher.get_current_price("BTCUSD"))
engine = BacktestEngine(initial_capital=100000)
results = engine.run_backtest(strategy, historical_data)The project also exposes reusable factor, AI, storage, visualization, and strategy modules. See the examples directory for runnable workflows.
The FastAPI service currently includes endpoints for:
GET /api/healthGET /api/system/statusGET /api/strategiesPOST /api/backtest/runPOST /api/factors/analyzePOST /api/ai/analyzeGET /api/market/data/{symbol}GET /api/portfolio/statusGET /api/trades/recent
Before production use, add authentication, restrictive CORS, request limits, structured audit logs, and real repository-backed responses. Several current routes intentionally return sample data for UI demonstration.
pytest tests -vThe C++ tests can be built through the backend CMake project. Test coverage should be expanded around database migrations, analytics view definitions, broker adapters, and BI refresh validation as those layers are implemented.
- Factor Analysis
- AI Modules
- Quantitative Strategies
- Web Interface
- LangChain and LLM
- Trading Engine Architecture
TradeFin Quant Intelligence | Quantitative Trading and Fintech Intelligence Platform
- Built a modular Python/C++ quantitative platform that ingests market data, computes multi-factor signals, backtests strategies, and exposes research and operations workflows through Streamlit and FastAPI.
- Designed a PostgreSQL analytics contract with curated trade, performance, market, signal, and data-quality views for governed Metabase dashboards and Power BI reporting.
- Implemented reusable risk and performance analytics covering drawdown, VaR/CVaR, Sharpe ratio, win rate, leverage, concentration, and portfolio monitoring use cases.
- Integrated AI-assisted NLP and sentiment workflows with extensible strategy, storage, realtime, and data-fetching components for research-driven trading decisions.
This software is for educational and research purposes. It does not constitute investment advice. Trading involves substantial risk, and past performance does not guarantee future results.
MIT. See LICENSE.