Skip to main content

hypercall_db/
pnl_attribution.rs

1use serde::Deserialize;
2use std::collections::HashMap;
3
4#[derive(Debug, Deserialize)]
5struct CompactAttribution {
6    /// Map of symbol -> [position, entry_price, realized, unrealized, total].
7    s: HashMap<String, [f64; 5]>,
8}
9
10pub fn decode_pnl_attribution_values(
11    bytes: &[u8],
12) -> Result<HashMap<String, [f64; 5]>, rmp_serde::decode::Error> {
13    let compact: CompactAttribution = rmp_serde::from_slice(bytes)?;
14    Ok(compact.s)
15}