Expose futures account runtime view

This commit is contained in:
boris
2026-04-23 20:35:32 -07:00
parent 2669350154
commit db4e385308
7 changed files with 191 additions and 9 deletions

View File

@@ -353,6 +353,7 @@ impl FuturesPosition {
#[derive(Debug, Clone)]
pub struct FuturesAccountState {
starting_cash: f64,
total_cash: f64,
frozen_cash: f64,
positions: BTreeMap<(String, FuturesDirection), FuturesPosition>,
@@ -361,12 +362,17 @@ pub struct FuturesAccountState {
impl FuturesAccountState {
pub fn new(total_cash: f64) -> Self {
Self {
starting_cash: total_cash,
total_cash,
frozen_cash: 0.0,
positions: BTreeMap::new(),
}
}
pub fn starting_cash(&self) -> f64 {
self.starting_cash
}
pub fn total_cash(&self) -> f64 {
self.total_cash
}