MCPcopy Create free account
hub / github.com/Open-Quant/openquant / validate_event

Function validate_event

crates/openquant/src/streaming_hpc.rs:449–461  ·  view source on GitHub ↗
(event: StreamEvent)

Source from the content-addressed store, hash-verified

447}
448
449fn validate_event(event: StreamEvent) -> Result<(), StreamingHpcError> {
450 if !event.price.is_finite() || event.price <= 0.0 {
451 return Err(StreamingHpcError::InvalidEvent("price must be finite and > 0"));
452 }
453 validate_non_negative_finite("buy_volume", event.buy_volume)?;
454 validate_non_negative_finite("sell_volume", event.sell_volume)?;
455 if event.total_volume() <= 0.0 {
456 return Err(StreamingHpcError::InvalidEvent(
457 "event must have strictly positive total volume",
458 ));
459 }
460 Ok(())
461}

Callers 1

on_eventMethod · 0.85

Calls 2

total_volumeMethod · 0.80

Tested by

no test coverage detected