ethereal_rust_sdk 0.1.6

Trading client for Ethereal exchange
Documentation
/*
 * Ethereal Exchange API
 *
 * Ethereal HTTP API for real-time trading, order management, and market data access.
 *
 * The version of the OpenAPI document: 0.1.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

/// BookDepthMessage : Server-to-client BookDepth event message. First message is the full book (up to 100 levels per side). Subsequent messages are price-level diffs with absolute quantities. A zero quantity removes that level.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BookDepthMessage {
    /// System timestamp in milliseconds when this BookDepth was emitted.
    #[serde(rename = "timestamp")]
    pub timestamp: i64,
    /// Timestamp in ms of the previous BookDepth event for this product.
    #[serde(rename = "previousTimestamp")]
    pub previous_timestamp: i64,
    /// Identifier of the product.
    #[serde(rename = "productId")]
    pub product_id: uuid::Uuid,
    /// Array of ask levels as [price, quantity] string tuples.
    #[serde(rename = "asks")]
    pub asks: Vec<Vec<String>>,
    /// Array of bid levels as [price, quantity] string tuples.
    #[serde(rename = "bids")]
    pub bids: Vec<Vec<String>>,
}

impl BookDepthMessage {
    /// Server-to-client BookDepth event message. First message is the full book (up to 100 levels per side). Subsequent messages are price-level diffs with absolute quantities. A zero quantity removes that level.
    pub fn new(
        timestamp: i64,
        previous_timestamp: i64,
        product_id: uuid::Uuid,
        asks: Vec<Vec<String>>,
        bids: Vec<Vec<String>>,
    ) -> BookDepthMessage {
        BookDepthMessage {
            timestamp,
            previous_timestamp,
            product_id,
            asks,
            bids,
        }
    }
}