---
title: "Generate strategy code from a curated template with optional overrides"
method: POST
path: "/api/v1/generate/from-template"
tags: ["Strategy"]
---

# Generate strategy code from a curated template with optional overrides

`POST /api/v1/generate/from-template`

## Request

- Base URL: `https://api.quantifyme.ai`
- URL: `https://api.quantifyme.ai/api/v1/generate/from-template`
- Auth: API key in header `X-API-Key`

## Request body

- FromTemplateRequest
  - `aux_feeds` object[]: Extra (symbol, timeframe) feeds merged into the strategy's features as aux_* columns. Max 3; must differ from the primary.
    - `symbol` 'EURUSD' | 'GBPUSD' | 'USDJPY' | 'USDCHF' | 'AUDUSD' | 'NZDUSD' | 'USDCAD' | 'BTCUSD'
    - `timeframe` '1min' | '5min' | '15min' | '1h'
  - `claude_model` string
  - `end_date` string, date
  - `indicators` Indicators: Flat indicator config. See GET /api/v1/indicator-schema for full param list.
  - `model` string
  - `pos_rules` PosRules
    - `cooldown` integer
    - `direction` 'both' | 'long' | 'short'
    - `max_pos` integer
    - `on_opposite` 'reverse' | 'close_only' | 'ignore'
  - `start_date` string, date
  - `symbol` 'EURUSD' | 'GBPUSD' | 'USDJPY' | 'USDCHF' | 'AUDUSD' | 'NZDUSD' | 'USDCAD' | 'BTCUSD'
  - `template` 'macd_momentum' | 'mean_reversion' | 'trend_following' | 'scalper' | 'conservative_long', required
  - `timeframe` '1min' | '5min' | '15min' | '1h'
  - `train_split` number

## Response `200`

Successful response

- GenerateResponse
  - `code` string: Full generated Python strategy code (feature_engineering + strategy_config functions).
  - `credits_remaining` integer

## Other responses

- `400`: Bad request
- `401`: Invalid or missing API key
- `429`: Rate limit exceeded, or insufficient credits (body carries credits_remaining and credits_required)

---

[API](https://skmtc.dev/quantifyme/apis/quantifyme-api.md) · [All operations](https://skmtc.dev/quantifyme/apis/quantifyme-api/llms.txt) · [OpenAPI document](https://skmtc.dev/quantifyme/apis/quantifyme-api/revisions/089d1cee1ec5?raw)
