Storage, Notification, and Log are the three audit-trail adapters. Rather than storing a single value per unique context key, each of these adapters manages a growing list of records — closed signal entries, event notifications, and strategy log lines — and exposes bulk read and write methods. Unlike the signal-lifecycle adapters, none of these three carries aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/theonetrade/backtest-kit-redis-postgres-pgpool-docker/llms.txt
Use this file to discover all available pages before exploring further.
when column; they are not subject to look-ahead-bias filtering.
Storage Adapter
The Storage adapter is the signal journal. It records every signal that has been closed or opened, segregated by execution mode (backtest: true vs. live/paper). Its read* method returns all records for the current mode; its write* method upserts each item in the array individually using an atomic INSERT … ON CONFLICT … DO UPDATE RETURNING *.
Context Key and Table
| Field | Type | Role |
|---|---|---|
backtest | boolean | Execution mode flag — true in backtest, false in live/paper |
signalId | string | Unique signal identifier — one row per signal |
storage-items — unique index storage_items_uq on (backtest, signalId)
Registration
Table Schema
Column Reference
Auto-generated UUID primary key.
Execution mode flag. Rows from a backtest run are isolated from live/paper rows. Part of the unique index.
The signal’s own identifier, taken from
signal.id in writeStorageData. Part of the unique index.Full signal entry.
IStorageSignalRow is the type exported by backtest-kit containing all closed-signal fields.Set by TypeORM on first insert.
Updated by TypeORM on every write.
Methods
readStorageData() → StorageData
readStorageData() → StorageData
Calls
storageDbService.listByMode(backtest) which issues a SELECT … WHERE backtest = $1 query. Returns the mapped payload array in insertion order.writeStorageData(signals: StorageData)
writeStorageData(signals: StorageData)
Iterates the array and calls
storageDbService.upsert(backtest, signal.id, signal) for each item. Each call is a single atomic INSERT … ON CONFLICT (backtest, signalId) DO UPDATE SET payload = EXCLUDED.payload RETURNING *. If a signal already exists (e.g., on a restart), its payload is updated in place.Notification Adapter
The Notification adapter stores event notifications fired during strategy execution. It shares the same mode-segregation pattern as Storage (backtest: boolean), but the second key field is notificationId rather than signalId. The read path reverses the DB result to restore original write order (oldest entry at index 0).
Context Key and Table
| Field | Type | Role |
|---|---|---|
backtest | boolean | Execution mode flag |
notificationId | string | Unique notification identifier |
notification-items — unique index notification_items_uq on (backtest, notificationId)
Registration
Table Schema
readNotificationData() calls .reverse() on the mapped payload array. NotificationDbService.listByMode returns rows in createDate DESC order (newest first); .reverse() converts that to ascending insertion order so index 0 holds the oldest entry, matching the write-order expected by backtest-kit.Column Reference
Execution mode flag. Part of the unique index.
The notification’s own identifier, taken from
notification.id in writeNotificationData. Part of the unique index.Full notification object. The type is
NotificationModel imported from backtest-kit (re-exported under that name to avoid a name collision with the TypeORM EntitySchema variable).Log Adapter
The Log adapter records strategy log entries — structured output lines produced by strategy code via backtest-kit’s logging API. Unlike Storage and Notification, the Log adapter has nobacktest mode flag; all entries share a single table partitioned only by entryId. The read path also reverses the list.
Context Key and Table
| Field | Type | Role |
|---|---|---|
entryId | string | Unique log entry identifier |
log-items — unique index log_items_uq on (entryId)
Registration
Table Schema
Column Reference
The log entry’s own identifier, taken from
entry.id in writeLogData. Forms the sole unique index.Full log entry object.
ILogEntry is the type exported by backtest-kit.Set by TypeORM on first insert.
Updated by TypeORM on every write.
Methods
readLogData() → LogData
readLogData() → LogData
Calls
logDbService.listAll(), which queries all log entries ordered by createDate DESC (newest first). .reverse() then converts the result to ascending insertion order — oldest entry at index 0 — matching the write-order expected by backtest-kit.writeLogData(entries: LogData)
writeLogData(entries: LogData)
Iterates the array and calls
logDbService.upsert(entry.id, entry) for each entry. Each call is an atomic INSERT … ON CONFLICT (entryId) DO UPDATE SET payload = EXCLUDED.payload RETURNING *. Existing entries are updated in place; new entries are inserted.Comparison: Storage vs. Notification vs. Log
- Storage
- Notification
- Log
- Context constructor field:
backtest: boolean - Per-item key column:
signalId - Table:
storage-items - Payload type:
IStorageSignalRow - Read ordering: insertion order (not reversed)
- Mode-isolated: yes (
WHERE backtest = $1)