oanda_v20_openapi/models/order_book.rs
1/*
2 * OANDA v20 API
3 *
4 * The full OANDA v20 API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more.
5 *
6 * The version of the OpenAPI document: 0.2.1
7 * Contact: jmicoud02@gmail.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// OrderBook : The representation of an instrument's order book at a point in time
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OrderBook {
17 #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")]
18 pub instrument: Option<models::InstrumentName>,
19 /// 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).
20 #[serde(rename = "time", skip_serializing_if = "Option::is_none")]
21 pub time: Option<String>,
22 /// The price (midpoint) for the order book's instrument at the time of the order book snapshot
23 #[serde(rename = "price", skip_serializing_if = "Option::is_none")]
24 pub price: Option<f64>,
25 /// The price width for each bucket. Each bucket covers the price range from the bucket's price to the bucket's price + bucketWidth.
26 #[serde(rename = "bucketWidth", skip_serializing_if = "Option::is_none")]
27 pub bucket_width: Option<f64>,
28 /// 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.
29 #[serde(rename = "buckets", skip_serializing_if = "Option::is_none")]
30 pub buckets: Option<Vec<models::OrderBookBucket>>,
31}
32
33impl OrderBook {
34 /// The representation of an instrument's order book at a point in time
35 pub fn new() -> OrderBook {
36 OrderBook {
37 instrument: None,
38 time: None,
39 price: None,
40 bucket_width: None,
41 buckets: None,
42 }
43 }
44}
45