Optimizers

Create Optimizer

Author one portfolio-weighting class. Pass prompt to have the LLM write it (metered like a build) or script with exact Python exposing @staticmethod opt(ret_df, syms). The class is frozen and injected into every later backtest that names it. Models identify the stored optimizer by its class name.

post/v1/optimizers

Request

  • Base URL: https://api.ensemble.markets (the document declares no server; this is the origin it was published from)
  • URL: https://api.ensemble.markets/v1/optimizers
  • Auth: HTTP bearer

Request body

promptstring nullable

The weighting rule in words. The LLM writes the class; metered like a build.

scriptstring nullable

Exact Python source for one class with @staticmethod opt(ret_df, syms). No LLM.

namestring nullable

Class name (CapWords). Must match the class in script; a hint for prompt.

effort'min' | 'mid' | 'max'

How hard the generator works. min (default, all plans): a fast single-shot build. mid (Hobby and Business): a stronger model plus a fidelity review of the script against your description. max (Business): additionally inspects results and refines the implementation. Higher effort bills more per token.

Example request

{
  "prompt": "Maximum Sharpe, long-only, 40% cap, 63-day covariance window",
  "name": "MaxSharpeOpt"
}

Response

Successful Response

idstring required

Optimizer ID (optimizer_... or legacy o-...)

namestring required

Python class name

descriptionstring required
source'prompt' | 'script' required
promptstring nullable
scriptstring required
hashstring required
created_atstring date-time required
updated_atstring date-time required

Changes

No recorded changes to this operation across all 1 revision of this API.