π
VPN Gateway
Site-to-Site VPN to On-Premises Edge
IPsec encrypted tunnel
Static routing configured
azurerm_virtual_network_gateway
Bidirectional | Latency: ~15-30ms
π³
Azure Container Registry (ACR)
Private Docker image repository
Multi-architecture support (amd64/arm64)
Geo-replication enabled
Automated vulnerability scanning
azurerm_container_registry
Push/Pull: CI/CD + Edge K8s cluster
π¦
Container Instances (Optional)
Serverless container deployment
Backend API containers
Auto-scaling based on load
Pay-per-second billing
azurerm_container_group
π
Network Security Group
Dynamic firewall rule management
Whitelist on-premises public IP
Connection audit logging enabled
DDoS protection tier integrated
azurerm_network_security_group
βοΈ
App Service (Backend API)
Python Flask/FastAPI REST API
IBKR TWS API integration layer
Real-time strike data processing
Anomaly detection algorithms
azurerm_linux_web_app | Python 3.11
Publishes signals β SignalR Hub
π‘
SignalR Service
Real-time WebSocket infrastructure
Alert broadcast to edge subscribers
Persistent connection management
Auto-scaling enabled
azurerm_signalr_service
Stream β On-Premises Trading Engine
π
Static Web App (Dashboard)
HTML5 Canvas + JavaScript SPA
Public-facing analytics dashboard
Azure CDN global distribution
SSL/TLS encryption enabled
azurerm_static_site
π
Application Insights
Distributed tracing across hybrid infrastructure
Edge telemetry aggregation
Automated alert rules configured
Custom KPI dashboards
azurerm_application_insights
Ingests telemetry from edge nodes
πΎ
Table Storage
Anomaly event history retention
Trade execution audit log
Daily metrics aggregation
azurerm_storage_account
π
Key Vault
IBKR API credentials
VPN pre-shared key
Connection strings
Automated key rotation
azurerm_key_vault
π‘οΈ
Edge Gateway / Firewall
VPN client endpoint configured
NAT traversal enabled
Port forwarding for VPN ingress
DDoS protection at edge
pfSense / Enterprise Firewall
βΈοΈ
Kubernetes Cluster (minikube/k3s)
Single-node K8s cluster on edge
3 namespaces: trading-bots, monitoring, system
Persistent volume provisioning
LoadBalancer via MetalLB
Kubernetes v1.28+ | Docker runtime
π©
Helm Charts & Releases
Chart: spy-trading-bot (v1.2.0)
Values: dev.yaml / prod.yaml
Release management with rollback
Templated configurations
Helm 3 | Chart versioning
π³
Trading Bot Pods (Deployment)
Replicas: 3 (High Availability)
Image: acr.azurecr.io/spy-bot:v1.2
Resource limits: 512Mi RAM, 500m CPU
Rolling update strategy
Pod: spy-trading-bot | Python 3.11
Ingests: Real-time anomaly signals
π
Liveness & Readiness Probes
HTTP health checks every 10s
Auto-restart on failure
Graceful shutdown (30s timeout)
Zero-downtime deployments
K8s Health Checks
π
IBKR TWS Gateway (Containerized)
Docker image: ibkr-gateway:stable
StatefulSet for persistent connection
Paper trading account endpoint
Ultra-low latency local processing
K8s StatefulSet | TWS API 9.81+
Executes orders on IBKR infrastructure
βοΈ
ConfigMaps & Secrets
ConfigMap: Trading strategies, bot config
Secrets: IBKR credentials, Azure keys
Environment-specific configurations
Hot-reload without pod restart
K8s ConfigMaps & Secrets
πΎ
Persistent Volumes
PV: 10GB for SQLite database
PV: 5GB for trade logs
PV: 2GB for cache
Local storage class provisioner
K8s PV/PVC | Local storage
π
Monitoring Stack (Namespace: monitoring)
Prometheus for metrics collection
Grafana dashboards (K8s + Trading)
AlertManager for notifications
Node Exporter for host metrics
Prometheus + Grafana + AlertManager
π
Telemetry Agent
Forwards logs to Azure Monitor
Performance metrics collection
Connection health monitoring
Local alerting system
Azure Monitor Agent / Fluentd
Telemetry β Application Insights
πΎ
Edge Data Store
Local signal cache and backup
Trade execution history
Strategy configuration cache
Failover data persistence
SQLite3 / Redis
π
Watchdog Service
VPN connection health monitoring
Auto-restart on trading engine failure
Health checks every 30s
Email/Telegram alert integration
systemd / Windows Service Manager