pub struct Instrument { /* private fields */ }Expand description
Trading instrument definition.
underlying_asset is the asset that is actually bought or sold.
Order quantity, position size, and exposure are expressed in this asset.
settlement_asset is the asset used for monetary settlement.
P&L, fees, and cash flows are expressed in this asset.
§Examples
Instrument { underlying_asset: AAPL, settlement_asset: USD }
BUY 100 AAPL @ 200
-> position changes in AAPL
-> cash flow and P&L are in USDInstrument { underlying_asset: SPX, settlement_asset: USD }
-> position is tracked in SPX contracts
-> P&L is tracked in USDImplementations§
Source§impl Instrument
impl Instrument
Sourcepub fn new(underlying_asset: Asset, settlement_asset: Asset) -> Self
pub fn new(underlying_asset: Asset, settlement_asset: Asset) -> Self
Creates an instrument definition.
underlying_asset is the traded asset (for example AAPL or SPX).
settlement_asset is the asset used for P&L and cash settlement
(for example USD).
Sourcepub fn underlying_asset(&self) -> &Asset
pub fn underlying_asset(&self) -> &Asset
Returns the asset that is bought or sold.
This is the asset in which order quantity and resulting position are measured.
§Examples
Instrument { underlying_asset: AAPL, settlement_asset: USD }
BUY 100 AAPL @ 200
-> quantity and position are in AAPLSourcepub fn settlement_asset(&self) -> &Asset
pub fn settlement_asset(&self) -> &Asset
Returns the asset used for monetary settlement.
This is the asset in which cash flow, fees, and P&L are measured.
§Examples
Instrument { underlying_asset: AAPL, settlement_asset: USD }
BUY 100 AAPL @ 200
-> cash flow and P&L are in USDInstrument { underlying_asset: SPX, settlement_asset: USD }
-> contracts are in SPX
-> settlement remains in USDTrait Implementations§
Source§impl Clone for Instrument
impl Clone for Instrument
Source§fn clone(&self) -> Instrument
fn clone(&self) -> Instrument
Returns a duplicate of the value. Read more
1.0.0 · 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 Instrument
impl Debug for Instrument
Source§impl Hash for Instrument
impl Hash for Instrument
Source§impl PartialEq for Instrument
impl PartialEq for Instrument
impl Eq for Instrument
impl StructuralPartialEq for Instrument
Auto Trait Implementations§
impl Freeze for Instrument
impl RefUnwindSafe for Instrument
impl Send for Instrument
impl Sync for Instrument
impl Unpin for Instrument
impl UnsafeUnpin for Instrument
impl UnwindSafe for Instrument
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