For the complete documentation index, see llms.txt. This page is also available as Markdown.

Signal generation

LLM Session with Send Signal enabled

This feature enables the AI to not only reason about market conditions but also execute real trading actions. When enabled, all trading decisions are automatically sent to your webhook for live processing.

Disclaimer


⚙️ Execution Flow

When Signal Generation is active:

  1. The system builds the final prompt using:

    • System prompt (auto-injected)

    • User strategy prompt with resolved template variables

  2. The AI evaluates the strategy and decides whether to act

  3. If conditions are met, it executes an action:

    • Open position (BUY / SELL)

    • Close position (EXIT)

    • Request market price if needed

  4. Executed actions are processed and forwarded as trading signals (e.g. webhook)

If no valid setup is found, no action is executed.

📡 Signal Symbol Configuration

The user must define the trading symbol(s) used for execution.

Format

Single symbol (recommended):

Multiple symbols (optional):

Scope Rules

🛠️ LLM Tooling Reference

These tools allow LLMs to execute trading actions, access market and external data, manage persistent state, communicate with other automations, inspect strategy performance and errors, and dynamically control and modify other strategies.

open_position

Opens a new trading position (BUY (LONG) or SELL (SHORT)) on one or more selected symbols.

Used to execute entry signals directly through the trading system.


close_position

Closes an active trading position.

Used for exiting trades based on strategy logic such as profit targets, stop losses, or signal reversals.


get_symbol_price

Returns the current market price of a trading pair.

Useful for making live trading decisions and evaluating strategy conditions.


set_storage

Stores a persistent JSON object for the strategy.

Calling this tool replaces the entire existing storage with the provided value.

Storage is persisted between executions, allowing the LLM to maintain long-term memory and state across strategy runs.

Storage Limit: The maximum storage size is 25 MB. Attempting to store more data will result in an error.


get_storage

Retrieves the strategy's currently saved storage.

Returns the complete persistent JSON object previously stored by the strategy.


append_storage

Appends new data to the existing strategy storage without replacing it.

Unlike set_storage, this tool preserves the current storage and merges or appends the provided data, making it ideal for gradually building logs, histories, or other persistent datasets.

Storage Limit: The combined storage size cannot exceed 25 MB. If the limit is exceeded, the tool will return an error.


web_fetch

Performs an HTTP GET request to a specified URL.

Useful for retrieving external data such as market information, APIs, news feeds, or other publicly available resources.


run_javascript_code

Executes custom JavaScript code inside the strategy sandbox.

The tool expects the body of an asynchronous function, executes it, and returns the function's return value.

The execution environment uses the same secure sandbox as Code Strategies, including the same runtime restrictions, resource limits, and security policies. This allows the LLM to perform custom calculations, data transformations, or other logic that would be difficult to express through tool calls alone.


send_email

Sends an email to the strategy owner.

Useful for delivering alerts, reports, trade summaries, or other custom notifications generated by the AI strategy.


get_current_date_time

Returns the current date and time.

Useful for time-sensitive decisions, scheduling logic, calculating time ranges, or working with timestamps.


get_candlestick_data

Fetches historical OHLCV candlestick data for a trading pair.

Allows the LLM to retrieve market history for a specific symbol, timeframe, and optional time range or candle limit. Useful for technical analysis, pattern detection, and evaluating historical price action.


get_signal_logs

Retrieves signal logs from other strategies.

Allows the LLM to analyze historical signals and evaluate strategy performance, including signal outcomes and profitability.

Useful for comparing strategies, measuring performance, identifying patterns, and making data-driven decisions.


get_error_logs

Retrieves error logs from strategies.

Allows the LLM to inspect historical strategy errors and execution failures, helping it identify recurring problems, diagnose issues, and learn from previous failures.


get_code_strategy

Retrieves a Code Strategy by id.

Returns its configuration, including the code, status and last run time. The strategy's storage is not included.


get_llm_session

Retrieves an LLM Session by id.

Returns its configuration, including the prompt and status.


get_code_reaction

Retrieves a Code Reaction by id.

Returns its configuration, including the code and status.


get_llm_reaction

Retrieves an LLM Reaction by id.

Returns its configuration, including the prompt and status.


set_code_strategy

Replaces the code of a Code Strategy. Takes id and code.

The new code replaces the old code entirely, and the strategy keeps its current status.


set_llm_session

Replaces the prompt of an LLM Session. Takes id and prompt.


set_code_reaction

Replaces the code of a Code Reaction. Takes id and code.


set_llm_reaction

Replaces the prompt of an LLM Reaction. Takes id and prompt.


set_code_strategy_status

Starts or stops a Code Strategy. Takes id and status (ACTIVE or INACTIVE).


set_llm_session_status

Starts or stops an LLM Session. Takes id and status (ACTIVE or INACTIVE).


set_code_reaction_status

Starts or stops a Code Reaction. Takes id and status (ACTIVE or INACTIVE).


set_llm_reaction_status

Starts or stops an LLM Reaction. Takes id and status (ACTIVE or INACTIVE).

🧠 System Prompt (Automatically Added)

When signal sending is enabled, two things happen automatically:

  1. Prepending context to your prompt:


⚙️ Writing a Good Prompt

To ensure reliable signals, your custom prompt should focus on the decision-making logic, not the output format. Here's an example:

📝 Example Custom Prompt

🔁 The system will handle formatting instructions automatically — no need to repeat them.


🧩 Template Variables

To make prompt creation easier and more dynamic, you can now use the following template variables in your prompt:

Template
Description

{{last_trigger_action}}

The last executed signal (e.g., LONG, SHORT, EXIT)

{{last_trigger_at}}

Timestamp when the last signal was executed (e.g., 2025-06-04 15:32 UTC)

{{current_time}}

The current time (automatically filled before execution)

{{val:<name>=<value>}}

Declares a custom value within your prompt. You can define it once and reuse it anywhere. For example: {{val:user=Joe}} then later use {{user}} → will be replaced with Joe.

{{price:<exhange>:<service>:<pair>}}

Returns the live market price for a given trading pair from a specific exchange and market type (e.g. spot, futures). See available exchanges

{{comment:<text>}} or {{#:<text>}}

Adds inline comments to the prompt for readability and documentation. Comment content is stripped before the final prompt is sent and never reaches the model.

{{get:<url>}}

Fetches data via an HTTPS GET request from the specified URL and injects the response into the prompt. Requests are limited to HTTPS and have a timeout of 1750 ms.

{{toon:<json>}}

Converts JSON into Toon format, a compact link-based representation that helps reduce final prompt token count while preserving the original content semantics.

{{storage}}

Persistent JSON storage associated with the strategy. The stored data is automatically injected into the model's system instructions on every execution, so the AI already has access to it without needing to include {{storage}} in the prompt. Use this variable only when you need to explicitly reference or manipulate the storage content inside your prompt.

These help the AI reason based on past actions and current context.


📝 Example Prompt with Templates

Price Variable Reference

The {{price:<exchange>:<service>:<pair>}} template variable allows you to dynamically inject real-time market prices into your LLM prompts or strategy logic.

It automatically fetches the latest price for a given trading pair from a specified exchange and market type.

Exchange
Service
Example

binance

spot

{{price:binance:spot:btcusdt}}

bitget

spot

{{price:bitget:spot:btcusdt}}

kraken

spot

{{price:kraken:spot:btcusdt}}

gateio

spot

{{price:gateio:spot:btcusdt}}

hyperliquid

spot

{{price:hyperliquid:spot:btcusdt}}

Last updated