1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Ethereal Exchange API
*
* Ethereal HTTP API for real-time trading, order management, and market data access.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PositionLiquidationDto {
/// Id representing the position liquidation
#[serde(rename = "id")]
pub id: uuid::Uuid,
/// Id representing the subaccount that was liquidated
#[serde(rename = "subaccountId")]
pub subaccount_id: uuid::Uuid,
/// Id representing the product that was liquidated
#[serde(rename = "productId")]
pub product_id: uuid::Uuid,
/// Id representing the position that was liquidated
#[serde(rename = "positionId")]
pub position_id: uuid::Uuid,
/// Liquidation mark price in USD expressed as a decimal (precision: 9)
#[serde(rename = "liquidationPrice")]
pub liquidation_price: String,
#[serde(rename = "cause")]
pub cause: models::CauseEnum,
/// Position cost at the time of liquidation in USD expressed as a decimal (precision: 9)
#[serde(rename = "cost")]
pub cost: String,
/// Funding charged in USD expressed as a decimal (precision: 9), undefined if not liquidated due to funding
#[serde(rename = "fundingChargeUsd", skip_serializing_if = "Option::is_none")]
pub funding_charge_usd: Option<String>,
#[serde(rename = "positionSide")]
pub position_side: models::PositionSideEnum,
/// Position liquidation timestamp (ms since Unix Epoch)
#[serde(rename = "createdAt")]
pub created_at: f64,
}
impl PositionLiquidationDto {
pub fn new(
id: uuid::Uuid,
subaccount_id: uuid::Uuid,
product_id: uuid::Uuid,
position_id: uuid::Uuid,
liquidation_price: String,
cause: models::CauseEnum,
cost: String,
position_side: models::PositionSideEnum,
created_at: f64,
) -> PositionLiquidationDto {
PositionLiquidationDto {
id,
subaccount_id,
product_id,
position_id,
liquidation_price,
cause,
cost,
funding_charge_usd: None,
position_side,
created_at,
}
}
}