pub struct AgentState {Show 31 fields
pub agent_id: String,
pub last_tick: Option<DateTime<Utc>>,
pub trades_today: u32,
pub trades_day: Option<NaiveDate>,
pub rolls_today: u32,
pub open_positions: HashMap<String, TrackedPosition>,
pub last_actions: Vec<AgentAction>,
pub pending_order_ids: Vec<String>,
pub pending_orders: Vec<PendingOrder>,
pub tick_count: u64,
pub last_llm_review_tick: Option<u64>,
pub llm_review_count: u64,
pub last_llm_summary: Option<Value>,
pub last_session: Option<String>,
pub regular_tick_count: u64,
pub last_overnight_digest_at: Option<DateTime<Utc>>,
pub open_playbook: Option<Value>,
pub last_market_open: Option<bool>,
pub last_auth_reminder_level: Option<String>,
pub last_auth_reminder_at: Option<DateTime<Utc>>,
pub last_telegram_llm_at: Option<DateTime<Utc>>,
pub last_telegram_llm_digest_key: Option<String>,
pub sim: Option<SimLedger>,
pub redeploy_signal: Option<RedeploySignal>,
pub recent_stop_loss_exits: Vec<StopLossExitRecord>,
pub last_entry_attempts: HashMap<String, DateTime<Utc>>,
pub entry_proceed_cache: Option<EntryProceedCache>,
pub last_regime: Option<Value>,
pub sleeve_peak_equity_usd: f64,
pub cumulative_realized_pnl_usd: f64,
pub trading_halted_reason: Option<String>,
}Fields§
§agent_id: String§last_tick: Option<DateTime<Utc>>§trades_today: u32§trades_day: Option<NaiveDate>§rolls_today: u32Successful defensive rolls today (reset with trades_day).
open_positions: HashMap<String, TrackedPosition>§last_actions: Vec<AgentAction>§pending_order_ids: Vec<String>§pending_orders: Vec<PendingOrder>§tick_count: u64§last_llm_review_tick: Option<u64>§llm_review_count: u64§last_llm_summary: Option<Value>§last_session: Option<String>§regular_tick_count: u64§last_overnight_digest_at: Option<DateTime<Utc>>§open_playbook: Option<Value>§last_market_open: Option<bool>Last EQO regular-session open flag from agent tick (Schwab hours).
last_auth_reminder_level: Option<String>§last_auth_reminder_at: Option<DateTime<Utc>>§last_telegram_llm_at: Option<DateTime<Utc>>Last LLM review pushed to Telegram (for digest dedup).
last_telegram_llm_digest_key: Option<String>§sim: Option<SimLedger>Paper-trading ledger when running with –simulate (separate state file).
redeploy_signal: Option<RedeploySignal>Set after a thesis-driven exit — optional redeploy cooldown on that underlying.
recent_stop_loss_exits: Vec<StopLossExitRecord>Recent stop-loss exits for re-entry cooldown.
last_entry_attempts: HashMap<String, DateTime<Utc>>Last live entry attempt per candidate position_id (limits retry spam).
entry_proceed_cache: Option<EntryProceedCache>Cached LLM proceed for current candidate fingerprints.
last_regime: Option<Value>Last options regime snapshot (strategy selection).
sleeve_peak_equity_usd: f64High-water mark for options sleeve equity (drawdown halt).
cumulative_realized_pnl_usd: f64Cumulative realized PnL for live (non-sim) closes. Sim uses sim.realized_pnl_usd.
trading_halted_reason: Option<String>When set, new entries are paused (exits continue). Cleared when condition recovers.
Implementations§
Source§impl AgentState
impl AgentState
pub fn reset_daily_if_needed(&mut self, today: NaiveDate)
pub fn record_action(&mut self, action: &str, detail: Value)
pub fn count_open_for_strategy( &self, account_hash: &str, strategy: StrategyKind, ) -> u32
pub fn count_open_for_underlying( &self, account_hash: &str, underlying: &str, ) -> u32
Sourcepub fn count_open_in_symbol_set(
&self,
account_hash: &str,
symbols: &[String],
) -> u32
pub fn count_open_in_symbol_set( &self, account_hash: &str, symbols: &[String], ) -> u32
Open positions whose underlying is in symbols (case-insensitive).
pub fn pending_entry_count_in_symbol_set( &self, account_hash: &str, symbols: &[String], ) -> u32
pub fn pending_entry_count_for_underlying( &self, account_hash: &str, underlying: &str, ) -> u32
pub fn pending_entry_count(&self) -> u32
pub fn pending_count(&self) -> usize
pub fn trades_capacity_used(&self) -> u32
pub fn open_risk_usd(&self) -> f64
pub fn pending_entry_risk_usd(&self) -> f64
pub fn reserved_risk_usd(&self) -> f64
pub fn has_pending_position(&self, position_id: &str) -> bool
pub fn add_pending_order(&mut self, pending: PendingOrder)
pub fn remove_pending_order(&mut self, order_id: &str) -> Option<PendingOrder>
pub fn clear_legacy_pending_ids(&mut self)
pub fn total_contracts(&self) -> u32
Trait Implementations§
Source§impl Clone for AgentState
impl Clone for AgentState
Source§fn clone(&self) -> AgentState
fn clone(&self) -> AgentState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentState
impl Debug for AgentState
Source§impl Default for AgentState
impl Default for AgentState
Source§fn default() -> AgentState
fn default() -> AgentState
Source§impl<'de> Deserialize<'de> for AgentState
impl<'de> Deserialize<'de> for AgentState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AgentState
impl RefUnwindSafe for AgentState
impl Send for AgentState
impl Sync for AgentState
impl Unpin for AgentState
impl UnsafeUnpin for AgentState
impl UnwindSafe for AgentState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more