pub struct InstrumentCosts {
pub commission: Option<CommissionModel>,
pub swap: Option<SwapSchedule>,
}Expand description
Complete cost specification for one instrument.
Fields§
§commission: Option<CommissionModel>§swap: Option<SwapSchedule>Implementations§
Source§impl InstrumentCosts
impl InstrumentCosts
Sourcepub fn commission_for_fill(
&self,
side: Side,
lots: f64,
fill_price: f64,
contract_size: f64,
) -> Option<CostCharge>
pub fn commission_for_fill( &self, side: Side, lots: f64, fill_price: f64, contract_size: f64, ) -> Option<CostCharge>
Signed commission for one fill of lots at fill_price.
contract_size is the number of quote-currency units moved by one full lot and one price unit, matching the multiplier the accounting path already applies to profit and loss.
Sourcepub fn swap_for_rollover(
&self,
side: Side,
lots: f64,
contract_size: f64,
point_size: f64,
nights: u32,
) -> Option<CostCharge>
pub fn swap_for_rollover( &self, side: Side, lots: f64, contract_size: f64, point_size: f64, nights: u32, ) -> Option<CostCharge>
Signed swap for holding lots across nights rollovers.
point_size is one price point for the instrument, normally 10^-digits. It is ignored when the schedule is expressed in account currency.
Sourcepub fn validate(&self) -> Result<(), CostValidationError>
pub fn validate(&self) -> Result<(), CostValidationError>
Reject non-finite, negative, or out-of-range configuration before a run starts.
Sourcepub fn validate_against_account_currency(
&self,
account_currency: &str,
) -> Result<(), CostValidationError>
pub fn validate_against_account_currency( &self, account_currency: &str, ) -> Result<(), CostValidationError>
Reject account-currency costs that declare a different currency than the run.
Sourcepub fn requires_point_size(&self) -> bool
pub fn requires_point_size(&self) -> bool
True when a point-denominated swap requires an instrument point size.
Trait Implementations§
Source§impl Clone for InstrumentCosts
impl Clone for InstrumentCosts
Source§fn clone(&self) -> InstrumentCosts
fn clone(&self) -> InstrumentCosts
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InstrumentCosts
impl Debug for InstrumentCosts
Source§impl Default for InstrumentCosts
impl Default for InstrumentCosts
Source§fn default() -> InstrumentCosts
fn default() -> InstrumentCosts
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for InstrumentCosts
impl<'de> Deserialize<'de> for InstrumentCosts
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<InstrumentCosts, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<InstrumentCosts, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for InstrumentCosts
impl PartialEq for InstrumentCosts
Source§impl Serialize for InstrumentCosts
impl Serialize for InstrumentCosts
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for InstrumentCosts
Auto Trait Implementations§
impl Freeze for InstrumentCosts
impl RefUnwindSafe for InstrumentCosts
impl Send for InstrumentCosts
impl Sync for InstrumentCosts
impl Unpin for InstrumentCosts
impl UnsafeUnpin for InstrumentCosts
impl UnwindSafe for InstrumentCosts
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