oanda-v20-openapi 0.2.1

The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
Documentation
/*
 * OANDA v20 API
 *
 * The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
 *
 * The version of the OpenAPI document: 0.2.1
 * Contact: jmicoud02@gmail.com
 * Generated by: https://openapi-generator.tech
 */

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

/// OrderBook : The representation of an instrument's order book at a point in time
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OrderBook {
    #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")]
    pub instrument: Option<models::InstrumentName>,
    /// A date and time value using either RFC3339 or UNIX time representation. The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).
    #[serde(rename = "time", skip_serializing_if = "Option::is_none")]
    pub time: Option<String>,
    /// The price (midpoint) for the order book's instrument at the time of the order book snapshot
    #[serde(rename = "price", skip_serializing_if = "Option::is_none")]
    pub price: Option<f64>,
    /// The price width for each bucket. Each bucket covers the price range from the bucket's price to the bucket's price + bucketWidth.
    #[serde(rename = "bucketWidth", skip_serializing_if = "Option::is_none")]
    pub bucket_width: Option<f64>,
    /// The partitioned order book, divided into buckets using a default bucket width. These buckets are only provided for price ranges which actually contain order or position data.
    #[serde(rename = "buckets", skip_serializing_if = "Option::is_none")]
    pub buckets: Option<Vec<models::OrderBookBucket>>,
}

impl OrderBook {
    /// The representation of an instrument's order book at a point in time
    pub fn new() -> OrderBook {
        OrderBook {
            instrument: None,
            time: None,
            price: None,
            bucket_width: None,
            buckets: None,
        }
    }
}