51 - Broker and System Config
Overview
Architecture Diagram
┌──────────────────────────────────────────────────────────────────────────────┐
│ Broker & System Configuration Architecture │
└──────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ Profile Section │
│ /profile │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ [Broker Config] [System Settings] [Security] [About] │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Broker Configuration │ │
│ │ │ │
│ │ Select Broker: [Zerodha ▼] │ │
│ │ │ │
│ │ API Key: [kite_api_key_xxxx ] │ │
│ │ API Secret: [•••••••••••••••••• ] │ │
│ │ User ID: [AB1234 ] │ │
│ │ Password: [•••••••• ] │ │
│ │ TOTP Key: [•••••••••••• ] │ │
│ │ │ │
│ │ [Test Connection] [Save Changes] │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ System Settings │ │
│ │ │ │
│ │ App Host: [127.0.0.1 ] │ │
│ │ App Port: [5000 ] │ │
│ │ Debug Mode: [ ] Enabled │ │
│ │ Log Level: [INFO ▼] │ │
│ │ │ │
│ │ WebSocket Host: [127.0.0.1 ] │ │
│ │ WebSocket Port: [8765 ] │ │
│ │ │ │
│ │ [Save Settings] │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
│
│ Save
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ Configuration Storage │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ .env File │ │
│ │ │ │
│ │ # Broker Configuration │ │
│ │ BROKER_API_KEY=kite_api_key_xxxx │ │
│ │ BROKER_API_SECRET=encrypted_or_masked │ │
│ │ BROKER=zerodha │ │
│ │ │ │
│ │ # System Configuration │ │
│ │ FLASK_HOST=127.0.0.1 │ │
│ │ FLASK_PORT=5000 │ │
│ │ FLASK_DEBUG=False │ │
│ │ │ │
│ │ # WebSocket Configuration │ │
│ │ WEBSOCKET_HOST=127.0.0.1 │ │
│ │ WEBSOCKET_PORT=8765 │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Database (Encrypted) │ │
│ │ │ │
│ │ broker_credentials table │ │
│ │ • Sensitive values encrypted with Fernet │ │
│ │ • Access tokens refreshed automatically │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘Broker Configuration
Supported Brokers
Broker
Auth Type
Required Fields
Broker-Specific Validation
Credential Masking
System Configuration
Environment Variables
Configuration Update Service
API Endpoints
Get Broker Config
Update Broker Config
Get System Config
Update System Config
Test Broker Connection
Frontend Components
Broker Config Form
System Settings Form
Security Measures
Credential Protection
Permission Checking
Key Files Reference
File
Purpose
Last updated