Skip to main content

TradeRowView

Struct TradeRowView 

Source
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: String

Which 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: String

Empty 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: String

signal, 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

Source

pub fn exit(&self) -> f64

Returns the value of exit, or the default value if exit is unset.

Source

pub fn held_days(&self) -> f64

Returns the value of held_days, or the default value if held_days is unset.

Source

pub fn rule(&self) -> &str

Returns the value of rule, or the default value if rule is unset.

Source

pub fn signal(&self) -> f64

Returns the value of signal, or the default value if signal is unset.

Source

pub fn regime(&self) -> &str

Returns the value of regime, or the default value if regime is unset.

Source

pub fn asked(&self) -> f64

Returns the value of asked, or the default value if asked is unset.

Trait Implementations§

Source§

impl Clone for TradeRowView

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TradeRowView

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TradeRowView

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TradeRowView

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Message for TradeRowView

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8> ⓘ
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘ
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for TradeRowView

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TradeRowView

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TradeRowView

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.