pub struct PositionLimitEnforcer { /* private fields */ }Expand description
Position limit enforcer
Implementations§
Source§impl PositionLimitEnforcer
impl PositionLimitEnforcer
pub fn new(limits: PositionLimits) -> Self
Sourcepub fn set_sector(&self, asset: &str, sector: &str)
pub fn set_sector(&self, asset: &str, sector: &str)
Set sector mapping for an asset
Sourcepub fn update_position(&self, asset: &str, value: f64)
pub fn update_position(&self, asset: &str, value: f64)
Update current position
Sourcepub fn check_trade(
&self,
asset: &str,
proposed_value: f64,
portfolio_value: f64,
) -> Result<()>
pub fn check_trade( &self, asset: &str, proposed_value: f64, portfolio_value: f64, ) -> Result<()>
Check if a proposed trade would violate limits
Sourcepub fn gross_exposure(&self) -> f64
pub fn gross_exposure(&self) -> f64
Get current gross exposure
Sourcepub fn net_exposure(&self) -> f64
pub fn net_exposure(&self) -> f64
Get current net exposure
Auto Trait Implementations§
impl Freeze for PositionLimitEnforcer
impl RefUnwindSafe for PositionLimitEnforcer
impl Send for PositionLimitEnforcer
impl Sync for PositionLimitEnforcer
impl Unpin for PositionLimitEnforcer
impl UnwindSafe for PositionLimitEnforcer
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.