End-to-end deploy: generate strategy → train → deploy live.
One of `prompt` (free-form NL), `preset` (curated winning strategy), or
`community_id` (copy a published community strategy) is required. If more
than one is passed, precedence is community_id > preset > prompt.
Args:
prompt: Natural-language strategy description (e.g. "Buy when RSI < 30, sell > 70").
symbol: Currency pair to backtest on. One of: EURUSD, USDJPY, GBPUSD,
USDCHF, USDCAD, AUDUSD, NZDUSD. Default EURUSD.
timeframe: Candle granularity. One of: 1min, 5min, 15min, 1h. Default 15min.
claude_model: Which Claude variant to use for code generation.
"sonnet" (default — best quality, 1/day free) or "haiku" (faster, 3/day free).
Ignored when `preset` is set (no generation needed).
preset: Curated winning-strategy slug. Skips Claude generation entirely
— deploys a pre-saved strategy known to backtest well on the chosen
symbol. Available slugs: ema_cross_fast, momentum, scalper_stack,
sma_only, trend_ema, volatility, bb_squeeze, all_mix, pivot_kid_ema.
Not every slug exists for every symbol — call list_models afterwards
to confirm what deployed.
community_id: Copy-trade a published community strategy. Pass the `id`
of an entry from `browse_community`. Loads that exact strategy code,
skips Claude generation, then trains + deploys it. `symbol`/`timeframe`
still apply to the backtest+deploy.
webhook_url: Optional webhook to receive live signals.
telegram_chat_id: Optional Telegram chat ID for signal delivery.
Returns IMMEDIATELY (the deploy runs in the background so the live card can
stream progress) with:
- job_token (str): pass to get_deploy_result to fetch the final result.
- poll_url (str): the card polls this for live progress; you can ignore it.
- pending (bool): always true here — the deploy is still running.
- symbol, timeframe (str).
Call this EXACTLY ONCE per request. Pass the user's words as `prompt`; do not
pre-pick presets/community strategies — the server routes (vague → a proven
community strategy, specific rules → a fresh generation).
NEXT STEP (always): call get_deploy_result(job_token) ONCE — it blocks until the
deploy finishes and returns the out-of-sample stats + `stem` + `source`/`author`
as TEXT so you can summarize. The live card already shows the chart, so you do
NOT need get_model_chart. If source='community', tell the user it used a
pre-existing strategy by @author and offer to generate a custom one.