Documentation Index
Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-kit-minio-s3-docker/llms.txt
Use this file to discover all available pages before exploring further.
backtest-kit-minio-s3-docker ships 16 custom persist adapters that implement the full IPersist*Instance contract on top of MinIO (as the source of truth) and Redis (as a time-ordered index). Every adapter is registered in src/config/setup.ts via a PersistXAdapter.usePersistXAdapter() call. Strategy code, runners, and the CLI entrypoint stay unchanged — only the persistence layer is swapped. All 16 adapters share the same MinIO bucket, backtest-kit, and follow an identical initialization skeleton.
Common Adapter Skeleton
Each adapter gates its first initialization on Redis being ready via a single sharedsingleshot function called waitForInfra. Because singleshot runs the inner function exactly once regardless of how many adapters call it concurrently, all 16 instances block together on the first waitForInit(true) call and then proceed in parallel thereafter. The MinIO client itself connects lazily per bucket — no explicit MinIO init is needed.
The
waitForInfra function is a singleshot — it runs the Redis
waitForInit() exactly once across all 16 adapters. Subsequent calls (whether
from the same adapter or a different one) resolve immediately from a cached
promise. This means all adapters share a single initialization barrier rather
than each establishing their own Redis connection gate.Bucket and Folder Naming Convention
Everything lives in one MinIO bucket namedbacktest-kit. Each entity type gets a dedicated prefix inside that bucket, defined by passing a "bucket/folder" string to BaseStorage:
BaseStorage("breakeven-items")) would still mean a dedicated bucket — fully backward compatible with older adapters.
Inverted Timestamp
Three entity types — Log, Notification, and Storage — need newest-first listings. Rather than sorting after retrieval, these adapters embed an inverted timestamp in the object key:All 16 Adapters
| Adapter | Folder | Object Key | Purpose |
|---|---|---|---|
| Candle | candle-items/ | exchange/symbol/interval/timestamp | OHLCV cache; immutable inserts |
| Signal | signal-items/ | symbol/strategy/exchange | Live signal state per context |
| Schedule | schedule-items/ | symbol/strategy/exchange | Pending scheduled signal |
| Strategy | strategy-items/ | symbol/strategy/exchange | Deferred commit queue snapshot |
| Risk | risk-items/ | riskName/exchange | Active risk positions snapshot |
| Partial | partial-items/ | symbol/strategy/exchange/signalId | Partial profit/loss levels per signal |
| Breakeven | breakeven-items/ | symbol/strategy/exchange/signalId | Breakeven reached flag |
| Storage | storage-items/ | backtest/signalId | Closed/opened signal log per mode † |
| Notification | notification-items/ | backtest/⟲ts_notificationId | Event notifications † |
| Log | log-items/ | ⟲ts_entryId | Strategy log entries † |
| Measure | measure-items/ | bucket/entryKey | LLM/API response cache |
| Interval | interval-items/ | bucket/entryKey | Once-per-interval markers |
| Memory | memory-items/ | signalId/bucket/memoryId | Per-signal memory store |
| Recent | recent-items/ | symbol/strategy/exchange/frame/backtest | Last public signal per context |
| State | state-items/ | signalId/bucket | Per-signal state buckets |
| Session | session-items/ | strategy/exchange/frame/symbol/backtest | One session per running strategy |
Adapter Categories
The 16 adapters fall into four functional groups: Market data — immutable OHLCV history, insert-only semantics, point reads by exact timestamp. Trading state — the live, mutable state of running strategies. All use deterministic keys so an upsert is a single idempotentPUT with no read-before-write.
Event logs (Redis-indexed) — entities that need newest-first listing beyond what S3 lexicographic order can provide. These maintain a Redis minute-bucket index alongside MinIO objects, with a cold-index fallback to plain bucket listing when Redis is flushed.
Utility/cache — soft-delete adapters that physically remove the MinIO object on remove(). listKeys() is a pure prefix LIST — zero body reads.
Candle Adapter
OHLCV persistence with insert-only semantics, deterministic keys, and
stat-before-PUT deduplication. Covers
ICandleDto, ICandleRow, and the
interval-to-milliseconds mapping.Trading State Adapters
All 9 adapters that persist live strategy state: Signal, Schedule, Strategy,
Risk, Partial, Breakeven, Recent, State, and Session — each with constructor
args, read/write signatures, and key schemas.
Redis-Indexed Entities & Utility Adapters
Log, Notification, and Storage adapters with their Redis minute-bucket index,
cold-index fallback, and inverted timestamp keys. Plus Measure, Interval, and
Memory utility adapters with soft-delete semantics.