pub struct HoldingView {
pub instrument: String,
pub quantity: Option<f64>,
pub price: Option<f64>,
pub market_value: f64,
pub cost_basis: Option<f64>,
pub unrealized: Option<f64>,
pub unrealized_pct: Option<f64>,
pub weight: f64,
pub priced_by: String,
}Expand description
Every shape at the root as well, because a window names a view on nearly
every line and arvo_api::research::StudyView would be noise. The names
do not collide: proto has no overloading and neither does this.
Fields§
§instrument: String§quantity: Option<f64>None when the source reported money without units — a collective
trust in a 401(k) does exactly that.
price: Option<f64>§market_value: f64§cost_basis: Option<f64>§unrealized: Option<f64>§unrealized_pct: Option<f64>§weight: f64§priced_by: String“statement”, “last_close” or “face” — so a price nobody verified is visibly different from one that came off a statement.
Implementations§
Source§impl HoldingView
impl HoldingView
Sourcepub fn quantity(&self) -> f64
pub fn quantity(&self) -> f64
Returns the value of quantity, or the default value if quantity is unset.
Sourcepub fn cost_basis(&self) -> f64
pub fn cost_basis(&self) -> f64
Returns the value of cost_basis, or the default value if cost_basis is unset.
Sourcepub fn unrealized(&self) -> f64
pub fn unrealized(&self) -> f64
Returns the value of unrealized, or the default value if unrealized is unset.
Sourcepub fn unrealized_pct(&self) -> f64
pub fn unrealized_pct(&self) -> f64
Returns the value of unrealized_pct, or the default value if unrealized_pct is unset.
Trait Implementations§
Source§impl Clone for HoldingView
impl Clone for HoldingView
Source§impl Debug for HoldingView
impl Debug for HoldingView
Source§impl Default for HoldingView
impl Default for HoldingView
Source§impl<'de> Deserialize<'de> for HoldingView
impl<'de> Deserialize<'de> for HoldingView
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Message for HoldingView
impl Message for HoldingView
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
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,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
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,
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,
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,
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,
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,
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 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,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.Source§impl PartialEq for HoldingView
impl PartialEq for HoldingView
Source§impl Serialize for HoldingView
impl Serialize for HoldingView
impl StructuralPartialEq for HoldingView
Auto Trait Implementations§
impl Freeze for HoldingView
impl RefUnwindSafe for HoldingView
impl Send for HoldingView
impl Sync for HoldingView
impl Unpin for HoldingView
impl UnsafeUnpin for HoldingView
impl UnwindSafe for HoldingView
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
Mutably borrows from an owned value. Read more