trade_risk_score
Calculate a transparent deterministic 0–100 risk score for a proposed trade from entry, protection, sizing, account and portfolio context.
When to use
Use before an agent recommends or executes a trade and needs an auditable risk score rather than an opaque model judgment.
Selection guidance
Role: primary. Use before an agent recommends or executes a trade and needs an auditable risk score rather than an opaque model judgment.
Use cases
- trade risk
- position sizing
- risk reward
- pre-trade check
- leverage check
Access
- REST:
POST https://api.rafidsystem.com/api/v1/trading/trade-risk-score - x402:
POST https://api.rafidsystem.com/api/v1/x402/trading/trade-risk-score - MCP tool:
trade_risk_score
Price: $0.25 USD per call. Payment options are deployment-configured; inspect /api/v1/payment-methods. Prices and payment semantics are unchanged from the canonical registry.
Related tools
Example input
{
"trade": {
"symbol": "BTCUSD",
"direction": "long",
"entryPrice": 100,
"stopLoss": 95,
"takeProfit": 115,
"quantity": 1
},
"account": {
"accountEquity": 1000
}
}Example output
{
"riskScore": 20,
"riskLevel": "low",
"riskAmount": 5,
"accountRiskPct": 0.005,
"riskRewardRatio": 3,
"positionExposurePct": 0.1,
"leverage": 0.1,
"riskFactors": [],
"positiveFactors": [
"Account risk is within the 6% threshold.",
"Risk/reward ratio is at least 1:1."
],
"warnings": [],
"calculationBreakdown": {
"components": {
"accountRisk": 3.3333,
"positionExposure": 8.3333
},
"thresholds": {
"maxPositionPct": 0.3,
"maxPortfolioRiskPct": 0.5,
"maxDailyLossPct": 0.06
},
"assumptions": []
}
}Input schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"trade": {
"type": "object",
"properties": {
"symbol": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"direction": {
"type": "string",
"enum": [
"long",
"short"
]
},
"entryPrice": {
"type": "number",
"exclusiveMinimum": 0
},
"stopLoss": {
"type": "number",
"exclusiveMinimum": 0
},
"takeProfit": {
"type": "number",
"exclusiveMinimum": 0
},
"takeProfits": {
"maxItems": 20,
"type": "array",
"items": {
"type": "number",
"exclusiveMinimum": 0
}
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"volatilityPct": {
"type": "number",
"minimum": 0
},
"liquidityScore": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"strategy": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"timeframe": {
"type": "string",
"minLength": 1,
"maxLength": 30
},
"leverage": {
"type": "number",
"exclusiveMinimum": 0
}
},
"required": [
"direction",
"entryPrice",
"quantity"
],
"additionalProperties": false
},
"account": {
"type": "object",
"properties": {
"accountBalance": {
"type": "number"
},
"accountEquity": {
"type": "number"
},
"availableMargin": {
"type": "number",
"minimum": 0
},
"marginUsed": {
"type": "number",
"minimum": 0
},
"maxPositionPct": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"maxPortfolioRiskPct": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"maxDailyLossPct": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"maxConcurrentPositions": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
}
},
"additionalProperties": false
},
"existingPositions": {
"maxItems": 10000,
"type": "array",
"items": {
"type": "object",
"properties": {
"positionId": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"symbol": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"strategy": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"assetClass": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"direction": {
"type": "string",
"enum": [
"long",
"short"
]
},
"quantity": {
"type": "number",
"exclusiveMinimum": 0
},
"entryPrice": {
"type": "number",
"exclusiveMinimum": 0
},
"currentPrice": {
"type": "number",
"exclusiveMinimum": 0
},
"marketValue": {
"type": "number",
"minimum": 0
},
"stopLoss": {
"type": "number",
"exclusiveMinimum": 0
},
"fees": {
"type": "number",
"minimum": 0
},
"leverage": {
"type": "number",
"exclusiveMinimum": 0
},
"margin": {
"type": "number",
"minimum": 0
}
},
"required": [
"symbol",
"direction",
"quantity",
"entryPrice"
],
"additionalProperties": false
}
},
"historicalRisk": {
"type": "object",
"properties": {
"lossRate": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"maxDrawdownPct": {
"type": "number"
},
"averageRMultiple": {
"type": "number"
}
},
"additionalProperties": false
}
},
"required": [
"trade"
],
"additionalProperties": false
}Output schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"riskScore": {
"type": "integer",
"minimum": 0,
"maximum": 100
},
"riskLevel": {
"type": "string",
"enum": [
"low",
"moderate",
"high",
"critical"
]
},
"riskAmount": {
"type": [
"number",
"null"
]
},
"accountRiskPct": {
"type": [
"number",
"null"
]
},
"riskRewardRatio": {
"type": [
"number",
"null"
]
},
"positionExposurePct": {
"type": [
"number",
"null"
]
},
"leverage": {
"type": [
"number",
"null"
]
},
"safeLeverage": {
"type": [
"number",
"null"
]
},
"riskFactors": {
"type": "array",
"items": {
"type": "string"
}
},
"positiveFactors": {
"type": "array",
"items": {
"type": "string"
}
},
"warnings": {
"type": "array",
"items": {
"type": "string"
}
},
"calculationBreakdown": {
"type": "object",
"properties": {
"components": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "number"
}
},
"thresholds": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "number"
}
},
"assumptions": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"components",
"thresholds",
"assumptions"
],
"additionalProperties": false
},
"sourceTraceability": {
"type": "object",
"properties": {
"strategyPerformance": {
"type": "string",
"enum": [
"GROK",
"SIGNALFLOW",
"MERGED",
"NEW"
]
},
"tradeRisk": {
"type": "string",
"enum": [
"GROK",
"SIGNALFLOW",
"MERGED",
"NEW"
]
},
"portfolioExposure": {
"type": "string",
"enum": [
"GROK",
"SIGNALFLOW",
"MERGED",
"NEW"
]
},
"tradeLog": {
"type": "string",
"enum": [
"GROK",
"SIGNALFLOW",
"MERGED",
"NEW"
]
},
"notes": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"strategyPerformance",
"tradeRisk",
"portfolioExposure",
"tradeLog",
"notes"
],
"additionalProperties": false
}
},
"required": [
"riskScore",
"riskLevel",
"riskAmount",
"accountRiskPct",
"riskRewardRatio",
"positionExposurePct",
"leverage",
"riskFactors",
"positiveFactors",
"warnings",
"calculationBreakdown"
],
"additionalProperties": false
}Category: Trading Intelligence · hierarchy: primary · idempotent: yes · side effects: no