ethereal_rust_sdk 0.1.22

Trading client for Ethereal exchange
Documentation
/*
 * 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 PositionFillDto {
    /// Fill price expressed as a decimal (precision: 9)
    #[serde(rename = "price")]
    pub price: String,
    /// Quantity filled in native units expressed as a decimal (precision: 9)
    #[serde(rename = "filled")]
    pub filled: String,
    /// Realized PnL from the fill in USD expressed as a decimal (precision: 9)
    #[serde(rename = "realizedPnl")]
    pub realized_pnl: String,
    #[serde(rename = "type")]
    pub r#type: models::PositionFillDtoOrderType,
    #[serde(rename = "side")]
    pub side: models::OrderSide,
    /// Indicates if the fill is reduce only
    #[serde(rename = "reduceOnly")]
    pub reduce_only: bool,
    /// The charged fee in USD expressed as a decimal (precision: 9)
    #[serde(rename = "feeUsd")]
    pub fee_usd: String,
    /// Fill creation timestamp (ms since Unix Epoch)
    #[serde(rename = "createdAt")]
    pub created_at: f64,
}

impl PositionFillDto {
    pub fn new(
        price: String,
        filled: String,
        realized_pnl: String,
        r#type: models::PositionFillDtoOrderType,
        side: models::OrderSide,
        reduce_only: bool,
        fee_usd: String,
        created_at: f64,
    ) -> PositionFillDto {
        PositionFillDto {
            price,
            filled,
            realized_pnl,
            r#type,
            side,
            reduce_only,
            fee_usd,
            created_at,
        }
    }
}