Persistence (Developer Guide)
What It Does
The historical cache stores normalized bars and watermarks to reduce REST calls and make backtests deterministic.
Why It Exists
FYERS history calls are rate limited and can be slow. A cache makes repeated runs predictable and cheaper.
Config Dependencies
config/cache.yamlconfig/nse_calendar.yaml
With Backtrader
The Store uses the cache automatically when you call get_history(...).
Without Backtrader
You can instantiate SQLiteHistoricalCache directly if needed.
Limitations
- Cache is rebuildable and not a source of truth.
- SQLite allows one writer; multi-process writes require careful tuning.
Scenario Example
Scenario: You need to wipe history data without affecting live state.
- Delete only the cache DB path from cache.yaml.
- Do not delete the state DB.