binance-sdk 69.2.0

This is a lightweight library that works as a connector to the Binance public API.
Documentation
/*
 * Stocks Trading WebSocket Streams
 *
 * WebSocket stream definitions for Binance Stocks Trading. Base URL: wss://nbstream.binance.com/equity
 *
 * The version of the OpenAPI document: 1.0.0
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

#![allow(unused_imports)]
use crate::stocks::websocket_streams::models;
use serde::{Deserialize, Deserializer, Serialize, de::Error};
use serde_json::Value;

/// `KlineStreamResponseK` : Candlestick payload.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct KlineStreamResponseK {
    /// Open time (epoch milliseconds).
    #[serde(rename = "t", skip_serializing_if = "Option::is_none")]
    pub t: Option<i64>,
    /// Close time (epoch milliseconds). For fixed intervals: `openTime + duration − 1ms`. For `1M`: last day of month at 23:59:59.999 UTC.
    #[serde(rename = "ct", skip_serializing_if = "Option::is_none")]
    pub ct: Option<i64>,
    /// Symbol (UPPERCASE ticker).
    #[serde(rename = "s", skip_serializing_if = "Option::is_none")]
    pub s: Option<String>,
    /// Interval — `\"5m\"` / `\"1h\"` / `\"1d\"` / `\"1w\"` / `\"1M\"`.
    #[serde(rename = "i", skip_serializing_if = "Option::is_none")]
    pub i: Option<String>,
    /// Open price.
    #[serde(rename = "o", skip_serializing_if = "Option::is_none")]
    pub o: Option<String>,
    /// Close price (latest print within the interval).
    #[serde(rename = "c", skip_serializing_if = "Option::is_none")]
    pub c: Option<String>,
    /// High price.
    #[serde(rename = "h", skip_serializing_if = "Option::is_none")]
    pub h: Option<String>,
    /// Low price.
    #[serde(rename = "l", skip_serializing_if = "Option::is_none")]
    pub l: Option<String>,
    /// Volume (shares), default `\"0\"`.
    #[serde(rename = "v", skip_serializing_if = "Option::is_none")]
    pub v: Option<String>,
    /// Trade count; absent when upstream did not populate.
    #[serde(
        rename = "n",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub n: Option<Option<i32>>,
    /// Candle is closed — `true` once the interval has ended.
    #[serde(rename = "x", skip_serializing_if = "Option::is_none")]
    pub x: Option<bool>,
    /// VWAP (volume-weighted average price); absent when upstream did not populate.
    #[serde(
        rename = "vw",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub vw: Option<Option<String>>,
}

impl KlineStreamResponseK {
    /// Candlestick payload.
    #[must_use]
    pub fn new() -> KlineStreamResponseK {
        KlineStreamResponseK {
            t: None,
            ct: None,
            s: None,
            i: None,
            o: None,
            c: None,
            h: None,
            l: None,
            v: None,
            n: None,
            x: None,
            vw: None,
        }
    }
}