Use this file to discover all available pages before exploring further.
backtest-kit-redis-mongo-docker implements a two-layer persistence architecture: MongoDB serves as the durable source of truth for all trading data, while Redis acts as a high-speed O(1) identity cache that accelerates repeated context-key lookups during backtests and live runs. Every read path checks Redis first; only on a cache miss does the adapter fall back to MongoDB, after which it immediately backfills the cache so subsequent reads stay fast.
After the upsert returns, the cache entry is updated in the same synchronous critical section, so readXData called immediately afterward always sees the freshly written value.
All services are wired together in src/lib/index.ts via a lightweight IoC container built on di-factory. The container is partitioned into three groups:
The registration happens in src/lib/core/provide.ts using provide(TYPES.xxx, () => new XService()) calls, and src/lib/index.ts exposes the resolved instances via the ioc object:
All 15 adapter registrations in src/config/setup.ts use ioc.xDbService and ioc.xCacheService directly; no adapter needs to know whether it is talking to Mongo or Redis.
Before any adapter method does real work on its first call, it awaits waitForInfra() — a singleshot promise that resolves only after both mongoService.waitForInit() and redisService.waitForInit() complete. Subsequent calls skip the guard at zero cost.