Automated, high-fidelity crypto trading journal tailored specifically for Delta Exchange users. Equipped with an event-driven FIFO trade matching engine, Indian speculative tax calculations, AES-128 field-level encrypted notes, AI-powered trade analysis, real-time WebSocket data, and a sleek React dashboard.
- π Introduction
- π§© Features
- ποΈ System Architecture
- βοΈ Prerequisites
- π Quick Start
- π€ AI Trade Analysis
- π Advanced Statistics
- π Benchmark Comparison
- π₯ Import & Export
- π Docker Outbound Proxy Routing (API Whitelisting)
- π‘οΈ Security Hardening & Concurrency
- π€ Contributing
- π License
Keeping a manual trading journal is tedious and error-prone. Delta Journal automates the entire loop. It securely syncs your read-only execution records from the Delta Exchange API, aggregates fragmented partial fills chronologically using a robust FIFO matching algorithm, extracts hidden economic costs like funding rates and GST, and serves them in a premium real-time React analytics platform.
- Real-time Overview: Live equity curves, active open positions, dynamic win rates, wallet balance, and integrated crypto news feeds.
- Advanced Statistics: Sharpe, Sortino, and Calmar ratios, max win/loss streaks, average hold time, gross P&L in a collapsible section.
- Benchmark Comparison: Toggle BTC/ETH/SOL return overlay on your equity curve via CoinGecko market data.
- OHLC Trade Charts: Entry/exit price candles with ReferenceDot markers inside the trade detail modal.
- Performance Calendars: Visually trace winning and losing streaks on an intuitive daily performance grid.
- Dynamic Currency Engine: Instantly toggle between USD and INR valuations globally across all pages and reports.
- Pages: Dashboard, Fees & Funding (with funding rate predictions), Journal (trade reviews), Import Data, Maintenance.
- Vertex AI (Gemini 2.5 Pro): Structured JSON critique via Pydantic schema β pattern identification, psychological state, mistakes, actionable suggestions, risk score.
- Ollama Support: Run local LLMs (Llama 3.2, etc.) with automatic model pulling on first use.
- One-click analysis button inside every trade detail modal.
- Derivative Speculative Slab-Rate: Programmatic categorization of derivative income under the personal income tax slab.
- Turnover & Audit Tracking: Automated calculations matching Section 44AB threshold requirements (βΉ10Cr audits).
- GST Separation: Extracts standard 18/118 financial GST components from dynamic trade commission fees.
- AES-128 Notes Encrypter: Daily reviews, mood markers, and strategic lessons are encrypted on-disk using military-grade AES-128 block ciphers and PBKDF2 key derivation.
- CSV Import: Drag-and-drop CSV files with smart column auto-detection (Delta, Binance, Bybit formats supported).
- Export Reports: Download trade-level and monthly summary CSV reports.
Delta Journal uses an event-driven sync engine combined with a secure local database that decouples heavy exchange API requests from the frontend client. WebSocket connections provide real-time positions, wallet, and margin data with REST fallback.
graph TD
subgraph "External API Layer"
Delta[Delta Exchange API]
CG[CoinGecko API]
end
subgraph "Backend Engine (FastAPI)"
WS[WebSocket Client: ws_client.py]
Sync[Sync Daemon: sync.py]
DB[(WAL SQLite: app.db)]
API[FastAPI Router: routes.py]
AI[AI Engine: ai.py]
Crypt[AES-128 Encryption Engine]
end
subgraph "Frontend Client (React)"
Dashboard[React SPA Dashboard]
end
Delta -->|REST + WebSocket| WS
Delta -->|Fetch Trades & Orders| Sync
Sync -->|FIFO Matching| DB
WS -->|Real-time Cache| API
AI -->|Vertex AI / Ollama| API
CG -->|Benchmark Prices| API
Crypt <-->|Encrypted Logs| DB
API <-->|Clean JSON APIs| DB
Dashboard <-->|Query Metrics| API
- Git
- Python: v3.11+ with uv package manager
- Bun: v1.3+ (install guide)
- API Credentials: Read-Only API Keys from Delta Exchange
- Ollama (recommended): For local AI analysis β runs at
http://localhost:11434
git clone https://github.com/VardhmanSurana/Journal.git
cd delta-journal
# Install backend dependencies
cd app/backend && uv sync && cd ../..
# Install frontend dependencies
cd app/frontend && bun install && cd ../..cp .env.example .envOpen .env and fill in your Delta Exchange API keys:
DELTA_API_KEY=your_read_only_key
DELTA_API_SECRET=your_read_only_secret
DELTA_REGION=india# Start both backend and frontend
make dev- Frontend:
http://localhost:5173 - Backend API:
http://localhost:8000
docker compose up --build -d- Frontend:
http://localhost:5173 - Backend API:
http://localhost:8000/api - Ollama:
http://localhost:11434
The backend connects to Ollama at
http://localhost:11434and pulls the configured model on first use.
Delta Journal supports two AI backends for trade critique:
| Provider | Setup | Model |
|---|---|---|
| Ollama (default) | No config needed β uses local Ollama at http://localhost:11434 |
Configurable via OLLAMA_MODEL |
| Vertex AI | Set AI_PROVIDER=vertex and PROJECT_ID in .env |
gemini-2.5-pro with structured Pydantic output |
The analysis returns: risk score (1-10), identified pattern, psychological state, mistake list, and actionable suggestions β displayed inside the trade detail modal.
No Delta Exchange API key is required for AI analysis.
The Dashboard includes a collapsible Advanced Statistics section with:
- Sharpe Ratio (risk-adjusted return)
- Sortino Ratio (downside deviation)
- Calmar Ratio (return vs max drawdown)
- Max Win / Loss Streaks
- Average Holding Time
- Gross P&L
Toggle benchmark overlays on the equity curve chart to compare your performance against major crypto assets:
- BTC (Bitcoin)
- ETH (Ethereum)
- SOL (Solana)
Powered by the free CoinGecko public API β no API key needed.
Navigate to Import Data page, drag-and-drop CSV files. The engine auto-detects column layouts from Delta Exchange, Binance, and Bybit export formats.
Download CSV reports from the Import Data page:
- Trade-level export: All closed trades with full metadata
- Monthly summary: Aggregated P&L, fees, and trade counts per month
No Delta Exchange API key needed for import/export features.
Delta Exchange API keys require IP Whitelisting for secure data fetching. If your Docker host environment operates behind a dynamic IP, Delta Journal natively supports routing all outbound queries through a Static Proxy.
# === STATIC IP PROXY (Optional) ===
PROXY_USER=proxyuser
PROXY_PASS=proxypass123
PROXY_IP=185.230.124.5
PROXY_PORT=8080
# Uncomment to activate:
# HTTP_PROXY=http://proxyuser:proxypass123@185.230.124.5:8080
# HTTPS_PROXY=http://proxyuser:proxypass123@185.230.124.5:8080- Read-Only by Design: The backend strictly excludes execution routes, buy/sell functions, and transaction capabilities.
- Write-Ahead Logging (WAL): SQLite initialized in WAL mode with a 30-second concurrency timeout.
- Robust Encryption: Journal notes, mistakes, emotions, and lessons are AES-128 encrypted before storage.
- Credential Masking: Secrets are programmatically redacted from all application logs and error stack traces.
- Real-time WebSocket: Persistent WebSocket connection to Delta Exchange reduces REST API calls and rate limit pressure.
- Fork the project.
- Create your Feature Branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the Branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Distributed under the MIT License. See LICENSE for more information.
