bluefin_api 1.8.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 CreateOrderRequest {
    #[serde(rename = "signedFields")]
    pub signed_fields: models::CreateOrderRequestSignedFields,
    /// The signature of the request, encoded from the signedFields
    #[serde(rename = "signature")]
    pub signature: String,
    /// The client-defined unique identifier of this order used for lookup. This should always be unique; however, the server will not gurantee this or impose any checks.
    #[serde(rename = "clientOrderId", skip_serializing_if = "Option::is_none")]
    pub client_order_id: Option<String>,
    #[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", skip_serializing_if = "Option::is_none")]
    pub post_only: Option<bool>,
    /// Omit or set to null for market orders; otherwise, choose a valid time-in-force value. GTT: Good Til Time  IOC: Immediate Or Cancel  FOK: Fill Or Kill 
    #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")]
    pub time_in_force: Option<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>,
    #[serde(rename = "selfTradePreventionType", skip_serializing_if = "Option::is_none")]
    pub self_trade_prevention_type: Option<models::SelfTradePreventionType>,
    #[serde(rename = "twapConfig", skip_serializing_if = "Option::is_none")]
    pub twap_config: Option<models::OrderTwapConfig>,
}

impl CreateOrderRequest {
    pub fn new(signed_fields: models::CreateOrderRequestSignedFields, signature: String, r#type: models::OrderType, reduce_only: bool) -> CreateOrderRequest {
        CreateOrderRequest {
            signed_fields,
            signature,
            client_order_id: None,
            r#type,
            reduce_only,
            post_only: None,
            time_in_force: None,
            trigger_price_e9: None,
            self_trade_prevention_type: None,
            twap_config: None,
        }
    }
}