bluefin_api 1.13.0

Bluefin API
Documentation
/*
 * Bluefin API
 *
 * Bluefin API
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OpenOrderResponse {
    /// The Order Hash, which is the default way to uniquely identify an order in the system
    #[serde(rename = "orderHash")]
    pub order_hash: String,
    /// The Client Order ID, which is used a unique identifier for an order, provided by the client, in case of proprietary order management systems
    #[serde(rename = "clientOrderId", skip_serializing_if = "Option::is_none")]
    pub client_order_id: Option<String>,
    /// The market symbol
    #[serde(rename = "symbol")]
    pub symbol: String,
    /// The account address of the order. May be an account user is authorized for.
    #[serde(rename = "accountAddress")]
    pub account_address: String,
    /// The signer address of the order. May be an account user is authorized for.
    #[serde(rename = "signerAddress")]
    pub signer_address: String,
    /// The price in base e9 of the asset to be traded. Should always be a number
    #[serde(rename = "priceE9")]
    pub price_e9: String,
    /// The quantity in base e9 of the asset to be traded. Should always be a number
    #[serde(rename = "quantityE9")]
    pub quantity_e9: String,
    #[serde(rename = "side")]
    pub side: models::OrderSide,
    /// The leverage in base e9  of the order to be traded. Should always be a number
    #[serde(rename = "leverageE9")]
    pub leverage_e9: String,
    /// Is this order isolated or cross margin. Note market must be set to the same mode.
    #[serde(rename = "isIsolated")]
    pub is_isolated: bool,
    /// The random generated SALT. Should always be a number
    #[serde(rename = "salt")]
    pub salt: String,
    /// Unix timestamp in millis at which order will expire. Defaults to 1 month for LIMIT orders if not provided
    #[serde(rename = "expiresAtMillis")]
    pub expires_at_millis: i64,
    /// The timestamp in millis at which the request was signed
    #[serde(rename = "signedAtMillis")]
    pub signed_at_millis: i64,
    #[serde(rename = "type")]
    pub r#type: models::OrderType,
    /// Is this order to only reduce a position? Default false
    #[serde(rename = "reduceOnly")]
    pub reduce_only: bool,
    /// If set to TRUE, the order can only be a maker order
    #[serde(rename = "postOnly")]
    pub post_only: bool,
    #[serde(rename = "timeInForce")]
    pub time_in_force: models::OrderTimeInForce,
    /// Trigger price in base e9 for stop orders. This should always be a number
    #[serde(rename = "triggerPriceE9", skip_serializing_if = "Option::is_none")]
    pub trigger_price_e9: Option<String>,
    /// The quantity in base e9 of the asset currently filled. This should always be a number
    #[serde(rename = "filledQuantityE9")]
    pub filled_quantity_e9: String,
    #[serde(rename = "status")]
    pub status: models::OrderStatus,
    #[serde(rename = "selfTradePreventionType")]
    pub self_trade_prevention_type: models::SelfTradePreventionType,
    #[serde(rename = "twapConfig", skip_serializing_if = "Option::is_none")]
    pub twap_config: Option<models::OrderTwapConfig>,
    /// The timestamp in millis when the order was opened
    #[serde(rename = "orderTimeAtMillis")]
    pub order_time_at_millis: i64,
    /// The timestamp in millis that this order was last updated (including status updates)
    #[serde(rename = "updatedAtMillis")]
    pub updated_at_millis: i64,
}

impl OpenOrderResponse {
    pub fn new(order_hash: String, symbol: String, account_address: String, signer_address: String, price_e9: String, quantity_e9: String, side: models::OrderSide, leverage_e9: String, is_isolated: bool, salt: String, expires_at_millis: i64, signed_at_millis: i64, r#type: models::OrderType, reduce_only: bool, post_only: bool, time_in_force: models::OrderTimeInForce, filled_quantity_e9: String, status: models::OrderStatus, self_trade_prevention_type: models::SelfTradePreventionType, order_time_at_millis: i64, updated_at_millis: i64) -> OpenOrderResponse {
        OpenOrderResponse {
            order_hash,
            client_order_id: None,
            symbol,
            account_address,
            signer_address,
            price_e9,
            quantity_e9,
            side,
            leverage_e9,
            is_isolated,
            salt,
            expires_at_millis,
            signed_at_millis,
            r#type,
            reduce_only,
            post_only,
            time_in_force,
            trigger_price_e9: None,
            filled_quantity_e9,
            status,
            self_trade_prevention_type,
            twap_config: None,
            order_time_at_millis,
            updated_at_millis,
        }
    }
}