1#![warn(missing_docs)]
19
20pub mod correlation;
21pub mod credit;
22pub mod market;
23pub mod messages;
24pub mod ring_messages;
25pub mod stress;
26pub mod types;
27
28pub mod prelude {
30 pub use crate::correlation::*;
31 pub use crate::credit::*;
32 pub use crate::market::*;
33 pub use crate::messages::*;
34 pub use crate::ring_messages::*;
35 pub use crate::stress::*;
36 pub use crate::types::*;
37}
38
39pub use correlation::RealTimeCorrelation;
41pub use credit::CreditRiskScoring;
42pub use market::{MonteCarloVaR, PortfolioRiskAggregation};
43pub use stress::StressTesting;
44
45pub use types::{
47 CreditExposure, CreditFactors, CreditRiskResult, Portfolio, PortfolioRiskResult, RiskFactor,
48 RiskFactorType, Sensitivity, StressScenario, StressTestResult, VaRParams, VaRResult,
49};
50
51pub fn register_all(
53 registry: &rustkernel_core::registry::KernelRegistry,
54) -> rustkernel_core::error::Result<()> {
55 tracing::info!("Registering risk analytics kernels");
56
57 registry.register_ring_metadata_from(credit::CreditRiskScoring::new)?;
59
60 registry.register_ring_metadata_from(market::MonteCarloVaR::new)?;
62 registry.register_ring_metadata_from(market::PortfolioRiskAggregation::new)?;
63 registry.register_ring_metadata_from(correlation::RealTimeCorrelation::new)?;
64
65 registry.register_batch_typed::<StressTesting, messages::StressTestingInput, messages::StressTestingOutput>(stress::StressTesting::new)?;
67
68 tracing::info!("Registered 5 risk analytics kernels");
69 Ok(())
70}
71
72#[cfg(test)]
73mod tests {
74 use super::*;
75 use rustkernel_core::registry::KernelRegistry;
76
77 #[test]
78 fn test_register_all() {
79 let registry = KernelRegistry::new();
80 register_all(®istry).expect("Failed to register risk kernels");
81 assert_eq!(registry.total_count(), 5);
82 }
83}