Skip to content

StateSeedingManager

Development/testing-only manager that directly seeds SQLite with test portfolio state, bypassing all validation and business logic.

Purpose

StateSeedingManager is used exclusively in development and testing environments to create pre-configured portfolio states for test wallets. It directly inserts rows into SQLite tables (account, positions, challenge, limit_orders, daily_pnl, volume_history) without going through normal managers or validation.

This enables the dev dashboard to quickly generate wallets with specific scenarios (e.g., a position near liquidation, a challenge close to passing, specific volume tiers) without needing to execute real trades.

The manager includes an environment guard that blocks execution in production and staging.

Edge Cases & Error Handling

  • Hard environment guard: blocks execution in production and staging environments
  • Bypasses all validation: invalid data will be inserted as-is (test-only tool)
  • SL/TP alerts and AccountValueTracker subscriptions are NOT registered (noted as TODOs)
  • Limit orders are inserted with PENDING status but no PriceAlert registration
  • Challenge config uses hardcoded values for STARTER/STANDARD/PRO plans; unknown plans fall back to STARTER
  • Best day PnL is auto-calculated from dailyPnl if not explicitly provided
  • Default challenge start is 5 days ago if startedAt not specified
  • Errors during seeding are caught and returned as RPCResult failure

See Also