{"uid":"cap_kIVBPLU_eWFQwaDOaHor8","slug":"rafid-trade-risk-score-26457baa","name":"Rafid Trade Risk Score","description":"Rafid Agent API provides structured intelligence and paid APIs for AI agents across property, company and risk, supplier, finance, document, website, automotive, logistics, recruitment, trading, voice, video and business-planning workflows.","url":"https://api.rafidsystem.com/api/v1/x402/trading/trade-risk-score?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"trade":{"type":"object","required":["direction","entryPrice","quantity"],"properties":{"symbol":{"type":"string","maxLength":100,"minLength":1},"leverage":{"type":"number","exclusiveMinimum":0},"quantity":{"type":"number","exclusiveMinimum":0},"stopLoss":{"type":"number","exclusiveMinimum":0},"strategy":{"type":"string","maxLength":100,"minLength":1},"direction":{"enum":["long","short"],"type":"string"},"timeframe":{"type":"string","maxLength":30,"minLength":1},"entryPrice":{"type":"number","exclusiveMinimum":0},"takeProfit":{"type":"number","exclusiveMinimum":0},"takeProfits":{"type":"array","items":{"type":"number","exclusiveMinimum":0},"maxItems":20},"volatilityPct":{"type":"number","minimum":0},"liquidityScore":{"type":"number","maximum":1,"minimum":0}},"additionalProperties":false},"account":{"type":"object","properties":{"marginUsed":{"type":"number","minimum":0},"accountEquity":{"type":"number"},"accountBalance":{"type":"number"},"maxPositionPct":{"type":"number","maximum":1,"minimum":0},"availableMargin":{"type":"number","minimum":0},"maxDailyLossPct":{"type":"number","maximum":1,"minimum":0},"maxPortfolioRiskPct":{"type":"number","maximum":1,"minimum":0},"maxConcurrentPositions":{"type":"integer","maximum":9007199254740991,"exclusiveMinimum":0}},"additionalProperties":false},"historicalRisk":{"type":"object","properties":{"lossRate":{"type":"number","maximum":1,"minimum":0},"maxDrawdownPct":{"type":"number"},"averageRMultiple":{"type":"number"}},"additionalProperties":false},"existingPositions":{"type":"array","items":{"type":"object","required":["symbol","direction","quantity","entryPrice"],"properties":{"fees":{"type":"number","minimum":0},"margin":{"type":"number","minimum":0},"symbol":{"type":"string","maxLength":100,"minLength":1},"leverage":{"type":"number","exclusiveMinimum":0},"quantity":{"type":"number","exclusiveMinimum":0},"stopLoss":{"type":"number","exclusiveMinimum":0},"strategy":{"type":"string","maxLength":100,"minLength":1},"direction":{"enum":["long","short"],"type":"string"},"assetClass":{"type":"string","maxLength":100,"minLength":1},"entryPrice":{"type":"number","exclusiveMinimum":0},"positionId":{"type":"string","maxLength":200,"minLength":1},"marketValue":{"type":"number","minimum":0},"currentPrice":{"type":"number","exclusiveMinimum":0}},"additionalProperties":false},"maxItems":10000}}},"responseSchema":{"type":"json","example":{"leverage":0.1,"warnings":[],"riskLevel":"low","riskScore":20,"riskAmount":5,"riskFactors":[],"accountRiskPct":0.005,"positiveFactors":["Account risk is within the 6% threshold.","Risk/reward ratio is at least 1:1."],"riskRewardRatio":3,"positionExposurePct":0.1,"calculationBreakdown":{"components":{"accountRisk":3.3333,"positionExposure":8.3333},"thresholds":{"maxPositionPct":0.3,"maxDailyLossPct":0.06,"maxPortfolioRiskPct":0.5},"assumptions":[]}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.25","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.25/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.25","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.25","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_4zLpCadI-hOwgujinX7Nf","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.25","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates a structured risk score and breakdown for a proposed trade, including risk level, risk/reward ratio, position exposure, and account-level risk metrics.","exampleAgentPrompt":"Score the risk of a long trade on BTCUSDT at an entry price of 65000 with a quantity of 0.5, a stop loss at 63000, and a take profit at 70000, using 5x leverage — my account balance is 10000 and I have 2000 in margin already used.","exampleUseCases":[{"title":"Pre-trade risk check for leveraged crypto","prompt":"Before I open a long on ETHUSDT at 3200 with 10x leverage and a quantity of 2, stop loss at 3000 and take profit at 3600, check the risk score against my account balance of 5000 and available margin of 1000."},{"title":"Portfolio risk guard for a new short position","prompt":"I already have three open longs and want to add a short on EURUSD at 1.085 with quantity 10000 and stop loss at 1.090 — score the risk and tell me if my portfolio risk percentage stays within 50% of my 20000 equity."},{"title":"Automated risk gate in algorithmic trading agent","prompt":"My strategy just generated a long signal on AAPL at 190, quantity 50, stop loss 185, take profit 200, no leverage — run the trade risk score so I can decide whether to execute or skip based on the risk level and risk/reward ratio."}],"resultDescription":"Returns a JSON object with a numeric riskScore (0–100), a riskLevel label (e.g. 'low', 'medium', 'high'), riskAmount in currency units, accountRiskPct, positionExposurePct, leverage, riskRewardRatio, arrays of riskFactors and positiveFactors, warnings, and a calculationBreakdown showing component scores, applied thresholds, and any assumptions made.","failureModes":["Missing required trade fields (direction, entryPrice, quantity) returns a 400 validation error","Invalid enum value for direction (not 'long' or 'short') causes schema rejection","Negative or zero values for prices, quantities, or leverage are rejected by exclusiveMinimum constraints","Providing an account with insufficient fields may result in partial scoring without account-level risk metrics","Network or payment failure (x402 protocol) may prevent the call from completing"],"whenToPreferThis":"Use this endpoint when you need a structured, quantitative risk assessment of a specific trade before execution, especially when you want account-level context (margin, equity, daily loss limits) factored into the score. Prefer it over generic portfolio analytics when you need per-trade risk/reward ratios, position exposure percentages, and actionable risk factors in a single call. It is well-suited for AI trading agents that need to gate order execution based on a risk threshold.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-10T12:39:38.104Z","isFirstParty":false,"canonicalSlug":"rafid-trade-risk-score-26457baa"}