All MongoDB persistence inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-kit-redis-mongo-docker/llms.txt
Use this file to discover all available pages before exploring further.
backtest-kit-redis-mongo-docker is organised into 15 Mongoose schemas, one per domain concept. Each schema is defined in src/schema/ and registered as a Mongoose model that a corresponding DbService wraps. Every schema uses { timestamps: { createdAt: "createDate", updatedAt: "updatedDate" } } to get automatic timestamp management, and each defines a compound unique index that prevents duplicate entries for the same logical context. Schemas that track time-series or state snapshots include a when field (a Unix timestamp in milliseconds) to record the business-time of the last write.
candle-items
candle-items
Collection:
Model file:
Unique index:The
candle-itemsModel file:
src/schema/Candle.schema.tsUnique index:
(symbol, interval, timestamp)interval field is constrained to the enum ["1m","3m","5m","15m","30m","1h","2h","4h","6h","8h","1d"]. This schema is the only one where exchangeName is part of the document but not part of the unique index — the uniqueness constraint is on the OHLCV data tuple itself.signal-items
signal-items
Collection:
Model file:
Unique index:Stores the latest
signal-itemsModel file:
src/schema/Signal.schema.tsUnique index:
(symbol, strategyName, exchangeName)ISignalRow payload for a given (symbol, strategyName, exchangeName) triplet. The DbService uses upsert to keep exactly one document per context. minimize: false ensures empty objects in payload are preserved.schedule-items
schedule-items
Collection:
Model file:
Unique index:Persists the
schedule-itemsModel file:
src/schema/Schedule.schema.tsUnique index:
(symbol, strategyName, exchangeName)IScheduledSignalRow payload for scheduled signals. Structurally identical to signal-items but models a different domain concept.risk-items
risk-items
Collection:
Model file:
Unique index:
HasStores the
risk-itemsModel file:
src/schema/Risk.schema.tsUnique index:
(riskName, exchangeName)Has
when: YesRiskData positions array for a named risk manager on a given exchange. when records the business-time of the last position update. positions defaults to an empty array.partial-items
partial-items
Collection:
Model file:
Unique index:
HasStores
partial-itemsModel file:
src/schema/Partial.schema.tsUnique index:
(symbol, strategyName, exchangeName, signalId)Has
when: YesPartialData per signal instance. The signalId field is what makes this a per-signal (rather than per-strategy) record.breakeven-items
breakeven-items
Collection:
Model file:
Unique index:
HasStructurally identical to
breakeven-itemsModel file:
src/schema/Breakeven.schema.tsUnique index:
(symbol, strategyName, exchangeName, signalId)Has
when: Yespartial-items but stores BreakevenData. Both schemas use the same four-field compound unique index.storage-items
storage-items
Collection:
Model file:
Unique index:Stores
storage-itemsModel file:
src/schema/Storage.schema.tsUnique index:
(backtest, signalId)IStorageSignalRow payloads. The backtest boolean separates backtest records from live/paper trading records, so the same signalId can exist in both modes without conflict.notification-items
notification-items
Collection:
Model file:
Unique index:Follows the same
notification-itemsModel file:
src/schema/Notification.schema.tsUnique index:
(backtest, notificationId)backtest-scoped pattern as storage-items, storing NotificationModel payloads keyed by notificationId.log-items
log-items
Collection:
Model file:
Unique index:The only schema with a single-field unique constraint. Each
log-itemsModel file:
src/schema/Log.schema.tsUnique index:
(entryId) — single-field uniqueILogEntry is keyed by a globally unique entryId. There is no backtest scope — logs are shared across modes.measure-items
measure-items
Collection:
Model file:
Unique index:
Soft-delete: Yes (Supports soft-delete via the
measure-itemsModel file:
src/schema/Measure.schema.tsUnique index:
(bucket, entryKey)Soft-delete: Yes (
removed field)removed boolean. MeasureDbService.softRemove(bucket, key) sets removed: true rather than deleting the document. Reads check row.removed before returning data.interval-items
interval-items
Collection:
Model file:
Unique index:
Has
Soft-delete: Yes (Extends the
interval-itemsModel file:
src/schema/Interval.schema.tsUnique index:
(bucket, entryKey)Has
when: YesSoft-delete: Yes (
removed field)measure-items pattern with a when field to track business-time of the last interval write.memory-items
memory-items
Collection:
Model file:
Unique index:
Has
Soft-delete: Yes (Stores per-signal, per-bucket
memory-itemsModel file:
src/schema/Memory.schema.tsUnique index:
(signalId, bucketName, memoryId)Has
when: YesSoft-delete: Yes (
removed field)MemoryData entries. The three-part compound key allows a single signal to have multiple named memory buckets, each with multiple entries.recent-items
recent-items
Collection:
Model file:
Unique index:
HasThe broadest compound index in the codebase — five fields — uniquely identifies the most-recent
recent-itemsModel file:
src/schema/Recent.schema.tsUnique index:
(symbol, strategyName, exchangeName, frameName, backtest)Has
when: YesIPublicSignalRow for a given (symbol, strategy, exchange, frame, mode) combination.state-items
state-items
Collection:
Model file:
Unique index:
HasStores a single
state-itemsModel file:
src/schema/State.schema.tsUnique index:
(signalId, bucketName)Has
when: YesStateData snapshot per (signalId, bucketName) pair. Unlike memory-items, there is no memoryId — one state record per bucket per signal.session-items
session-items
Collection:
Model file:
Unique index:
HasPersists
session-itemsModel file:
src/schema/Session.schema.tsUnique index:
(strategyName, exchangeName, frameName)Has
when: YesSessionData for a strategy running on a given exchange and frame combination. One session record per (strategy, exchange, frame) triplet.Summary Table
| Collection | Unique Index | Has when | Soft-delete |
|---|---|---|---|
candle-items | (symbol, interval, timestamp) | No | No |
signal-items | (symbol, strategyName, exchangeName) | No | No |
schedule-items | (symbol, strategyName, exchangeName) | No | No |
risk-items | (riskName, exchangeName) | Yes | No |
partial-items | (symbol, strategyName, exchangeName, signalId) | Yes | No |
breakeven-items | (symbol, strategyName, exchangeName, signalId) | Yes | No |
storage-items | (backtest, signalId) | No | No |
notification-items | (backtest, notificationId) | No | No |
log-items | (entryId) | No | No |
measure-items | (bucket, entryKey) | No | Yes |
interval-items | (bucket, entryKey) | Yes | Yes |
memory-items | (signalId, bucketName, memoryId) | Yes | Yes |
recent-items | (symbol, strategyName, exchangeName, frameName, backtest) | Yes | No |
state-items | (signalId, bucketName) | Yes | No |
session-items | (strategyName, exchangeName, frameName) | Yes | No |