Skip to content

How AI parsing works

What happens when you submit a strategy description — language detection, model selection, code generation, and test generation.

Updated 2026-07-31·2 min read

When you submit a strategy description, Coinrule runs it through an AI pipeline to produce executable Python.

Stage 1 — Language detection

A lightweight heuristic checks whether the input looks like Pine Script, Python, or natural language. This is a keyword scan in the same request — not a separate network call.

Stage 2 — AI strategy generation

The description is sent to an LLM together with the platform's system context (supported indicators, exchange market config, allowed patterns). The model returns a structured tool call containing:

  • name and description
  • markets — market config (symbol, venue, interval, asset type)
  • position — direction (long / short / both), sizing, and risk parameters (stop loss, take profit, trailing stop)
  • settings — order type, max open positions, and other runtime settings
  • entry_condition and exit_condition — human-readable summaries
  • strategy_py — the full Python source of the strategy

Model used for parsing: claude-sonnet-4-6 (3× credit multiplier). Strategy parsing always uses Sonnet — users cannot manually select a different model for this step.

Stage 3 — Validation

Before the strategy can be launched, the generated Python is validated (security checks, import whitelist, pattern checks). Validation runs server-side and blocks unsafe code.

Stage 4 — Test generation (background)

After you review and launch a strategy, a background task generates a test file using claude-sonnet-4-6 (3× credit multiplier). The test file is required before the engine loads the strategy. This happens automatically; you don't need to do anything.

How are credits charged?

You are charged for the LLM call when the parse succeeds. A failed or rejected parse does not charge credits. The credit cost is shown after parsing completes, before you launch. See Credit drivers and costs.

How do you iterate on a parse?

If the parsed strategy doesn't match your intent, edit your description and re-submit. Each re-parse is an independent LLM call (and a separate credit charge). There is no partial-update / delta-parse feature — each submission generates a fresh strategy.

Was this article helpful?

Coinrule

AI-powered trading automation. Your keys, your coins.
Backed by Y Combinator.

© 2026 Coinrule. All rights reserved.

No information here constitutes investment advice. Coinrule does not take any liability for rule performance. Trade at your own risk. Terms · Privacy

The services, products, and content available on coinrule.com are not intended for, directed at, or marketed to residents of the European Union (EU) or the European Economic Area (EEA). Coinrule does not hold a Crypto-Asset Service Provider (CASP) license under the EU Markets in Crypto-Assets (MiCA) regulation. Any access to our services by users residing within the EU/EEA is done solely at the user's own exclusive initiative and request (passive provision of services/reverse solicitation).