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 uses a lightweight dependency injection container provided by di-kit and di-factory. All 22 services are registered, wired, and initialised when src/lib/index.ts is imported for the first time. The resulting ioc object is the primary entry point for consuming any service — whether you are writing a custom adapter, a data migration script, or a REPL debug session.
Importing ioc
init() from di.ts, which resolves and activates the full service graph. You do not need to call any setup function manually; the module side-effect handles it.
Base services
The three base services are the infrastructure layer. Higher-level data and connection services depend on them internally; you typically use them directly only when writing low-level tooling or waiting for readiness before running custom code.Provides structured logging. Exposes
log(), info(), warn(), and error() methods. Used internally by every other service to emit debug and operational messages. In VERBOSE mode all info-level messages are forwarded to stdout.Provides
waitForInit(): Promise<void> — a singleshot readiness gate that resolves once the Redis connection transitions to the ready state. All persist adapters registered in src/config/setup.ts call this before performing their first I/O. Throws with a descriptive error if Redis does not become ready within 15 seconds.Provides
getClient(bucketName: string): Promise<minio.Client> — a memoized factory that returns a minio.Client instance for the given bucket, creating the bucket automatically if it does not yet exist. One client instance is cached per bucket name.Data services
The 16 data services each wrap aBaseStorage instance (or a composition of them) to provide domain-specific read/write operations for a particular kind of backtest-kit data. All methods are async.
Manages OHLCV candle records in MinIO.
create(candle)— writes a single candle objecthasCandle(symbol, interval, timestamp)— existence check without downloading the bodyfindBySymbolIntervalTimestamp(symbol, interval, timestamp)— fetches a specific candle by its composite key
Persists the latest signal row per (symbol, strategyName, exchangeName) context.
findByContext(symbol, strategyName, exchangeName)— retrieves the current signal rowupsert(symbol, strategyName, exchangeName, signalRow)— writes or overwrites the signal row
Persists scheduled signal rows per strategy context.
findByContext(symbol, strategyName, exchangeName)— retrieves the current scheduled signal rowupsert(symbol, strategyName, exchangeName, scheduleRow)— writes or overwrites the scheduled row
Persists strategy state per (symbol, strategyName, exchangeName) context.
findByContext(symbol, strategyName, exchangeName)— retrieves current strategy stateupsert(symbol, strategyName, exchangeName, strategyRow)— writes or overwrites strategy state
Persists open position records per (riskName, exchangeName) context.
findByContext(riskName, exchangeName)— retrieves current position dataupsert(riskName, exchangeName, positions, when)— writes or overwrites position data
Persists partial fill data per (symbol, strategyName, exchangeName, signalId) context.
findByContext(symbol, strategyName, exchangeName, signalId)— retrieves partial fill stateupsert(symbol, strategyName, exchangeName, signalId, data, when)— writes or overwrites partial state
Persists breakeven management data per (symbol, strategyName, exchangeName, signalId) context.
findByContext(symbol, strategyName, exchangeName, signalId)— retrieves breakeven stateupsert(symbol, strategyName, exchangeName, signalId, data, when)— writes or overwrites breakeven state
Persists closed-trade storage records, separated by backtest/live mode.
listByMode(backtest)— lists all storage records for the given modeupsert(backtest, id, signal)— writes or overwrites a single storage record by ID
Persists notification records (alerts, trade events), separated by backtest/live mode.
listByMode(backtest)— lists all notification records for the given modeupsert(backtest, id, notification)— writes or overwrites a single notification record by ID
Persists strategy log entries with a Redis-backed time-ordered index.
upsert(id, entry)— writes or overwrites a log entryfindByEntryId(id)— fetches a single log entry by IDlistAll()— returns all log entries ordered by the Redis index
Persists arbitrary named measurement values within a scoped bucket; supports soft removal.
findByKey(bucket, key)— fetches a measure entry (returns null if soft-removed)upsert(bucket, key, data)— writes or overwrites a measure entrysoftRemove(bucket, key)— marks an entry as removed without deleting the MinIO objectlistKeys(bucket)— returns all active (non-removed) keys for the bucket
Persists named interval records within a scoped bucket; supports soft removal and timestamp-based writes.
findByKey(bucket, key)— fetches an interval entry (returns null if soft-removed)upsert(bucket, key, data, when)— writes or overwrites an interval entrysoftRemove(bucket, key)— marks an entry as removedlistKeys(bucket)— returns all active keys for the bucket
Persists named memory entries per (signalId, bucketName, memoryId) context; supports existence checks and soft removal.
findByMemoryId(signalId, bucketName, memoryId)— fetches a memory entryhasMemoryEntry(signalId, bucketName, memoryId)— existence check without fetching the bodyupsert(signalId, bucketName, memoryId, data, when)— writes or overwrites a memory entrysoftRemove(signalId, bucketName, memoryId)— marks an entry as removedlistEntries(signalId, bucketName)— returns all active entries for the (signalId, bucketName) scope
Persists the most-recent trade summary per (symbol, strategyName, exchangeName, frameName, backtest) context.
findByContext(symbol, strategyName, exchangeName, frameName, backtest)— retrieves current recent dataupsert(symbol, strategyName, exchangeName, frameName, backtest, signalRow, when)— writes or overwrites recent data
Persists arbitrary signal-scoped state per (signalId, bucketName) context.
findByContext(signalId, bucketName)— retrieves current stateupsert(signalId, bucketName, data, when)— writes or overwrites state
Persists session-level data per (strategyName, exchangeName, frameName, symbol, backtest) context.
findByContext(strategyName, exchangeName, frameName, symbol, backtest)— retrieves current session dataupsert(strategyName, exchangeName, frameName, symbol, backtest, data, when)— writes or overwrites session data
Connection services
The three connection services extendBaseMap to maintain a time-ordered Redis index of MinIO object names. Each one stores object names in minute-aligned Redis Sets (one Set per wall-clock minute) so that listNewest can walk backwards through time without scanning the full keyspace. All three have an identical interface.
Manages the time-ordered index for log data objects. Redis key prefix:
log-items-connection. TTL: none (-1).register(objectName)— records the MinIO object name in the Set for the current wall-clock minute and sets the floor marker if this is the first registrationlistNewest(limit, prefix?)— walks backwards through minute Sets from now to the floor, returning up tolimitunique object names; optionally filters byprefix
Manages the time-ordered index for notification data objects. Redis key prefix:
notification-items-connection. TTL: none (-1).register(objectName)— records the MinIO object name in the Set for the current wall-clock minutelistNewest(limit, prefix?)— returns up tolimitunique object names in reverse-chronological order
Manages the time-ordered index for closed-trade storage objects. Redis key prefix:
storage-items-connection. TTL: none (-1).register(objectName)— records the MinIO object name in the Set for the current wall-clock minutelistNewest(limit, prefix?)— returns up tolimitunique object names in reverse-chronological order
globalThis access
After module initialisation,src/lib/index.ts assigns ioc to globalThis:
npm run start:repl, you can access any service directly without an import:
globalThis is not a recommended import source in TypeScript.
The
init() call from src/lib/core/di.ts is already invoked as a module-level side-effect inside src/lib/index.ts. You do not need to call init() manually. Importing ioc (or the default export from ./lib) is sufficient to fully initialise the container.The injection tokens used to wire each service are
Symbol values defined in src/lib/core/types.ts and exported as TYPES. The di-kit createActivator("pro") call in src/lib/core/di.ts creates the inject, provide, and init helpers that wire the container; "pro" is the namespace string passed to the activator factory.