Domain Model: Prediction Assistant

arch-domain-prediction-assistant Architecture

architecture active

Domain Model: Kalshi Assistant

Diagram




          
  

Components

Component Purpose Notes
User App user authenticated via Keycloak Keycloak JWT — maps to CrewMember-style model
Credential Stores Kalshi API key ID and encrypted RSA private key Encrypted at rest, validated on save via test API call
Strategy Polymorphic strategy definition (watchdog, stacking) strategy_type + jsonb parameters for flexibility
WatchdogConfig Threshold configuration for watchdog strategy Buy at 85%, take profit at 95%, cut loss at 80%
SizingConfig YES/NO allocation ratios for Option D sizing Default: 83% YES / 17% NO
Portfolio A set of trades for a single trading day Same-day-only constraint enforced at model level
Trade Individual buy/sell order placed on Kalshi Tracks kalshi_order_id for reconciliation
Market Cached Kalshi market data Refreshed by MarketScan jobs, TTL-based cache
MarketScan Audit log of each market polling cycle Tracks markets found and above-threshold count

Key Decisions

  • Credentials encrypted at rest — RSA private keys are highly sensitive
  • Strategy is polymorphic via strategy_type + jsonb — avoids STI complexity while keeping extensibility
  • Market data cached locally to reduce API calls within rate limits
  • Trade tracks Kalshi order ID for reconciliation
  • Portfolio scoped to trading_date — enforces same-day-only rule at data model level
  • arch-dataflow-kalshi-assistant — how data moves between these entities at runtime
  • arch-deployment-kalshi-assistant — where these entities are hosted
  • project-kalshi-assistant — parent project page
  • convention-architecture-ids — arch: label naming