- Remove opentelemetry-otlp internal-logs feature (OTLP feedback loop) - Switch trace sampling from AlwaysOn to 10% ratio-based - Add RUST_LOG filtering (opentelemetry/h2/tonic/hyper=warn) to all 8 services - Wire per-service latency measurement via health check → proto metadata → TUI - Replace Vec::remove(0) with VecDeque ring buffers (O(1) vs O(n)) - Add Arc<AtomicBool> connected_sent for first-connected detection across 12 streams - Add MAX_RECONNECT_ATTEMPTS (10) uniformly to all stream spawners - Change kill switch/circuit breaker fields to Option types with N/A display - Wire data_cache to real download status stream, remove dead cluster_events - Remove ServiceData::new() hardcoded stubs, add honest placeholders - Fix nanos_to_hms zero/negative guard, total_records semantic fix - Fix RwLock held across yield in broker_gateway stream_account_state - Add break after yield Err in broker/trading stream generators - Fix connected_at advancing per tick in stream_session_status - Tempo: replace emptyDir with 10Gi PVC, bump memory to 512Mi/2Gi - Remove Prometheus gitlab-annotated-pods duplicate scrape job - Wire 6 new gRPC streaming adapters (risk, trading, ml, data-acquisition) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1019 lines
40 KiB
Rust
1019 lines
40 KiB
Rust
// This file is @generated by prost-build.
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct StreamCircuitBreakerStatusRequest {
|
|
/// Filter by symbol (all if not specified)
|
|
#[prost(string, optional, tag = "1")]
|
|
pub symbol: ::core::option::Option<::prost::alloc::string::String>,
|
|
/// 0 = server default (2s)
|
|
#[prost(uint32, tag = "2")]
|
|
pub interval_seconds: u32,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct StreamRiskMetricsRequest {
|
|
/// Portfolio identifier (default if not specified)
|
|
#[prost(string, optional, tag = "1")]
|
|
pub portfolio_id: ::core::option::Option<::prost::alloc::string::String>,
|
|
/// 0 = server default (3s)
|
|
#[prost(uint32, tag = "2")]
|
|
pub interval_seconds: u32,
|
|
}
|
|
/// Request to calculate portfolio VaR
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetVaRRequest {
|
|
/// Symbols to include in VaR calculation (empty = all positions)
|
|
#[prost(string, repeated, tag = "1")]
|
|
pub symbols: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
|
/// Confidence level (e.g., 0.95 for 95% VaR)
|
|
#[prost(double, tag = "2")]
|
|
pub confidence_level: f64,
|
|
/// Historical data period for calculation
|
|
#[prost(int32, tag = "3")]
|
|
pub lookback_days: i32,
|
|
/// VaR calculation method (historical, parametric, Monte Carlo)
|
|
#[prost(enumeration = "VaRMethod", tag = "4")]
|
|
pub method: i32,
|
|
}
|
|
/// Response containing VaR calculation results
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetVaRResponse {
|
|
/// Total portfolio VaR value
|
|
#[prost(double, tag = "1")]
|
|
pub portfolio_var: f64,
|
|
/// Individual symbol VaR contributions
|
|
#[prost(message, repeated, tag = "2")]
|
|
pub symbol_vars: ::prost::alloc::vec::Vec<SymbolVaR>,
|
|
/// Confidence level used in calculation
|
|
#[prost(double, tag = "3")]
|
|
pub confidence_level: f64,
|
|
/// Historical period used
|
|
#[prost(int32, tag = "4")]
|
|
pub lookback_days: i32,
|
|
/// Calculation method used
|
|
#[prost(enumeration = "VaRMethod", tag = "5")]
|
|
pub method: i32,
|
|
/// Calculation timestamp (nanoseconds)
|
|
#[prost(int64, tag = "6")]
|
|
pub calculated_at: i64,
|
|
}
|
|
/// Request to stream real-time VaR updates
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct StreamVaRRequest {
|
|
/// Confidence level for VaR calculation
|
|
#[prost(double, tag = "1")]
|
|
pub confidence_level: f64,
|
|
/// How often to send updates
|
|
#[prost(int32, tag = "2")]
|
|
pub update_frequency_seconds: i32,
|
|
}
|
|
/// VaR contribution for a specific symbol
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct SymbolVaR {
|
|
/// Trading symbol
|
|
#[prost(string, tag = "1")]
|
|
pub symbol: ::prost::alloc::string::String,
|
|
/// VaR value for this symbol
|
|
#[prost(double, tag = "2")]
|
|
pub var_value: f64,
|
|
/// Current position size
|
|
#[prost(double, tag = "3")]
|
|
pub position_size: f64,
|
|
/// Percentage contribution to total portfolio VaR
|
|
#[prost(double, tag = "4")]
|
|
pub contribution_pct: f64,
|
|
}
|
|
/// Request for position risk analysis
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct GetPositionRiskRequest {
|
|
/// Filter by symbol (all symbols if not specified)
|
|
#[prost(string, optional, tag = "1")]
|
|
pub symbol: ::core::option::Option<::prost::alloc::string::String>,
|
|
/// Filter by account (all accounts if not specified)
|
|
#[prost(string, optional, tag = "2")]
|
|
pub account_id: ::core::option::Option<::prost::alloc::string::String>,
|
|
}
|
|
/// Response containing position risk analysis
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetPositionRiskResponse {
|
|
/// Risk analysis for each position
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub position_risks: ::prost::alloc::vec::Vec<PositionRisk>,
|
|
/// Overall portfolio risk score (0-100)
|
|
#[prost(double, tag = "2")]
|
|
pub portfolio_risk_score: f64,
|
|
}
|
|
/// Request to validate order against risk limits
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ValidateOrderRequest {
|
|
/// Trading symbol
|
|
#[prost(string, tag = "1")]
|
|
pub symbol: ::prost::alloc::string::String,
|
|
/// Order quantity
|
|
#[prost(double, tag = "2")]
|
|
pub quantity: f64,
|
|
/// Order price
|
|
#[prost(double, tag = "3")]
|
|
pub price: f64,
|
|
/// Buy or sell
|
|
#[prost(string, tag = "4")]
|
|
pub side: ::prost::alloc::string::String,
|
|
/// Trading account
|
|
#[prost(string, tag = "5")]
|
|
pub account_id: ::prost::alloc::string::String,
|
|
}
|
|
/// Response containing order validation results
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ValidateOrderResponse {
|
|
/// True if order passes all risk checks
|
|
#[prost(bool, tag = "1")]
|
|
pub is_valid: bool,
|
|
/// List of risk violations (if any)
|
|
#[prost(message, repeated, tag = "2")]
|
|
pub violations: ::prost::alloc::vec::Vec<RiskViolation>,
|
|
/// Risk assessment for this order
|
|
#[prost(message, optional, tag = "3")]
|
|
pub risk_score: ::core::option::Option<RiskScore>,
|
|
/// Human-readable validation message
|
|
#[prost(string, tag = "4")]
|
|
pub message: ::prost::alloc::string::String,
|
|
}
|
|
/// Request for comprehensive risk metrics
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct GetRiskMetricsRequest {
|
|
/// Portfolio identifier (default portfolio if not specified)
|
|
#[prost(string, optional, tag = "1")]
|
|
pub portfolio_id: ::core::option::Option<::prost::alloc::string::String>,
|
|
}
|
|
/// Response containing comprehensive risk metrics
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetRiskMetricsResponse {
|
|
/// Complete risk metrics and statistics
|
|
#[prost(message, optional, tag = "1")]
|
|
pub metrics: ::core::option::Option<RiskMetrics>,
|
|
/// Metrics calculation timestamp (nanoseconds)
|
|
#[prost(int64, tag = "2")]
|
|
pub calculated_at: i64,
|
|
}
|
|
/// Request to stream real-time risk alerts
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct StreamRiskAlertsRequest {
|
|
/// Minimum alert severity to receive
|
|
#[prost(enumeration = "RiskAlertSeverity", tag = "1")]
|
|
pub min_severity: i32,
|
|
/// Types of alerts to receive (empty = all types)
|
|
#[prost(enumeration = "RiskAlertType", repeated, tag = "2")]
|
|
pub alert_types: ::prost::alloc::vec::Vec<i32>,
|
|
}
|
|
/// Request to trigger emergency stop
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct EmergencyStopRequest {
|
|
/// Type of emergency stop (all trading, symbol, account, etc.)
|
|
#[prost(enumeration = "EmergencyStopType", tag = "1")]
|
|
pub stop_type: i32,
|
|
/// Reason for emergency stop
|
|
#[prost(string, tag = "2")]
|
|
pub reason: ::prost::alloc::string::String,
|
|
/// Symbol to stop (for symbol-specific stops)
|
|
#[prost(string, optional, tag = "3")]
|
|
pub symbol: ::core::option::Option<::prost::alloc::string::String>,
|
|
/// Account to stop (for account-specific stops)
|
|
#[prost(string, optional, tag = "4")]
|
|
pub account_id: ::core::option::Option<::prost::alloc::string::String>,
|
|
}
|
|
/// Response after emergency stop execution
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct EmergencyStopResponse {
|
|
/// True if emergency stop was successful
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
/// Status message or error description
|
|
#[prost(string, tag = "2")]
|
|
pub message: ::prost::alloc::string::String,
|
|
/// Emergency stop timestamp (nanoseconds)
|
|
#[prost(int64, tag = "3")]
|
|
pub timestamp: i64,
|
|
/// List of order IDs affected by the stop
|
|
#[prost(string, repeated, tag = "4")]
|
|
pub affected_orders: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
|
}
|
|
/// Request for circuit breaker status
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct GetCircuitBreakerStatusRequest {
|
|
/// Filter by symbol (all symbols if not specified)
|
|
#[prost(string, optional, tag = "1")]
|
|
pub symbol: ::core::option::Option<::prost::alloc::string::String>,
|
|
}
|
|
/// Response containing circuit breaker status
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetCircuitBreakerStatusResponse {
|
|
/// Status of all circuit breakers
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub circuit_breakers: ::prost::alloc::vec::Vec<CircuitBreakerStatus>,
|
|
}
|
|
/// Risk analysis for a specific position
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct PositionRisk {
|
|
/// Trading symbol
|
|
#[prost(string, tag = "1")]
|
|
pub symbol: ::prost::alloc::string::String,
|
|
/// Current position size
|
|
#[prost(double, tag = "2")]
|
|
pub position_size: f64,
|
|
/// Market value of position
|
|
#[prost(double, tag = "3")]
|
|
pub market_value: f64,
|
|
/// Contribution to portfolio VaR
|
|
#[prost(double, tag = "4")]
|
|
pub var_contribution: f64,
|
|
/// Position concentration risk (0-100)
|
|
#[prost(double, tag = "5")]
|
|
pub concentration_risk: f64,
|
|
/// Liquidity risk score (0-100)
|
|
#[prost(double, tag = "6")]
|
|
pub liquidity_risk: f64,
|
|
/// Overall risk assessment
|
|
#[prost(message, optional, tag = "7")]
|
|
pub overall_score: ::core::option::Option<RiskScore>,
|
|
/// Additional risk metrics
|
|
#[prost(message, repeated, tag = "8")]
|
|
pub metrics: ::prost::alloc::vec::Vec<RiskMetric>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct RiskViolation {
|
|
#[prost(enumeration = "RiskViolationType", tag = "1")]
|
|
pub violation_type: i32,
|
|
#[prost(string, tag = "2")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(double, tag = "3")]
|
|
pub current_value: f64,
|
|
#[prost(double, tag = "4")]
|
|
pub limit_value: f64,
|
|
#[prost(enumeration = "RiskAlertSeverity", tag = "5")]
|
|
pub severity: i32,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct RiskScore {
|
|
#[prost(double, tag = "1")]
|
|
pub overall_score: f64,
|
|
#[prost(double, tag = "2")]
|
|
pub concentration_score: f64,
|
|
#[prost(double, tag = "3")]
|
|
pub liquidity_score: f64,
|
|
#[prost(double, tag = "4")]
|
|
pub volatility_score: f64,
|
|
#[prost(double, tag = "5")]
|
|
pub correlation_score: f64,
|
|
#[prost(enumeration = "RiskLevel", tag = "6")]
|
|
pub risk_level: i32,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct RiskMetrics {
|
|
#[prost(double, tag = "1")]
|
|
pub portfolio_var_1d: f64,
|
|
#[prost(double, tag = "2")]
|
|
pub portfolio_var_5d: f64,
|
|
#[prost(double, tag = "3")]
|
|
pub portfolio_var_30d: f64,
|
|
#[prost(double, tag = "4")]
|
|
pub max_drawdown: f64,
|
|
#[prost(double, tag = "5")]
|
|
pub current_drawdown: f64,
|
|
#[prost(double, tag = "6")]
|
|
pub sharpe_ratio: f64,
|
|
#[prost(double, tag = "7")]
|
|
pub sortino_ratio: f64,
|
|
#[prost(double, tag = "8")]
|
|
pub beta: f64,
|
|
#[prost(double, tag = "9")]
|
|
pub alpha: f64,
|
|
#[prost(double, tag = "10")]
|
|
pub volatility: f64,
|
|
#[prost(message, repeated, tag = "11")]
|
|
pub position_risks: ::prost::alloc::vec::Vec<PositionRisk>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct RiskMetric {
|
|
#[prost(string, tag = "1")]
|
|
pub name: ::prost::alloc::string::String,
|
|
#[prost(double, tag = "2")]
|
|
pub value: f64,
|
|
#[prost(string, tag = "3")]
|
|
pub unit: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "RiskLevel", tag = "4")]
|
|
pub risk_level: i32,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct CircuitBreakerStatus {
|
|
#[prost(string, tag = "1")]
|
|
pub name: ::prost::alloc::string::String,
|
|
#[prost(bool, tag = "2")]
|
|
pub is_triggered: bool,
|
|
#[prost(string, optional, tag = "3")]
|
|
pub trigger_reason: ::core::option::Option<::prost::alloc::string::String>,
|
|
#[prost(int64, optional, tag = "4")]
|
|
pub triggered_at: ::core::option::Option<i64>,
|
|
#[prost(int64, optional, tag = "5")]
|
|
pub reset_at: ::core::option::Option<i64>,
|
|
#[prost(enumeration = "CircuitBreakerType", tag = "6")]
|
|
pub breaker_type: i32,
|
|
}
|
|
/// Event Messages
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct VaREvent {
|
|
#[prost(double, tag = "1")]
|
|
pub portfolio_var: f64,
|
|
#[prost(message, repeated, tag = "2")]
|
|
pub symbol_vars: ::prost::alloc::vec::Vec<SymbolVaR>,
|
|
#[prost(enumeration = "VaRChangeType", tag = "3")]
|
|
pub change_type: i32,
|
|
#[prost(int64, tag = "4")]
|
|
pub timestamp: i64,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct RiskAlertEvent {
|
|
#[prost(string, tag = "1")]
|
|
pub alert_id: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "RiskAlertType", tag = "2")]
|
|
pub alert_type: i32,
|
|
#[prost(enumeration = "RiskAlertSeverity", tag = "3")]
|
|
pub severity: i32,
|
|
#[prost(string, tag = "4")]
|
|
pub message: ::prost::alloc::string::String,
|
|
#[prost(string, optional, tag = "5")]
|
|
pub symbol: ::core::option::Option<::prost::alloc::string::String>,
|
|
#[prost(string, optional, tag = "6")]
|
|
pub account_id: ::core::option::Option<::prost::alloc::string::String>,
|
|
#[prost(map = "string, string", tag = "7")]
|
|
pub metadata: ::std::collections::HashMap<
|
|
::prost::alloc::string::String,
|
|
::prost::alloc::string::String,
|
|
>,
|
|
#[prost(int64, tag = "8")]
|
|
pub timestamp: i64,
|
|
}
|
|
/// VaR calculation methodology
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum VaRMethod {
|
|
/// Default/unknown method
|
|
VarMethodUnspecified = 0,
|
|
/// Historical simulation method
|
|
VarMethodHistorical = 1,
|
|
/// Parametric (variance-covariance) method
|
|
VarMethodParametric = 2,
|
|
/// Monte Carlo simulation method
|
|
VarMethodMonteCarlo = 3,
|
|
}
|
|
impl VaRMethod {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::VarMethodUnspecified => "VAR_METHOD_UNSPECIFIED",
|
|
Self::VarMethodHistorical => "VAR_METHOD_HISTORICAL",
|
|
Self::VarMethodParametric => "VAR_METHOD_PARAMETRIC",
|
|
Self::VarMethodMonteCarlo => "VAR_METHOD_MONTE_CARLO",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"VAR_METHOD_UNSPECIFIED" => Some(Self::VarMethodUnspecified),
|
|
"VAR_METHOD_HISTORICAL" => Some(Self::VarMethodHistorical),
|
|
"VAR_METHOD_PARAMETRIC" => Some(Self::VarMethodParametric),
|
|
"VAR_METHOD_MONTE_CARLO" => Some(Self::VarMethodMonteCarlo),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum RiskViolationType {
|
|
Unspecified = 0,
|
|
PositionLimit = 1,
|
|
Concentration = 2,
|
|
VarLimit = 3,
|
|
Drawdown = 4,
|
|
Liquidity = 5,
|
|
Correlation = 6,
|
|
}
|
|
impl RiskViolationType {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "RISK_VIOLATION_TYPE_UNSPECIFIED",
|
|
Self::PositionLimit => "RISK_VIOLATION_TYPE_POSITION_LIMIT",
|
|
Self::Concentration => "RISK_VIOLATION_TYPE_CONCENTRATION",
|
|
Self::VarLimit => "RISK_VIOLATION_TYPE_VAR_LIMIT",
|
|
Self::Drawdown => "RISK_VIOLATION_TYPE_DRAWDOWN",
|
|
Self::Liquidity => "RISK_VIOLATION_TYPE_LIQUIDITY",
|
|
Self::Correlation => "RISK_VIOLATION_TYPE_CORRELATION",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"RISK_VIOLATION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"RISK_VIOLATION_TYPE_POSITION_LIMIT" => Some(Self::PositionLimit),
|
|
"RISK_VIOLATION_TYPE_CONCENTRATION" => Some(Self::Concentration),
|
|
"RISK_VIOLATION_TYPE_VAR_LIMIT" => Some(Self::VarLimit),
|
|
"RISK_VIOLATION_TYPE_DRAWDOWN" => Some(Self::Drawdown),
|
|
"RISK_VIOLATION_TYPE_LIQUIDITY" => Some(Self::Liquidity),
|
|
"RISK_VIOLATION_TYPE_CORRELATION" => Some(Self::Correlation),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// Risk assessment levels
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum RiskLevel {
|
|
/// Default/unknown level
|
|
Unspecified = 0,
|
|
/// Low risk (green)
|
|
Low = 1,
|
|
/// Medium risk (yellow)
|
|
Medium = 2,
|
|
/// High risk (orange)
|
|
High = 3,
|
|
/// Critical risk (red)
|
|
Critical = 4,
|
|
}
|
|
impl RiskLevel {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "RISK_LEVEL_UNSPECIFIED",
|
|
Self::Low => "RISK_LEVEL_LOW",
|
|
Self::Medium => "RISK_LEVEL_MEDIUM",
|
|
Self::High => "RISK_LEVEL_HIGH",
|
|
Self::Critical => "RISK_LEVEL_CRITICAL",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"RISK_LEVEL_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"RISK_LEVEL_LOW" => Some(Self::Low),
|
|
"RISK_LEVEL_MEDIUM" => Some(Self::Medium),
|
|
"RISK_LEVEL_HIGH" => Some(Self::High),
|
|
"RISK_LEVEL_CRITICAL" => Some(Self::Critical),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// Severity levels for risk alerts
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum RiskAlertSeverity {
|
|
/// Default/unknown severity
|
|
Unspecified = 0,
|
|
/// Informational alert
|
|
Info = 1,
|
|
/// Warning alert
|
|
Warning = 2,
|
|
/// Critical alert requiring attention
|
|
Critical = 3,
|
|
/// Emergency alert requiring immediate action
|
|
Emergency = 4,
|
|
}
|
|
impl RiskAlertSeverity {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "RISK_ALERT_SEVERITY_UNSPECIFIED",
|
|
Self::Info => "RISK_ALERT_SEVERITY_INFO",
|
|
Self::Warning => "RISK_ALERT_SEVERITY_WARNING",
|
|
Self::Critical => "RISK_ALERT_SEVERITY_CRITICAL",
|
|
Self::Emergency => "RISK_ALERT_SEVERITY_EMERGENCY",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"RISK_ALERT_SEVERITY_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"RISK_ALERT_SEVERITY_INFO" => Some(Self::Info),
|
|
"RISK_ALERT_SEVERITY_WARNING" => Some(Self::Warning),
|
|
"RISK_ALERT_SEVERITY_CRITICAL" => Some(Self::Critical),
|
|
"RISK_ALERT_SEVERITY_EMERGENCY" => Some(Self::Emergency),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// Types of risk alerts
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum RiskAlertType {
|
|
/// Default/unknown type
|
|
Unspecified = 0,
|
|
/// VaR limit breach
|
|
VarBreach = 1,
|
|
/// Position size limit breach
|
|
PositionLimit = 2,
|
|
/// Drawdown limit breach
|
|
Drawdown = 3,
|
|
/// Portfolio concentration risk
|
|
Concentration = 4,
|
|
/// Liquidity risk alert
|
|
Liquidity = 5,
|
|
/// Correlation risk alert
|
|
Correlation = 6,
|
|
}
|
|
impl RiskAlertType {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "RISK_ALERT_TYPE_UNSPECIFIED",
|
|
Self::VarBreach => "RISK_ALERT_TYPE_VAR_BREACH",
|
|
Self::PositionLimit => "RISK_ALERT_TYPE_POSITION_LIMIT",
|
|
Self::Drawdown => "RISK_ALERT_TYPE_DRAWDOWN",
|
|
Self::Concentration => "RISK_ALERT_TYPE_CONCENTRATION",
|
|
Self::Liquidity => "RISK_ALERT_TYPE_LIQUIDITY",
|
|
Self::Correlation => "RISK_ALERT_TYPE_CORRELATION",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"RISK_ALERT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"RISK_ALERT_TYPE_VAR_BREACH" => Some(Self::VarBreach),
|
|
"RISK_ALERT_TYPE_POSITION_LIMIT" => Some(Self::PositionLimit),
|
|
"RISK_ALERT_TYPE_DRAWDOWN" => Some(Self::Drawdown),
|
|
"RISK_ALERT_TYPE_CONCENTRATION" => Some(Self::Concentration),
|
|
"RISK_ALERT_TYPE_LIQUIDITY" => Some(Self::Liquidity),
|
|
"RISK_ALERT_TYPE_CORRELATION" => Some(Self::Correlation),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// Types of emergency stops
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum EmergencyStopType {
|
|
/// Default/unknown type
|
|
Unspecified = 0,
|
|
/// Stop all trading activity
|
|
AllTrading = 1,
|
|
/// Stop trading for specific symbol
|
|
Symbol = 2,
|
|
/// Stop trading for specific account
|
|
Account = 3,
|
|
/// Stop specific trading strategy
|
|
Strategy = 4,
|
|
}
|
|
impl EmergencyStopType {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "EMERGENCY_STOP_TYPE_UNSPECIFIED",
|
|
Self::AllTrading => "EMERGENCY_STOP_TYPE_ALL_TRADING",
|
|
Self::Symbol => "EMERGENCY_STOP_TYPE_SYMBOL",
|
|
Self::Account => "EMERGENCY_STOP_TYPE_ACCOUNT",
|
|
Self::Strategy => "EMERGENCY_STOP_TYPE_STRATEGY",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"EMERGENCY_STOP_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"EMERGENCY_STOP_TYPE_ALL_TRADING" => Some(Self::AllTrading),
|
|
"EMERGENCY_STOP_TYPE_SYMBOL" => Some(Self::Symbol),
|
|
"EMERGENCY_STOP_TYPE_ACCOUNT" => Some(Self::Account),
|
|
"EMERGENCY_STOP_TYPE_STRATEGY" => Some(Self::Strategy),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum CircuitBreakerType {
|
|
Unspecified = 0,
|
|
PortfolioLoss = 1,
|
|
SymbolVolatility = 2,
|
|
PositionSize = 3,
|
|
Drawdown = 4,
|
|
}
|
|
impl CircuitBreakerType {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "CIRCUIT_BREAKER_TYPE_UNSPECIFIED",
|
|
Self::PortfolioLoss => "CIRCUIT_BREAKER_TYPE_PORTFOLIO_LOSS",
|
|
Self::SymbolVolatility => "CIRCUIT_BREAKER_TYPE_SYMBOL_VOLATILITY",
|
|
Self::PositionSize => "CIRCUIT_BREAKER_TYPE_POSITION_SIZE",
|
|
Self::Drawdown => "CIRCUIT_BREAKER_TYPE_DRAWDOWN",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"CIRCUIT_BREAKER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"CIRCUIT_BREAKER_TYPE_PORTFOLIO_LOSS" => Some(Self::PortfolioLoss),
|
|
"CIRCUIT_BREAKER_TYPE_SYMBOL_VOLATILITY" => Some(Self::SymbolVolatility),
|
|
"CIRCUIT_BREAKER_TYPE_POSITION_SIZE" => Some(Self::PositionSize),
|
|
"CIRCUIT_BREAKER_TYPE_DRAWDOWN" => Some(Self::Drawdown),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum VaRChangeType {
|
|
VarChangeTypeUnspecified = 0,
|
|
VarChangeTypeIncreased = 1,
|
|
VarChangeTypeDecreased = 2,
|
|
VarChangeTypeBreach = 3,
|
|
}
|
|
impl VaRChangeType {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::VarChangeTypeUnspecified => "VAR_CHANGE_TYPE_UNSPECIFIED",
|
|
Self::VarChangeTypeIncreased => "VAR_CHANGE_TYPE_INCREASED",
|
|
Self::VarChangeTypeDecreased => "VAR_CHANGE_TYPE_DECREASED",
|
|
Self::VarChangeTypeBreach => "VAR_CHANGE_TYPE_BREACH",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"VAR_CHANGE_TYPE_UNSPECIFIED" => Some(Self::VarChangeTypeUnspecified),
|
|
"VAR_CHANGE_TYPE_INCREASED" => Some(Self::VarChangeTypeIncreased),
|
|
"VAR_CHANGE_TYPE_DECREASED" => Some(Self::VarChangeTypeDecreased),
|
|
"VAR_CHANGE_TYPE_BREACH" => Some(Self::VarChangeTypeBreach),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// Generated client implementations.
|
|
#[allow(unused_qualifications)]
|
|
pub mod risk_service_client {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
use tonic::codegen::http::Uri;
|
|
/// Risk Management Service provides comprehensive risk assessment, monitoring, and control capabilities
|
|
/// for high-frequency trading operations. This service integrates real-time VaR calculations,
|
|
/// position risk analysis, compliance monitoring, and emergency controls.
|
|
#[derive(Debug, Clone)]
|
|
pub struct RiskServiceClient<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl RiskServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> RiskServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::Body>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
|
|
{
|
|
pub fn new(inner: T) -> Self {
|
|
let inner = tonic::client::Grpc::new(inner);
|
|
Self { inner }
|
|
}
|
|
pub fn with_origin(inner: T, origin: Uri) -> Self {
|
|
let inner = tonic::client::Grpc::with_origin(inner, origin);
|
|
Self { inner }
|
|
}
|
|
pub fn with_interceptor<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> RiskServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::Body>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::Body>,
|
|
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
|
|
{
|
|
RiskServiceClient::new(InterceptedService::new(inner, interceptor))
|
|
}
|
|
/// Compress requests with the given encoding.
|
|
///
|
|
/// This requires the server to support it otherwise it might respond with an
|
|
/// error.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.send_compressed(encoding);
|
|
self
|
|
}
|
|
/// Enable decompressing responses.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.accept_compressed(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_decoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[must_use]
|
|
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_encoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Value at Risk (VaR) Calculations
|
|
/// Calculate current portfolio VaR using specified method and parameters
|
|
pub async fn get_va_r(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetVaRRequest>,
|
|
) -> std::result::Result<tonic::Response<super::GetVaRResponse>, tonic::Status> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static("/risk.RiskService/GetVaR");
|
|
let mut req = request.into_request();
|
|
req.extensions_mut().insert(GrpcMethod::new("risk.RiskService", "GetVaR"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Stream real-time VaR updates as market conditions change
|
|
pub async fn stream_va_r_updates(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::StreamVaRRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::VaREvent>>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/risk.RiskService/StreamVaRUpdates",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("risk.RiskService", "StreamVaRUpdates"));
|
|
self.inner.server_streaming(req, path, codec).await
|
|
}
|
|
/// Position Risk Analysis
|
|
/// Get comprehensive risk analysis for current positions
|
|
pub async fn get_position_risk(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetPositionRiskRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetPositionRiskResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/risk.RiskService/GetPositionRisk",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("risk.RiskService", "GetPositionRisk"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Validate order against risk limits before execution
|
|
pub async fn validate_order(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ValidateOrderRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ValidateOrderResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/risk.RiskService/ValidateOrder",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("risk.RiskService", "ValidateOrder"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Risk Metrics and Monitoring
|
|
/// Get comprehensive portfolio risk metrics and statistics
|
|
pub async fn get_risk_metrics(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetRiskMetricsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetRiskMetricsResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/risk.RiskService/GetRiskMetrics",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("risk.RiskService", "GetRiskMetrics"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Stream real-time risk alerts and violations
|
|
pub async fn stream_risk_alerts(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::StreamRiskAlertsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::RiskAlertEvent>>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/risk.RiskService/StreamRiskAlerts",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("risk.RiskService", "StreamRiskAlerts"));
|
|
self.inner.server_streaming(req, path, codec).await
|
|
}
|
|
/// Emergency Controls and Circuit Breakers
|
|
/// Trigger emergency stop to halt trading activities
|
|
pub async fn emergency_stop(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::EmergencyStopRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::EmergencyStopResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/risk.RiskService/EmergencyStop",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("risk.RiskService", "EmergencyStop"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Get status of all circuit breakers and safety mechanisms
|
|
pub async fn get_circuit_breaker_status(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetCircuitBreakerStatusRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetCircuitBreakerStatusResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/risk.RiskService/GetCircuitBreakerStatus",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("risk.RiskService", "GetCircuitBreakerStatus"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Server-streaming: polls GetCircuitBreakerStatus at gateway level
|
|
pub async fn stream_circuit_breaker_status(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::StreamCircuitBreakerStatusRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<
|
|
tonic::codec::Streaming<super::GetCircuitBreakerStatusResponse>,
|
|
>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/risk.RiskService/StreamCircuitBreakerStatus",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("risk.RiskService", "StreamCircuitBreakerStatus"),
|
|
);
|
|
self.inner.server_streaming(req, path, codec).await
|
|
}
|
|
/// Server-streaming: polls GetRiskMetrics at gateway level
|
|
pub async fn stream_risk_metrics(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::StreamRiskMetricsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::GetRiskMetricsResponse>>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/risk.RiskService/StreamRiskMetrics",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("risk.RiskService", "StreamRiskMetrics"));
|
|
self.inner.server_streaming(req, path, codec).await
|
|
}
|
|
}
|
|
}
|