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 more