This document explains design choices for @kiploks/engine-core public APIs. It is not a tutorial; for “what do I call?” see [ENTRYPOINTS.md].
Why there is no single runEverything() function
A single catch-all entry point was rejected because:
-
Dishonest behavior — Missing inputs would force silent zeros, fake defaults, or a single object where every field is optional and nobody knows what triggers which block.
-
Unstable contracts — One mega-input type couples trades, WFA windows, equity curves, benchmark series, and adapter-specific blobs. Any change to one block would churn the whole type and every consumer.
-
Explicit composition — The engine exposes named entrypoints (
analyze,analyzeFromTrades,analyzeFromWindows) and helpers (mapPayloadToUnified, benchmark helpers, etc.). Callers compose what they need and pass only the data each part requires. -
Honest optional blocks — Optional sections use
BlockResultwithavailable: falseand a machine-readablereason(KiploksUnavailableReasonin [packages/contracts/src/errors.ts]) instead of pretending a block was computed.
Contributors: Do not add a mega-entrypoint without an ADR and a contract review. If you add a new block, extend the appropriate input contract and document why.
Related
- [
ENTRYPOINTS.md] — entrypoint map andmapPayloadToUnifiedwarning. - [
OPEN_CORE_METHODOLOGY.md] — methodology scope and validation model.