state.yaml
Defines the runtime state database used for crash recovery and reconciliation.
Used By
src/fyers_store/state/state_store.pysrc/fyers_store/store.pysrc/fyers_store/broker.py
Required Fields
version: 1state_db_pathaccount_id
Why It Exists
The state DB stores live order and position state so restarts do not double-apply fills. It is authoritative for recovery and must be kept separate from the historical cache.
Safe Defaults
- Use a stable, real account id.
- Place the DB on a local, reliable disk.
Dangerous Values
- Using the same path as
cache.db. - Changing
account_idbetween runs (resets state).
Example
version: 1
state_db_path: "state_db/fyers_state.db"
account_id: "YOUR_STABLE_ACCOUNT_ID"
When To Reset
Reset only if: - The schema is incompatible after a major upgrade. - The DB is corrupted and cannot be repaired.
Scenario Example
Scenario: Reconcile fails after a restart. - Verify the state DB path is correct and writable. - Check for schema mismatch errors in logs. - If needed, back up and delete the state DB, then restart to rebuild.