Match fractional share lots and preserve order quantities across restart
This commit is contained in:
@@ -4,11 +4,22 @@ use serde::Serialize;
|
||||
use serde_json::{json, Value};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
fn serialize_hundredths<S: serde::Serializer>(
|
||||
value: &i64,
|
||||
serializer: S,
|
||||
) -> std::result::Result<S::Ok, S::Error> {
|
||||
crate::lots::display(*value).serialize(serializer)
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize)]
|
||||
struct Totals {
|
||||
#[serde(serialize_with = "serialize_hundredths")]
|
||||
matched_shares: i64,
|
||||
#[serde(serialize_with = "serialize_hundredths")]
|
||||
taker_shares: i64,
|
||||
#[serde(serialize_with = "serialize_hundredths")]
|
||||
taker_notional_cents: i64,
|
||||
#[serde(serialize_with = "serialize_hundredths")]
|
||||
unknown_role_shares: i64,
|
||||
}
|
||||
|
||||
@@ -30,6 +41,7 @@ impl Totals {
|
||||
pub(crate) struct Volume {
|
||||
all_time: Totals,
|
||||
last_24h: Totals,
|
||||
#[serde(serialize_with = "serialize_hundredths")]
|
||||
unknown_time_shares: i64,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user