Skip to main content

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

// Default import (most common)
import ioc from './lib';

// Named import — both resolve to the same object
import { ioc } from './lib';
Importing either form triggers 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.
ioc.loggerService
LoggerService
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.
ioc.redisService
RedisService
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.
ioc.minioService
MinioService
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 a BaseStorage 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.
ioc.candleDataService
CandleDataService
Manages OHLCV candle records in MinIO.
  • create(candle) — writes a single candle object
  • hasCandle(symbol, interval, timestamp) — existence check without downloading the body
  • findBySymbolIntervalTimestamp(symbol, interval, timestamp) — fetches a specific candle by its composite key
ioc.signalDataService
SignalDataService
Persists the latest signal row per (symbol, strategyName, exchangeName) context.
  • findByContext(symbol, strategyName, exchangeName) — retrieves the current signal row
  • upsert(symbol, strategyName, exchangeName, signalRow) — writes or overwrites the signal row
ioc.scheduleDataService
ScheduleDataService
Persists scheduled signal rows per strategy context.
  • findByContext(symbol, strategyName, exchangeName) — retrieves the current scheduled signal row
  • upsert(symbol, strategyName, exchangeName, scheduleRow) — writes or overwrites the scheduled row
ioc.strategyDataService
StrategyDataService
Persists strategy state per (symbol, strategyName, exchangeName) context.
  • findByContext(symbol, strategyName, exchangeName) — retrieves current strategy state
  • upsert(symbol, strategyName, exchangeName, strategyRow) — writes or overwrites strategy state
ioc.riskDataService
RiskDataService
Persists open position records per (riskName, exchangeName) context.
  • findByContext(riskName, exchangeName) — retrieves current position data
  • upsert(riskName, exchangeName, positions, when) — writes or overwrites position data
ioc.partialDataService
PartialDataService
Persists partial fill data per (symbol, strategyName, exchangeName, signalId) context.
  • findByContext(symbol, strategyName, exchangeName, signalId) — retrieves partial fill state
  • upsert(symbol, strategyName, exchangeName, signalId, data, when) — writes or overwrites partial state
ioc.breakevenDataService
BreakevenDataService
Persists breakeven management data per (symbol, strategyName, exchangeName, signalId) context.
  • findByContext(symbol, strategyName, exchangeName, signalId) — retrieves breakeven state
  • upsert(symbol, strategyName, exchangeName, signalId, data, when) — writes or overwrites breakeven state
ioc.storageDataService
StorageDataService
Persists closed-trade storage records, separated by backtest/live mode.
  • listByMode(backtest) — lists all storage records for the given mode
  • upsert(backtest, id, signal) — writes or overwrites a single storage record by ID
ioc.notificationDataService
NotificationDataService
Persists notification records (alerts, trade events), separated by backtest/live mode.
  • listByMode(backtest) — lists all notification records for the given mode
  • upsert(backtest, id, notification) — writes or overwrites a single notification record by ID
ioc.logDataService
LogDataService
Persists strategy log entries with a Redis-backed time-ordered index.
  • upsert(id, entry) — writes or overwrites a log entry
  • findByEntryId(id) — fetches a single log entry by ID
  • listAll() — returns all log entries ordered by the Redis index
ioc.measureDataService
MeasureDataService
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 entry
  • softRemove(bucket, key) — marks an entry as removed without deleting the MinIO object
  • listKeys(bucket) — returns all active (non-removed) keys for the bucket
ioc.intervalDataService
IntervalDataService
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 entry
  • softRemove(bucket, key) — marks an entry as removed
  • listKeys(bucket) — returns all active keys for the bucket
ioc.memoryDataService
MemoryDataService
Persists named memory entries per (signalId, bucketName, memoryId) context; supports existence checks and soft removal.
  • findByMemoryId(signalId, bucketName, memoryId) — fetches a memory entry
  • hasMemoryEntry(signalId, bucketName, memoryId) — existence check without fetching the body
  • upsert(signalId, bucketName, memoryId, data, when) — writes or overwrites a memory entry
  • softRemove(signalId, bucketName, memoryId) — marks an entry as removed
  • listEntries(signalId, bucketName) — returns all active entries for the (signalId, bucketName) scope
ioc.recentDataService
RecentDataService
Persists the most-recent trade summary per (symbol, strategyName, exchangeName, frameName, backtest) context.
  • findByContext(symbol, strategyName, exchangeName, frameName, backtest) — retrieves current recent data
  • upsert(symbol, strategyName, exchangeName, frameName, backtest, signalRow, when) — writes or overwrites recent data
ioc.stateDataService
StateDataService
Persists arbitrary signal-scoped state per (signalId, bucketName) context.
  • findByContext(signalId, bucketName) — retrieves current state
  • upsert(signalId, bucketName, data, when) — writes or overwrites state
ioc.sessionDataService
SessionDataService
Persists session-level data per (strategyName, exchangeName, frameName, symbol, backtest) context.
  • findByContext(strategyName, exchangeName, frameName, symbol, backtest) — retrieves current session data
  • upsert(strategyName, exchangeName, frameName, symbol, backtest, data, when) — writes or overwrites session data

Connection services

The three connection services extend BaseMap 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.
ioc.logConnectionService
LogConnectionService
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 registration
  • listNewest(limit, prefix?) — walks backwards through minute Sets from now to the floor, returning up to limit unique object names; optionally filters by prefix
ioc.notificationConnectionService
NotificationConnectionService
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 minute
  • listNewest(limit, prefix?) — returns up to limit unique object names in reverse-chronological order
ioc.storageConnectionService
StorageConnectionService
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 minute
  • listNewest(limit, prefix?) — returns up to limit unique object names in reverse-chronological order

globalThis access

After module initialisation, src/lib/index.ts assigns ioc to globalThis:
Object.assign(globalThis, { ioc });
This means that in a Node.js REPL session started via npm run start:repl, you can access any service directly without an import:
// Inside a REPL or debug console
await ioc.candleDataService.findBySymbolIntervalTimestamp("BTCUSDT", "1h", 1700000000000);
await ioc.logConnectionService.listNewest(10);
This assignment has no effect outside the REPL — it does not pollute application code because 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.

Build docs developers (and LLMs) love