Compound Tools
Compound tools chain multiple operations into a single call. They cost less than calling each tool individually and provide a unified response.
pre_trade_gate
Section titled “pre_trade_gate”Cost: $0.01 | Complete pre-trade validation in one call.
Combines:
- Position sizing (G-formula) to calculate the optimal number of shares.
- Risk validation (Iron Fist rules) to approve or reject the trade.
- System health (optional, if R-multiples provided) to assess current edge status.
Use this before every trade.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | Instrument symbol (e.g. "AAPL"). |
direction | string | Yes | "long" or "short". |
entry_price | string | Yes | Planned entry price. |
stop_price | string | Yes | Stop loss price. |
equity | string | Yes | Account equity in USD. |
daily_pnl | string | No | Daily P&L so far. Default "0". |
risk_percent | string | No | Risk as decimal. Default "0.02" (2%). |
r_multiples | string[] | No | Recent R-multiples. If provided, includes system health check. |
Example
Section titled “Example”from systemr import SystemRClient
client = SystemRClient(api_key="sr_agent_...")
result = client.pre_trade_gate( symbol="AAPL", direction="long", entry_price="185.50", stop_price="180.00", equity="100000", r_multiples=["1.5", "-1.0", "2.3", "-0.5", "1.8", "-1.0", "3.2", "0.8"],)
if result["gate_passed"]: shares = result["sizing"]["shares"] print(f"BUY {shares} shares of AAPL at $185.50, stop at $180.00")else: print(f"Trade blocked: {result['risk']['errors']}")Response
Section titled “Response”{ "gate_passed": true, "sizing": { "shares": 363, "risk_amount": "2000.00", "risk_percent": "0.02", "notional": "67351.50", "one_r_dollars": "2000.00", "direction": "long" }, "risk": { "approved": true, "score": 85, "errors": [], "warnings": [], "risk_amount": "2000.00", "risk_percent": "0.02" }, "system_health": { "g": "0.0847", "expected_r": "0.7875", "verdict": "POSITIVE_EDGE", "trade_count": 8 }}How gate_passed is determined
Section titled “How gate_passed is determined”gate_passed is true when both conditions are met:
sizing.shares > 0(position size is valid)risk.approved == true(all Iron Fist rules pass)
System health is informational. A declining G does not block the gate. You can add your own logic to incorporate system health into your decision.
assess_trading_system
Section titled “assess_trading_system”Cost: $2.00 | Comprehensive trading system assessment in a single call.
Chains 7 analyses together:
- G-metric evaluation to measure geometric growth rate
- Win/loss analysis for batting average and payoff ratio
- Kelly criterion for optimal position sizing
- Monte Carlo simulation to project future equity paths
- Drawdown analysis to measure downside risk
- What-if scenarios to find improvement opportunities
- Variance killer detection to identify G-damaging trades
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
r_multiples | string[] | Yes | R-multiples from trade history (10+ recommended). |
equity_values | string[] | No | Equity values after each trade (for drawdown). |
starting_equity | string | No | Starting equity. Default "100000". |
pnl_values | string[] | No | USD P&L per trade (for detailed win/loss). |
Example
Section titled “Example”result = client.assess_system( r_multiples=[ "1.5", "-1.0", "2.3", "-0.5", "1.8", "-1.0", "3.2", "0.8", "-0.7", "1.1", "-0.3", "2.5", "-1.2", "1.6", "0.9", ], starting_equity="100000",)
print(f"Verdict: {result['verdict']}")print(f"G: {result['g_metrics']['g']}")print(f"Win rate: {result['win_loss']['win_rate']}")print(f"Kelly (half): {result['kelly']['half_kelly']}")print(f"Monte Carlo profit probability: {result['monte_carlo']['probability_of_profit']}")print(f"Max drawdown: {result['drawdown']['max_drawdown_pct']}")Response structure
Section titled “Response structure”{ "verdict": "POSITIVE_EDGE", "g_metrics": { "g": "0.0623", "expected_r": "0.62", "variance": "1.87", "trade_count": 15 }, "win_loss": { "win_rate": "0.667", "avg_win_r": "1.75", "avg_loss_r": "0.78", "payoff_ratio": "2.24", "profit_factor": "4.49", "expectancy": "0.91" }, "kelly": { "full_kelly": "0.35", "half_kelly": "0.175", "quarter_kelly": "0.0875", "risk_of_ruin": "0.001" }, "monte_carlo": { "probability_of_profit": "0.93", "probability_20pct_gain": "0.71", "probability_20pct_drawdown": "0.08", "median_final_equity": "118500" }, "drawdown": { "max_drawdown_pct": "7.2", "longest_duration": 3, "recovery_factor": "4.8" }, "what_if": { "cap_losses_at_1r": "0.0891", "avoid_worst_10pct": "0.0945" }, "variance_killers": [ {"index": 5, "r_multiple": "-1.2", "g_impact": "-0.012"} ]}Cost comparison
Section titled “Cost comparison”Calling all 7 tools individually would cost approximately $0.04. The compound tool costs $2.00 because it runs full-depth Monte Carlo (5,000 simulations) and comprehensive analysis at each step. Use individual tools when you need specific metrics; use assess_trading_system when you want the complete picture.
record_trade_journal
Section titled “record_trade_journal”Cost: $0.003 | Record a completed trade to the agent’s journal.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | Instrument symbol. |
direction | string | Yes | "long" or "short". |
entry_price | string | Yes | Entry price. |
exit_price | string | Yes | Exit price. |
stop_price | string | Yes | Stop loss price. |
quantity | string | Yes | Position quantity. |
r_multiple | string | No | Realized R-multiple. |
pnl | string | No | Realized P&L in dollars. |
trade_date | string | No | Trade date as ISO string (e.g. "2026-03-25"). |
notes | string | No | Free-text notes. |
result = client.record_trade( symbol="AAPL", direction="long", entry_price="185.50", exit_price="192.00", stop_price="180.00", quantity="363", r_multiple="1.18", pnl="2360.50", trade_date="2026-03-25", notes="Breakout entry, rode to first target.",)Returns: confirmation with trade_id, symbol, r_multiple, pnl, recorded_at.