Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/najmulhossainnj/Hedge-fund-backend/llms.txt

Use this file to discover all available pages before exploring further.

A Strategy is the top-level research artifact in the Hedge Fund Backend — the single entity that binds together a universe of symbols, a timeframe, a set of computed features, a trained ML model, and a signal logic definition. Every other domain object — features, models, signals, backtests, and validation runs — ultimately rolls up to a Strategy. Once a strategy passes backtesting and the validation gate, it can be promoted to the Portfolio Construction Layer for live trading or paper execution.

What is a Strategy?

At its core a Strategy is a named, versioned configuration record stored in the strategies table. It holds references (UUIDs) to the features, model, and signal logic it uses, plus the list of ticker symbols and the bar timeframe it operates on.
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Momentum RSI + Sentiment",
  "description": "Long/short strategy combining RSI momentum with news sentiment signals on US large-caps",
  "universe": ["AAPL", "MSFT", "GOOGL", "AMZN", "NVDA"],
  "timeframe": "1d",
  "feature_ids": [
    "f1000000-0000-0000-0000-000000000001",
    "f1000000-0000-0000-0000-000000000002"
  ],
  "model_id": "m1000000-0000-0000-0000-000000000001",
  "signal_logic_id": "s1000000-0000-0000-0000-000000000001",
  "pipeline_config": {
    "bars_per_year": 252,
    "risk_free_rate": 0.05,
    "size_type": "percent"
  },
  "status": "draft",
  "version": 1,
  "created_at": "2024-01-15T10:00:00Z",
  "updated_at": "2024-01-15T10:00:00Z"
}

Core Fields

FieldTypeDescription
namestringHuman-readable identifier, max 255 characters
descriptionstring | nullOptional prose describing the strategy hypothesis
universestring[]Array of ticker symbols the strategy trades
timeframestringBar resolution — "1d", "1h", "15m", etc.
feature_idsUUID[]References to Feature definitions in the Feature Store
model_idUUID | nullReference to the trained MLModel
signal_logic_idUUID | nullReference to a SignalLogic rule tree
pipeline_configobjectBacktest and execution settings (capital, fees, sizing)
statusstringLifecycle status — see below
versionintegerMonotonically incrementing optimistic-lock version

Strategy Statuses

The status field controls which operations are permitted on a strategy and whether it is eligible for promotion. Statuses are defined as string constants in the ORM:

draft

Initial state when a strategy is created. Features, model, and signal logic can be freely attached or replaced. No backtest has completed.

backtested

At least one backtest has completed successfully. Metrics are available for review. The strategy is ready for validation.

validated

Walk-forward analysis and/or CPCV have passed all configured gates. The strategy has demonstrated out-of-sample robustness.

promoted

The strategy has been promoted to the Portfolio Construction Layer and is eligible for live or paper trading.

archived

The strategy has been retired. Archived strategies are read-only; their historical results remain accessible.
The canonical promotion path is:
draft → backtested → validated → promoted
Status transitions are enforced by the API layer. You cannot promote a strategy that is not in validated status, and you cannot validate a strategy that has no completed backtest.

Strategy Lifecycle

Building a production-ready strategy involves six sequential phases. Each phase produces an artifact that feeds the next.
Create a strategy with POST /api/strategies. At this point only name, description, universe, timeframe, and pipeline_config are required. The strategy starts in draft status with no feature, model, or signal references.
{
  "name": "My First Strategy",
  "universe": ["AAPL", "MSFT"],
  "timeframe": "1d",
  "pipeline_config": {
    "bars_per_year": 252,
    "risk_free_rate": 0.0,
    "size_type": "percent"
  }
}
Define Feature records via POST /api/features for each indicator or dataset you want (e.g., RSI, ATR, news sentiment). Then update the strategy’s feature_ids array with PATCH /api/strategies/{id}. The Feature Engine will generate and version-hash the actual datasets on demand.
Create a model definition and train it via POST /api/models/{id}/train. The training request specifies the same feature_ids, symbol, and date range. On completion, model_id is written back to the strategy.
Use the Signal Builder or POST a SignalLogic rule tree to POST /api/signals. Attach it to the strategy by patching signal_logic_id. You can dry-run the rule tree against a prediction sample with POST /api/signals/validate-rule-tree before committing it.
Execute a backtest with POST /api/backtests + POST /api/backtests/{id}/execute. The pipeline resolves all referenced artifacts, runs the chosen engine (vectorbt or Backtrader), and persists the equity curve, trade list, and computed metrics. On success the strategy transitions to backtested.
Trigger walk-forward analysis with POST /api/validation/walk-forward or CPCV with POST /api/validation/cpcv. If all promotion gates are passed the strategy status automatically transitions to validated.
Call POST /api/strategies/{id}/promote. The API checks promotion readiness (see below) and — if satisfied — transitions status to promoted and signals the Portfolio Construction Layer.

Promotion Readiness Checklist

Before a strategy can be promoted, the following conditions must all be true:

Status is validated

The strategy must be in validated status, meaning all walk-forward and/or CPCV gates have been passed.

Completed backtest exists

At least one Backtest record linked to this strategy must have status == "completed".

Model is attached

model_id must be non-null and the referenced MLModel must have a valid artifact_uri.

Signal logic is attached

signal_logic_id must be non-null and the referenced SignalLogic must have a non-empty rule_tree.
Promoting a strategy bypasses no safety checks — if the promotion endpoint returns a 409, inspect gate_results in the validation response to see which threshold was not met.

Versioning

Every Strategy carries a version integer that increments on every write. The ORM uses the VersionMixin which applies optimistic locking — concurrent updates to the same strategy will conflict rather than silently overwrite each other. Always include the current version in PATCH requests when building UIs or automation pipelines.

API Reference

For the complete endpoint reference — including filtering, pagination, status-transition endpoints, and error codes — see the Strategies API.
Use GET /api/strategies?status=validated to list all strategies that are ready to promote, and GET /api/strategies/{id}/backtests to retrieve the backtest history for a specific strategy.

Build docs developers (and LLMs) love