These three adapters track risk management state during a live or paper trading session. Risk holds a snapshot of all active positions grouped under a named risk manager on a given exchange. Partial holds the per-signal partial profit/loss level map — which partial targets have been hit for a given open signal. Breakeven tracks whether the breakeven level has been reached for each open signal. Together they give the risk layer a durable, resumable view of the current exposure and take-profit progress across restarts.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/theonetrade/backtest-kit-minio-s3-docker/llms.txt
Use this file to discover all available pages before exploring further.
The
writePositionData, writePartialData, and writeBreakevenData methods all accept a when: Date parameter. This timestamp is persisted inside the stored document (when field, stored as epoch milliseconds) for audit and ordering purposes, but it does not become part of the MinIO object key. Keys for all three adapters are deterministic functions of context fields only — a write is always a single idempotent PUT at the same key regardless of when it is called.Risk adapter
Purpose
The Risk adapter persists theRiskData snapshot — an array of active position records — for a (riskName, exchangeName) pair. backtest-kit writes this snapshot after every position mutation made by the risk manager, and reads it on startup to restore the in-memory position list. One MinIO object per risk/exchange pair tracks the full current exposure.
The underlying service stores objects under the backtest-kit/risk-items/ prefix (bucket backtest-kit, folder risk-items).
Constructor context
src/config/setup.ts
riskName is the identifier of the risk manager instance (e.g. a named portfolio or risk policy), and exchangeName is the exchange it operates on. These two fields uniquely address one risk snapshot object.
Object key pattern
MainRisk on the ccxt exchange resolves to:
Interface methods
src/config/setup.ts
readPositionData returns the stored RiskData array, or an empty array [] if no snapshot has been written yet. The _when argument on the read side is accepted for interface compatibility but not used — the read always returns the latest upserted value. writePositionData persists both the positions array and the when timestamp inside the stored document.
Schema
src/schema/Risk.schema.ts
RiskData is the backtest-kit type representing the collection of active risk positions. when is stored as epoch milliseconds and can be used downstream for staleness checks or audit logging.
Adapter registration
src/config/setup.ts
Partial adapter
Purpose
The Partial adapter persists thePartialData map for a specific open signal — a record of which partial profit/loss levels have been triggered. It is scoped to (symbol, strategyName, exchangeName) at the constructor level, with signalId supplied at read/write time to address the per-signal bucket. backtest-kit writes after each partial hit and reads when resuming a signal mid-flight.
The underlying service stores objects under the backtest-kit/partial-items/ prefix.
Constructor context
src/config/setup.ts
signalId parameter on readPartialData and writePartialData.
Object key pattern
sig-abc123 on TRXUSDT / Jan2026Strategy / ccxt:
signalId, at which point it is overwritten.
Interface methods
src/config/setup.ts
readPartialData returns the stored PartialData map for the given signalId, defaulting to an empty object {} when no entry exists. The _when parameter is accepted for interface compatibility but is unused on reads. writePartialData records both the partial data and the when timestamp in the stored document.
Schema
src/schema/Partial.schema.ts
PartialData is the backtest-kit type that maps partial target names or indices to their execution state. when is stored as epoch milliseconds.
Adapter registration
src/config/setup.ts
Breakeven adapter
Purpose
The Breakeven adapter persists theBreakevenData record for a specific open signal — a map of flags indicating whether each breakeven level has been reached. Like the Partial adapter it is constructed with the trading context and addressed per-signal at runtime. backtest-kit writes after a breakeven trigger fires and reads when resuming a live session to avoid re-triggering already-activated breakevens.
The underlying service stores objects under the backtest-kit/breakeven-items/ prefix.
Constructor context
src/config/setup.ts
signalId is passed at read/write time.
Object key pattern
sig-abc123 on TRXUSDT / Jan2026Strategy / ccxt:
Interface methods
src/config/setup.ts
readBreakevenData returns the stored BreakevenData map for the given signalId, defaulting to an empty object {} if no record exists yet. The _when parameter is unused on reads. writeBreakevenData records both the breakeven state and the when timestamp in the stored document.
Schema
src/schema/Breakeven.schema.ts
BreakevenData is the backtest-kit type that maps breakeven target names or indices to their triggered state. when is stored as epoch milliseconds.
Adapter registration
src/config/setup.ts