pub struct TradeRowView {Show 15 fields
pub instrument: String,
pub opened: String,
pub closed: String,
pub direction: String,
pub quantity: f64,
pub entry: f64,
pub exit: Option<f64>,
pub pnl: f64,
pub commission: f64,
pub held_days: Option<f64>,
pub exit_reason: String,
pub rule: Option<String>,
pub signal: Option<f64>,
pub regime: Option<String>,
pub asked: Option<f64>,
}Expand description
One round trip, as a table row.
Every field the ledger holds, because the point of a table is that nobody has to decide in advance which column someone will want to sort by. The aggregate statistics above it answer “how did it do”; this answers “what did it actually do”, and those are different questions with different failure modes — an expectancy of +£300 built from one +£9,000 trade and nineteen losses is a fact only the rows show.
Fields§
§instrument: StringWhich instrument this round trip was in.
Empty for a run recorded before the ledger named instruments, and for an ordinary single-instrument study where the subject line already says it. Only a book shows the column.
opened: String§closed: StringEmpty while the position is still open at the end of the run.
direction: String§quantity: f64§entry: f64§exit: Option<f64>None while still open, so the table shows a gap rather than a price
nobody traded at.
pnl: f64§commission: f64§held_days: Option<f64>Days held. Fractional, because an intraday trade held forty minutes is not “0 days” — it is 0.03, and rounding it away would make every intraday ledger look like a column of zeroes.
exit_reason: Stringsignal, stop, or open.
rule: Option<String>What the rule saw at entry (#190): the condition that fired, the value it was judged on, the regime it saw, and the quantity it asked the gate for. Absent on a trade recorded before the journal or opened by no rule.
signal: Option<f64>§regime: Option<String>§asked: Option<f64>Implementations§
Source§impl TradeRowView
impl TradeRowView
Sourcepub fn held_days(&self) -> f64
pub fn held_days(&self) -> f64
Returns the value of held_days, or the default value if held_days is unset.
Sourcepub fn signal(&self) -> f64
pub fn signal(&self) -> f64
Returns the value of signal, or the default value if signal is unset.
Trait Implementations§
Source§impl Clone for TradeRowView
impl Clone for TradeRowView
Source§impl Debug for TradeRowView
impl Debug for TradeRowView
Source§impl Default for TradeRowView
impl Default for TradeRowView
Source§impl<'de> Deserialize<'de> for TradeRowView
impl<'de> Deserialize<'de> for TradeRowView
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>,
Source§impl Message for TradeRowView
impl Message for TradeRowView
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.