SYSTEM R AI

Compound Tools

pre_trade_gate and assess_trading_system: multi-tool chains in a single call.

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

Cost: $0.01 | Complete pre-trade validation in one call.

Combines:

  1. Position sizing (G-formula) to calculate the optimal number of shares.
  2. Risk validation (Iron Fist rules) to approve or reject the trade.
  3. System health (optional, if R-multiples provided) to assess current edge status.

Use this before every trade.

Parameters

ParameterTypeRequiredDescription
symbolstringYesInstrument symbol (e.g. "AAPL").
directionstringYes"long" or "short".
entry_pricestringYesPlanned entry price.
stop_pricestringYesStop loss price.
equitystringYesAccount equity in USD.
daily_pnlstringNoDaily P&L so far. Default "0".
risk_percentstringNoRisk as decimal. Default "0.02" (2%).
r_multiplesstring[]NoRecent R-multiples. If provided, includes system health check.

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

{
  "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

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

Cost: $2.00 | Comprehensive trading system assessment in a single call.

Chains 7 analyses together:

  1. G-metric evaluation to measure geometric growth rate
  2. Win/loss analysis for batting average and payoff ratio
  3. Kelly criterion for optimal position sizing
  4. Monte Carlo simulation to project future equity paths
  5. Drawdown analysis to measure downside risk
  6. What-if scenarios to find improvement opportunities
  7. Variance killer detection to identify G-damaging trades

Parameters

ParameterTypeRequiredDescription
r_multiplesstring[]YesR-multiples from trade history (10+ recommended).
equity_valuesstring[]NoEquity values after each trade (for drawdown).
starting_equitystringNoStarting equity. Default "100000".
pnl_valuesstring[]NoUSD P&L per trade (for detailed win/loss).

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

{
  "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

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

Cost: $0.003 | Record a completed trade to the agent's journal.

ParameterTypeRequiredDescription
symbolstringYesInstrument symbol.
directionstringYes"long" or "short".
entry_pricestringYesEntry price.
exit_pricestringYesExit price.
stop_pricestringYesStop loss price.
quantitystringYesPosition quantity.
r_multiplestringNoRealized R-multiple.
pnlstringNoRealized P&L in dollars.
trade_datestringNoTrade date as ISO string (e.g. "2026-03-25").
notesstringNoFree-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.

System R AI
Python SDKpip install systemr
MCP Serveragents.systemr.ai/mcp/sse
OpenAPI Specagents.systemr.ai/openapi.json
Machine Docsagents.systemr.ai/llms.txt
GitHubSystem-R-AI
X@Systemrai
YouTube@systemr_ai
Emailhello@systemr.ai
Phone628 333 6693
Address7901 4TH ST N, STE 28529, ST PETERSBURG, FL 33702
TermsTerms of Service
PrivacyPrivacy Policy
SecuritySecurity Policy
© 2026 System R AI. Software platform. Not financial advice.

On this page