1+ {
2+ "namespace" : " com.codedstreams.cryptorisk.contracts.schemas" ,
3+ "type" : " record" ,
4+ "name" : " RiskAnalyzedTrade" ,
5+ "doc" : " Cryptocurrency trade with risk analysis results from CEP operations" ,
6+ "fields" : [
7+ {
8+ "name" : " originalTrade" ,
9+ "type" : " CryptoTrade" ,
10+ "doc" : " The original trade event that was analyzed"
11+ },
12+ {
13+ "name" : " analysisTimestamp" ,
14+ "type" : " long" ,
15+ "doc" : " When the risk analysis was performed (milliseconds since epoch)"
16+ },
17+ {
18+ "name" : " riskScore" ,
19+ "type" : " double" ,
20+ "doc" : " Overall risk score from 0.0 (no risk) to 1.0 (maximum risk)"
21+ },
22+ {
23+ "name" : " finalRiskLevel" ,
24+ "type" : " RiskLevel" ,
25+ "doc" : " Final risk level after CEP analysis"
26+ },
27+ {
28+ "name" : " triggeredPatterns" ,
29+ "type" : {
30+ "type" : " array" ,
31+ "items" : " string"
32+ },
33+ "doc" : " List of risk patterns that this trade triggered"
34+ },
35+ {
36+ "name" : " volumeAnalysis" ,
37+ "type" : {
38+ "type" : " record" ,
39+ "name" : " VolumeAnalysis" ,
40+ "doc" : " Volume-based risk analysis results" ,
41+ "fields" : [
42+ {
43+ "name" : " isVolumeSpike" ,
44+ "type" : " boolean" ,
45+ "doc" : " Whether this trade is part of a volume spike pattern"
46+ },
47+ {
48+ "name" : " volumePercentile" ,
49+ "type" : " double" ,
50+ "doc" : " Volume percentile compared to user's historical trades (0.0-1.0)"
51+ },
52+ {
53+ "name" : " notionalAmount" ,
54+ "type" : " double" ,
55+ "doc" : " The notional value of this trade"
56+ },
57+ {
58+ "name" : " symbolVolumeZScore" ,
59+ "type" : " double" ,
60+ "doc" : " Z-score compared to typical volumes for this symbol"
61+ }
62+ ]
63+ },
64+ "doc" : " Volume-based risk analysis"
65+ },
66+ {
67+ "name" : " behavioralAnalysis" ,
68+ "type" : {
69+ "type" : " record" ,
70+ "name" : " BehavioralAnalysis" ,
71+ "doc" : " Behavioral pattern analysis results" ,
72+ "fields" : [
73+ {
74+ "name" : " isWashTrading" ,
75+ "type" : " boolean" ,
76+ "doc" : " Whether this trade is part of wash trading pattern"
77+ },
78+ {
79+ "name" : " isSpoofing" ,
80+ "type" : " boolean" ,
81+ "doc" : " Whether this trade shows spoofing characteristics"
82+ },
83+ {
84+ "name" : " isFrontRunning" ,
85+ "type" : " boolean" ,
86+ "doc" : " Whether this trade shows front-running patterns"
87+ },
88+ {
89+ "name" : " tradingVelocity" ,
90+ "type" : " double" ,
91+ "doc" : " Trades per minute for this user in current session"
92+ },
93+ {
94+ "name" : " cancelToFillRatio" ,
95+ "type" : " double" ,
96+ "doc" : " Ratio of cancelled orders to filled orders"
97+ }
98+ ]
99+ },
100+ "doc" : " Behavioral pattern analysis"
101+ },
102+ {
103+ "name" : " marketImpactAnalysis" ,
104+ "type" : {
105+ "type" : " record" ,
106+ "name" : " MarketImpactAnalysis" ,
107+ "doc" : " Market impact and manipulation analysis" ,
108+ "fields" : [
109+ {
110+ "name" : " isLargeOrder" ,
111+ "type" : " boolean" ,
112+ "doc" : " Whether this order exceeds large order thresholds"
113+ },
114+ {
115+ "name" : " marketImpactScore" ,
116+ "type" : " double" ,
117+ "doc" : " Estimated market impact score (0.0-1.0)"
118+ },
119+ {
120+ "name" : " liquidityConsumption" ,
121+ "type" : " double" ,
122+ "doc" : " Percentage of available liquidity consumed"
123+ },
124+ {
125+ "name" : " priceSlippage" ,
126+ "type" : " double" ,
127+ "doc" : " Actual vs expected price slippage"
128+ },
129+ {
130+ "name" : " isFlashCrashContributor" ,
131+ "type" : " boolean" ,
132+ "doc" : " Whether this trade contributed to flash crash patterns"
133+ }
134+ ]
135+ },
136+ "doc" : " Market impact analysis"
137+ },
138+ {
139+ "name" : " userRiskProfile" ,
140+ "type" : {
141+ "type" : " record" ,
142+ "name" : " UserRiskProfile" ,
143+ "doc" : " User-specific risk profile information" ,
144+ "fields" : [
145+ {
146+ "name" : " totalDailyVolume" ,
147+ "type" : " double" ,
148+ "doc" : " User's total trading volume for the day"
149+ },
150+ {
151+ "name" : " dailyTradeCount" ,
152+ "type" : " int" ,
153+ "doc" : " Number of trades user has executed today"
154+ },
155+ {
156+ "name" : " averageTradeSize" ,
157+ "type" : " double" ,
158+ "doc" : " User's average trade size"
159+ },
160+ {
161+ "name" : " riskTier" ,
162+ "type" : {
163+ "type" : " enum" ,
164+ "name" : " RiskTier" ,
165+ "symbols" : [" LOW" , " MEDIUM" , " HIGH" , " RESTRICTED" ]
166+ },
167+ "doc" : " User's assigned risk tier"
168+ },
169+ {
170+ "name" : " isNewUser" ,
171+ "type" : " boolean" ,
172+ "doc" : " Whether user is new (first 30 days)"
173+ },
174+ {
175+ "name" : " previousViolations" ,
176+ "type" : " int" ,
177+ "doc" : " Number of previous risk violations"
178+ }
179+ ]
180+ },
181+ "doc" : " User risk profile at time of analysis"
182+ },
183+ {
184+ "name" : " complianceFlags" ,
185+ "type" : {
186+ "type" : " array" ,
187+ "items" : {
188+ "type" : " enum" ,
189+ "name" : " ComplianceFlag" ,
190+ "symbols" : [
191+ " SANCTIONS_CHECK_PASSED" ,
192+ " SANCTIONS_CHECK_FAILED" ,
193+ " GEO_COMPLIANT" ,
194+ " GEO_RESTRICTED" ,
195+ " AML_CHECK_PASSED" ,
196+ " AML_CHECK_FAILED" ,
197+ " KYC_VERIFIED" ,
198+ " KYC_PENDING" ,
199+ " REGULATORY_LIMIT_EXCEEDED" ,
200+ " TAX_REPORTING_REQUIRED"
201+ ]
202+ }
203+ },
204+ "doc" : " Compliance and regulatory flags"
205+ },
206+ {
207+ "name" : " riskMitigationActions" ,
208+ "type" : {
209+ "type" : " array" ,
210+ "items" : {
211+ "type" : " enum" ,
212+ "name" : " RiskMitigationAction" ,
213+ "symbols" : [
214+ " NONE" ,
215+ " ALERT_ONLY" ,
216+ " LIMIT_REDUCTION" ,
217+ " TRADING_SUSPENSION" ,
218+ " MANUAL_REVIEW_REQUIRED" ,
219+ " AUTO_CANCEL_ORDER" ,
220+ " POSITION_LIMIT_ENFORCED" ,
221+ " MARGIN_CALL" ,
222+ " COMPLIANCE_REVIEW" ,
223+ " LAW_ENFORCEMENT_NOTIFIED"
224+ ]
225+ }
226+ },
227+ "doc" : " Risk mitigation actions taken or recommended"
228+ },
229+ {
230+ "name" : " analyticsMetadata" ,
231+ "type" : {
232+ "type" : " record" ,
233+ "name" : " AnalyticsMetadata" ,
234+ "doc" : " Analytics and processing metadata" ,
235+ "fields" : [
236+ {
237+ "name" : " cepEngineVersion" ,
238+ "type" : " string" ,
239+ "doc" : " Version of the CEP engine that performed analysis"
240+ },
241+ {
242+ "name" : " modelVersion" ,
243+ "type" : " string" ,
244+ "doc" : " Version of risk models used"
245+ },
246+ {
247+ "name" : " processingLatencyMs" ,
248+ "type" : " long" ,
249+ "doc" : " Processing latency in milliseconds"
250+ },
251+ {
252+ "name" : " windowSizeMinutes" ,
253+ "type" : " int" ,
254+ "doc" : " Analysis window size in minutes"
255+ },
256+ {
257+ "name" : " confidenceScore" ,
258+ "type" : " double" ,
259+ "doc" : " Confidence in the risk assessment (0.0-1.0)"
260+ },
261+ {
262+ "name" : " correlationId" ,
263+ "type" : " string" ,
264+ "doc" : " Correlation ID for tracking analysis"
265+ }
266+ ]
267+ },
268+ "doc" : " Analytics processing metadata"
269+ },
270+ {
271+ "name" : " additionalContext" ,
272+ "type" : {
273+ "type" : " map" ,
274+ "values" : " string"
275+ },
276+ "doc" : " Additional context-specific data"
277+ }
278+ ]
279+ }
0 commit comments