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 OrderFillDto {
    /// Id of the fill
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// Id of the order (from the context of the specified subaccount)
    #[serde(rename = "orderId")]
    pub order_id: uuid::Uuid,
    /// A subaccount scoped unique client-generated order id (either a UUID or alphanumeric string up to 32 characters)
    #[serde(rename = "clientOrderId", skip_serializing_if = "Option::is_none")]
    pub client_order_id: Option<String>,
    /// Fill price in 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,
    #[serde(rename = "type")]
    pub r#type: models::OrderFillDtoOrderType,
    #[serde(rename = "side")]
    pub side: models::OrderSide,
    /// Indicates if the fill is reduce only
    #[serde(rename = "reduceOnly")]
    pub reduce_only: bool,
    /// The provided subaccount's charged fee in USD expressed as a decimal (precision: 9)
    #[serde(rename = "feeUsd")]
    pub fee_usd: String,
    /// Indicates if the fill was a maker or taker
    #[serde(rename = "isMaker")]
    pub is_maker: bool,
    /// Id of product the order fill was made against
    #[serde(rename = "productId")]
    pub product_id: uuid::Uuid,
    /// Id of the subaccount associated to order fill
    #[serde(rename = "subaccountId")]
    pub subaccount_id: String,
    /// Fill creation timestamp (ms since Unix Epoch)
    #[serde(rename = "createdAt")]
    pub created_at: f64,
}

impl OrderFillDto {
    pub fn new(
        id: uuid::Uuid,
        order_id: uuid::Uuid,
        price: String,
        filled: String,
        r#type: models::OrderFillDtoOrderType,
        side: models::OrderSide,
        reduce_only: bool,
        fee_usd: String,
        is_maker: bool,
        product_id: uuid::Uuid,
        subaccount_id: String,
        created_at: f64,
    ) -> OrderFillDto {
        OrderFillDto {
            id,
            order_id,
            client_order_id: None,
            price,
            filled,
            r#type,
            side,
            reduce_only,
            fee_usd,
            is_maker,
            product_id,
            subaccount_id,
            created_at,
        }
    }
}