pub struct PositionBuilder {
Show 18 fields pub position_id: Option<PositionId>, pub exchange: Option<Exchange>, pub instrument: Option<Instrument>, pub meta: Option<PositionMeta>, pub side: Option<Side>, pub quantity: Option<f64>, pub enter_fees: Option<Fees>, pub enter_fees_total: Option<FeeAmount>, pub enter_avg_price_gross: Option<f64>, pub enter_value_gross: Option<f64>, pub exit_fees: Option<Fees>, pub exit_fees_total: Option<FeeAmount>, pub exit_avg_price_gross: Option<f64>, pub exit_value_gross: Option<f64>, pub current_symbol_price: Option<f64>, pub current_value_gross: Option<f64>, pub unrealised_profit_loss: Option<f64>, pub realised_profit_loss: Option<f64>,
}
Expand description

Builder to construct Position instances.

Fields§

§position_id: Option<PositionId>§exchange: Option<Exchange>§instrument: Option<Instrument>§meta: Option<PositionMeta>§side: Option<Side>§quantity: Option<f64>§enter_fees: Option<Fees>§enter_fees_total: Option<FeeAmount>§enter_avg_price_gross: Option<f64>§enter_value_gross: Option<f64>§exit_fees: Option<Fees>§exit_fees_total: Option<FeeAmount>§exit_avg_price_gross: Option<f64>§exit_value_gross: Option<f64>§current_symbol_price: Option<f64>§current_value_gross: Option<f64>§unrealised_profit_loss: Option<f64>§realised_profit_loss: Option<f64>

Implementations§

source§

impl PositionBuilder

source

pub fn new() -> Self

source

pub fn position_id(self, value: PositionId) -> Self

source

pub fn exchange(self, value: Exchange) -> Self

source

pub fn instrument(self, value: Instrument) -> Self

source

pub fn meta(self, value: PositionMeta) -> Self

source

pub fn side(self, value: Side) -> Self

source

pub fn quantity(self, value: f64) -> Self

source

pub fn enter_fees(self, value: Fees) -> Self

source

pub fn enter_fees_total(self, value: FeeAmount) -> Self

source

pub fn enter_avg_price_gross(self, value: f64) -> Self

source

pub fn enter_value_gross(self, value: f64) -> Self

source

pub fn exit_fees(self, value: Fees) -> Self

source

pub fn exit_fees_total(self, value: FeeAmount) -> Self

source

pub fn exit_avg_price_gross(self, value: f64) -> Self

source

pub fn exit_value_gross(self, value: f64) -> Self

source

pub fn current_symbol_price(self, value: f64) -> Self

source

pub fn current_value_gross(self, value: f64) -> Self

source

pub fn unrealised_profit_loss(self, value: f64) -> Self

source

pub fn realised_profit_loss(self, value: f64) -> Self

source

pub fn build(self) -> Result<Position, PortfolioError>

Trait Implementations§

source§

impl Debug for PositionBuilder

source§

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

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

impl Default for PositionBuilder

source§

fn default() -> PositionBuilder

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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more