Skip to main content

Goal

Produce a repeatable, machine-friendly market brief before placing a trade:
  • current market state
  • liquidity and spread context
  • execution impact estimate
  • explicit go/no-go and constraints

Inputs

  • condition_id (required)
  • optional thesis horizon (intraday, 1d, 1w, event_horizon)
  • planned side (BUY or SELL)
  • intended size in USDC

1) Pull market and event context

  • get_market with condition_id
  • get_event from the related event id when available
Capture status, outcomes, timing, and event risk windows.

2) Pull batched market data

Use the canonical pluralized tools:
  • get_order_books
  • get_prices
  • get_midpoints
  • get_spreads
  • get_last_trade_prices
Example:
Focus on:
  • spread regime (tight/normal/wide)
  • visible depth near midpoint
  • last trade versus current best price

3) Estimate execution impact

Run calculate_market_price for the intended side and amount.
Use the result to set max slippage and a candidate limit price.

4) Gather execution metadata

  • get_fee_rate_bps
  • get_tick_size
  • get_neg_risk
These values should flow directly into downstream order validation and execution policy.

5) If execution is approved, hand off to trading wrappers

  • prepare_order to locally prepare/sign a draft without posting
  • place_order with confirm: true only at the final execution step
  • cancel_orders if you need an explicit unwind/cancel path

Suggested output contract

Have the agent return a strict structure like:

Optional: use the built-in prompt

You can bootstrap this workflow with prompt market-analysis using:
  • condition_id
  • horizon
  • include_orderbook_depth
  • include_recent_trades
The prompt is registered by the server and already encodes the same analysis sequence.