derive-rs 0.1.16

Rust SDK for Derive.xyz
/*
 * REST API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * Generated by: https://openapi-generator.tech
 */

#![allow(clippy::too_many_arguments)]
use serde::{Deserialize, Serialize};

use crate::models::{DailyTradingStatistics, OptionPricing};

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TickerSlimSchema {
    /// Amount of contracts / tokens available at best ask price
    #[serde(rename = "A")]
    pub a_amt: bigdecimal::BigDecimal,
    /// Amount of contracts / tokens available at best bid price
    #[serde(rename = "B")]
    pub b_amt: bigdecimal::BigDecimal,
    /// Index price
    #[serde(rename = "I")]
    pub i: bigdecimal::BigDecimal,
    /// Mark price
    #[serde(rename = "M")]
    pub m: bigdecimal::BigDecimal,
    /// Best ask price
    #[serde(rename = "a")]
    pub a: bigdecimal::BigDecimal,
    /// Best bid price
    #[serde(rename = "b")]
    pub b: bigdecimal::BigDecimal,
    /// Current hourly funding rate
    #[serde(rename = "f", deserialize_with = "Option::deserialize")]
    pub f: Option<bigdecimal::BigDecimal>,
    /// Maximum price at which an agressive buyer can be matched. Any portion of a market order that would execute above this price will be cancelled. A limit buy order with limit price above this value is treated as post only (i.e. it will be rejected if it would cross any existing resting order).
    #[serde(rename = "maxp")]
    pub maxp: bigdecimal::BigDecimal,
    /// Minimum price at which an agressive seller can be matched. Any portion of a market order that would execute below this price will be cancelled. A limit sell order with limit price below this value is treated as post only (i.e. it will be rejected if it would cross any existing resting order).
    #[serde(rename = "minp")]
    pub minp: bigdecimal::BigDecimal,
    #[serde(rename = "option_pricing")]
    pub option_pricing: Option<OptionPricing>,
    #[serde(rename = "stats")]
    pub stats: DailyTradingStatistics,
    /// Creation timestamp of the snapshot in milliseconds
    #[serde(rename = "t")]
    pub t: i64,
}

impl TickerSlimSchema {
    pub fn new(
        a_amt: bigdecimal::BigDecimal,
        b_amt: bigdecimal::BigDecimal,
        i: bigdecimal::BigDecimal,
        m: bigdecimal::BigDecimal,
        a: bigdecimal::BigDecimal,
        b: bigdecimal::BigDecimal,
        f: Option<bigdecimal::BigDecimal>,
        maxp: bigdecimal::BigDecimal,
        minp: bigdecimal::BigDecimal,
        option_pricing: Option<OptionPricing>,
        stats: DailyTradingStatistics,
        t: i64,
    ) -> TickerSlimSchema {
        TickerSlimSchema {
            a_amt,
            b_amt,
            i,
            m,
            a,
            b,
            f,
            maxp,
            minp,
            option_pricing,
            stats,
            t,
        }
    }
}