pub struct PositionClose {
pub symbol: String,
pub side: Side,
pub qty: f64,
pub entry_price: f64,
pub exit_price: f64,
pub pnl_realized: f64,
pub rr_ratio: Option<f64>,
pub strategy: Option<String>,
pub position_id: Option<String>,
pub session_id: Option<String>,
}Expand description
A terminal event: the producer closed a position. Carries the realized
outcome so Janus can record what actually happened against the guidance it
advised while the position was open. Sent to POST /api/v1/positions/close.
Fields§
§symbol: StringTrading pair / instrument (e.g. “BTC-USD”).
side: SideDirection the (now-closed) position was held in.
qty: f64Position size in base units (always positive).
entry_price: f64Average fill price the position was opened at.
exit_price: f64Average fill price the position was closed at.
pnl_realized: f64Realized P&L in quote currency (signed).
rr_ratio: Option<f64>Optional realized risk-reward ratio for this trade, when the producer tracks it. Fed straight into affinity learning.
strategy: Option<String>Optional strategy name that opened this position. Required for the
outcome to be fed back into the per-(strategy, asset) affinity
tracker; omitted closes are still persisted, just not recorded live.
position_id: Option<String>Client position id, used to correlate with the open snapshots so the outcome can be joined with this position’s guidance history.
session_id: Option<String>Optional JanusAI session id.
Implementations§
Trait Implementations§
Source§impl Clone for PositionClose
impl Clone for PositionClose
Source§fn clone(&self) -> PositionClose
fn clone(&self) -> PositionClose
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more