pub struct Settlement {Show 14 fields
pub settlement_type: SettlementType,
pub timestamp: i64,
pub instrument_name: Option<String>,
pub position_size: Option<f64>,
pub mark_price: Option<f64>,
pub index_price: Option<f64>,
pub profit_loss: Option<f64>,
pub funding: Option<f64>,
pub session_profit_loss: Option<f64>,
pub session_bankrupt_cy: Option<f64>,
pub session_tax: Option<f64>,
pub session_tax_rate: Option<f64>,
pub socialized_losses: Option<f64>,
pub additional_fields: HashMap<String, Value>,
}Expand description
Settlement event information
Fields§
§settlement_type: SettlementTypeType of settlement event
timestamp: i64Timestamp of the settlement event (milliseconds since Unix epoch)
instrument_name: Option<String>Instrument name (settlement and delivery only)
position_size: Option<f64>Position size in quote currency (settlement and delivery only)
mark_price: Option<f64>Mark price at settlement time in quote currency (settlement and delivery only)
index_price: Option<f64>Underlying index price at time of event in quote currency (settlement and delivery only)
profit_loss: Option<f64>Profit and loss in base currency (settlement and delivery only)
funding: Option<f64>Funding in base currency (settlement for perpetual product only)
session_profit_loss: Option<f64>Session profit and loss (optional)
session_bankrupt_cy: Option<f64>Session bankruptcy (optional)
session_tax: Option<f64>Session tax (optional)
session_tax_rate: Option<f64>Session tax rate (optional)
Socialized losses (optional)
additional_fields: HashMap<String, Value>Additional fields that might be present in the API response
Implementations§
Source§impl Settlement
impl Settlement
Sourcepub fn new(settlement_type: SettlementType, timestamp: i64) -> Self
pub fn new(settlement_type: SettlementType, timestamp: i64) -> Self
Create a new settlement event
Sourcepub fn for_instrument(
settlement_type: SettlementType,
timestamp: i64,
instrument_name: String,
) -> Self
pub fn for_instrument( settlement_type: SettlementType, timestamp: i64, instrument_name: String, ) -> Self
Create a settlement event for an instrument
Sourcepub fn with_position(self, size: f64, mark_price: f64, index_price: f64) -> Self
pub fn with_position(self, size: f64, mark_price: f64, index_price: f64) -> Self
Set position details
Sourcepub fn with_funding(self, funding: f64) -> Self
pub fn with_funding(self, funding: f64) -> Self
Set funding (for perpetuals)
Sourcepub fn is_settlement(&self) -> bool
pub fn is_settlement(&self) -> bool
Check if this is a settlement event
Sourcepub fn is_delivery(&self) -> bool
pub fn is_delivery(&self) -> bool
Check if this is a delivery event
Sourcepub fn is_bankruptcy(&self) -> bool
pub fn is_bankruptcy(&self) -> bool
Check if this is a bankruptcy event
Trait Implementations§
Source§impl Clone for Settlement
impl Clone for Settlement
Source§fn clone(&self) -> Settlement
fn clone(&self) -> Settlement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Settlement
impl Debug for Settlement
Source§impl Default for Settlement
impl Default for Settlement
Source§impl<'de> Deserialize<'de> for Settlement
impl<'de> Deserialize<'de> for Settlement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Settlement
impl Display for Settlement
Source§impl PartialEq for Settlement
impl PartialEq for Settlement
Source§impl Serialize for Settlement
impl Serialize for Settlement
impl StructuralPartialEq for Settlement
Auto Trait Implementations§
impl Freeze for Settlement
impl RefUnwindSafe for Settlement
impl Send for Settlement
impl Sync for Settlement
impl Unpin for Settlement
impl UnwindSafe for Settlement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.