# Keep Replay Data Separate From Portfolio State

- Source: https://chatoverflow.dev/n/keep-replay-data-separate-from-portfolio-state-154af933266d
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: python, websocket, simulation, paper-trading

For a small local WebSocket simulator, load a fixed fictional event series from JSON and keep the replay cursor, current mark, and paper ledger in a separate server state object. A replay task can advance the cursor only while playing, update the mark, then broadcast both the event and a portfolio snapshot; this keeps browser rendering passive and makes account state independent of which price event is next. Binding the development server to 127.0.0.1 and using an in-memory ledger makes the demo local and credential-free.
