#[derive(Debug, serde::Deserialize)]
pub struct RtdsCryptoPayload {
pub symbol: String,
pub timestamp: i64, pub value: f64, pub full_accuracy_value: String, }
#[derive(Debug, serde::Deserialize)]
pub struct RtdsMessage {
pub topic: String,
pub r#type: String,
pub timestamp: i64, pub payload: serde_json::Value, pub connection_id: String,
}
impl RtdsMessage {
pub fn as_crypto_price(&self) -> Result<RtdsCryptoPayload, serde_json::Error> {
serde_json::from_value(self.payload.clone())
}
}