Skip to main content

PortfolioConfigBuilder

Struct PortfolioConfigBuilder 

Source
pub struct PortfolioConfigBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build_inner().

Implementations§

Source§

impl<S: State> PortfolioConfigBuilder<S>

Source

pub fn use_mark_prices( self, value: bool, ) -> PortfolioConfigBuilder<SetUseMarkPrices<S>>
where S::UseMarkPrices: IsUnset,

Optional (Some / Option setters). Default: true.

The type of prices used for portfolio calculations, such as unrealized PnLs. If true (default), prefers mark prices when available, then falls back to quote, last trade, or bar prices when bar_updates is true. If false, skips mark prices and uses the fallback chain.

Source

pub fn maybe_use_mark_prices( self, value: Option<bool>, ) -> PortfolioConfigBuilder<SetUseMarkPrices<S>>
where S::UseMarkPrices: IsUnset,

Optional (Some / Option setters). Default: true.

The type of prices used for portfolio calculations, such as unrealized PnLs. If true (default), prefers mark prices when available, then falls back to quote, last trade, or bar prices when bar_updates is true. If false, skips mark prices and uses the fallback chain.

Source

pub fn use_mark_xrates( self, value: bool, ) -> PortfolioConfigBuilder<SetUseMarkXrates<S>>
where S::UseMarkXrates: IsUnset,

Optional (Some / Option setters). Default: false.

The type of exchange rates used for portfolio calculations. If false (default), uses quote prices. If true, uses mark prices.

Source

pub fn maybe_use_mark_xrates( self, value: Option<bool>, ) -> PortfolioConfigBuilder<SetUseMarkXrates<S>>
where S::UseMarkXrates: IsUnset,

Optional (Some / Option setters). Default: false.

The type of exchange rates used for portfolio calculations. If false (default), uses quote prices. If true, uses mark prices.

Source

pub fn bar_updates( self, value: bool, ) -> PortfolioConfigBuilder<SetBarUpdates<S>>
where S::BarUpdates: IsUnset,

Optional (Some / Option setters). Default: true.

If external bars should be considered for updating unrealized PnLs.

Source

pub fn maybe_bar_updates( self, value: Option<bool>, ) -> PortfolioConfigBuilder<SetBarUpdates<S>>
where S::BarUpdates: IsUnset,

Optional (Some / Option setters). Default: true.

If external bars should be considered for updating unrealized PnLs.

Source

pub fn convert_to_account_base_currency( self, value: bool, ) -> PortfolioConfigBuilder<SetConvertToAccountBaseCurrency<S>>
where S::ConvertToAccountBaseCurrency: IsUnset,

Optional (Some / Option setters). Default: true.

If calculations should be converted into each account’s base currency. This setting is only effective for accounts with a specified base currency.

Source

pub fn maybe_convert_to_account_base_currency( self, value: Option<bool>, ) -> PortfolioConfigBuilder<SetConvertToAccountBaseCurrency<S>>
where S::ConvertToAccountBaseCurrency: IsUnset,

Optional (Some / Option setters). Default: true.

If calculations should be converted into each account’s base currency. This setting is only effective for accounts with a specified base currency.

Source

pub fn equity_curve( self, value: bool, ) -> PortfolioConfigBuilder<SetEquityCurve<S>>
where S::EquityCurve: IsUnset,

Optional (Some / Option setters). Default: true.

If mark-to-market equity snapshots should be recorded and published for every account.

Enabled by default. Records at account registration, every UTC midnight including while flat, and shutdown. Disable for workloads such as optimizer runs that do not consume an equity curve. This does not affect on-demand equity calculations or the opt-in fine-grained snapshot_interval_ms stream.

Source

pub fn maybe_equity_curve( self, value: Option<bool>, ) -> PortfolioConfigBuilder<SetEquityCurve<S>>
where S::EquityCurve: IsUnset,

Optional (Some / Option setters). Default: true.

If mark-to-market equity snapshots should be recorded and published for every account.

Enabled by default. Records at account registration, every UTC midnight including while flat, and shutdown. Disable for workloads such as optimizer runs that do not consume an equity curve. This does not affect on-demand equity calculations or the opt-in fine-grained snapshot_interval_ms stream.

Source

pub fn min_account_state_logging_interval_ms( self, value: u64, ) -> PortfolioConfigBuilder<SetMinAccountStateLoggingIntervalMs<S>>
where S::MinAccountStateLoggingIntervalMs: IsUnset,

Optional (Some / Option setters). The minimum interval (milliseconds) between logging account state events for the same account. When set, account state updates will only be logged if this much time has passed since the last log. Useful for HFT deployments to prevent excessive logging when account states change rapidly.

Source

pub fn maybe_min_account_state_logging_interval_ms( self, value: Option<u64>, ) -> PortfolioConfigBuilder<SetMinAccountStateLoggingIntervalMs<S>>
where S::MinAccountStateLoggingIntervalMs: IsUnset,

Optional (Some / Option setters). The minimum interval (milliseconds) between logging account state events for the same account. When set, account state updates will only be logged if this much time has passed since the last log. Useful for HFT deployments to prevent excessive logging when account states change rapidly.

Source

pub fn snapshot_interval_ms( self, value: u64, ) -> PortfolioConfigBuilder<SetSnapshotIntervalMs<S>>
where S::SnapshotIntervalMs: IsUnset,

Optional (Some / Option setters). The interval (milliseconds) between portfolio snapshot emissions per account. When set, a PortfolioSnapshot is emitted at this cadence while the account holds at least one open position, carrying continuous mark-to-market equity. When None (the default), no fine-grained snapshots are emitted; the equity_curve setting still controls daily snapshots.

Source

pub fn maybe_snapshot_interval_ms( self, value: Option<u64>, ) -> PortfolioConfigBuilder<SetSnapshotIntervalMs<S>>
where S::SnapshotIntervalMs: IsUnset,

Optional (Some / Option setters). The interval (milliseconds) between portfolio snapshot emissions per account. When set, a PortfolioSnapshot is emitted at this cadence while the account holds at least one open position, carrying continuous mark-to-market equity. When None (the default), no fine-grained snapshots are emitted; the equity_curve setting still controls daily snapshots.

Source

pub fn debug(self, value: bool) -> PortfolioConfigBuilder<SetDebug<S>>
where S::Debug: IsUnset,

Optional (Some / Option setters). Default: false.

If debug mode is active (will provide extra debug logging).

Source

pub fn maybe_debug( self, value: Option<bool>, ) -> PortfolioConfigBuilder<SetDebug<S>>
where S::Debug: IsUnset,

Optional (Some / Option setters). Default: false.

If debug mode is active (will provide extra debug logging).

Source§

impl<S: IsComplete> PortfolioConfigBuilder<S>

Source

pub fn build(self) -> ConfigResult<PortfolioConfig>

Validates and builds the PortfolioConfig.

§Errors

Returns a [ConfigError] if any field fails validation (see PortfolioConfig::validate).

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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 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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, <T as TryFrom<U>>::Error>

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.
§

impl<T> Ungil for T
where T: Send,

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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