Weekly in-cluster CronJob running multistrat_bot.py on IBKR paper via the existing ib-gateway (connects to ib-gateway:4002 directly, no port-forward). Lean: code via ConfigMap (no image build), python:3.12-slim + runtime pip. Includes PVC (state/HWM persistence across runs), egress NetworkPolicy (ib-gateway:4002 + 443 for pip/Yahoo + DNS), and ib-gateway ingress patched to allow the rebalancer. Schedule Mon 14:35 UTC (~1h after US open). MULTISTRAT_EXECUTE=false by default (cluster dry-run); flip to true after validating logs. Drawdown CB + leverage cap + idempotency + paper-guard enforced by the bot. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
45 lines
973 B
YAML
45 lines
973 B
YAML
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: ib-gateway
|
|
namespace: foxhunt
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
app: ib-gateway
|
|
policyTypes:
|
|
- Ingress
|
|
- Egress
|
|
ingress:
|
|
- from:
|
|
- podSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: trading-service
|
|
- podSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: broker-gateway
|
|
- podSelector:
|
|
matchLabels:
|
|
app: multistrat-rebalancer
|
|
ports:
|
|
- protocol: TCP
|
|
port: 4002
|
|
- protocol: TCP
|
|
port: 4004
|
|
egress:
|
|
# IBKR external servers
|
|
- to:
|
|
- ipBlock:
|
|
cidr: 0.0.0.0/0
|
|
except:
|
|
- 10.0.0.0/8
|
|
- 172.16.0.0/12
|
|
- 192.168.0.0/16
|
|
ports:
|
|
- protocol: TCP
|
|
port: 443
|
|
- protocol: TCP
|
|
port: 4000
|
|
- protocol: TCP
|
|
port: 4001
|