diff --git a/nautilus_core/core/src/datetime.rs b/nautilus_core/core/src/datetime.rs index c45a30400c5b..9ceb2e75d890 100644 --- a/nautilus_core/core/src/datetime.rs +++ b/nautilus_core/core/src/datetime.rs @@ -100,6 +100,7 @@ pub fn floor_to_nearest_microsecond(unix_nanos: u64) -> u64 { (unix_nanos / NANOSECONDS_IN_MICROSECOND) * NANOSECONDS_IN_MICROSECOND } +/// Calculates the last weekday (Mon-Fri) from the given `year`, `month` and `day`. pub fn last_weekday_nanos(year: i32, month: u32, day: u32) -> anyhow::Result { let date = NaiveDate::from_ymd_opt(year, month, day).ok_or_else(|| anyhow::anyhow!("Invalid date"))?; @@ -128,6 +129,7 @@ pub fn last_weekday_nanos(year: i32, month: u32, day: u32) -> anyhow::Result anyhow::Result { let timestamp_ns = timestamp_ns.as_u64(); let seconds = timestamp_ns / NANOSECONDS_IN_SECOND; diff --git a/nautilus_core/core/src/parsing.rs b/nautilus_core/core/src/parsing.rs index 8d739087eafd..46fe3e8094ac 100644 --- a/nautilus_core/core/src/parsing.rs +++ b/nautilus_core/core/src/parsing.rs @@ -29,7 +29,7 @@ pub fn precision_from_str(s: &str) -> u8 { return lower_s.split('.').last().unwrap().len() as u8; } -/// Returns a usize from the given bytes. +/// Returns a `usize` from the given bytes. pub fn bytes_to_usize(bytes: &[u8]) -> anyhow::Result { // Check bytes width if bytes.len() >= std::mem::size_of::() { diff --git a/nautilus_core/model/src/currencies.rs b/nautilus_core/model/src/currencies.rs index 2a75caab5fbe..19ddc0bae4fe 100644 --- a/nautilus_core/model/src/currencies.rs +++ b/nautilus_core/model/src/currencies.rs @@ -988,6 +988,7 @@ impl Currency { } } +/// Provides a map of built-in `Currency` constants. pub static CURRENCY_MAP: Lazy>> = Lazy::new(|| { let mut map = HashMap::new(); /////////////////////////////////////////////////////////////////////////// diff --git a/nautilus_core/model/src/data/bar.rs b/nautilus_core/model/src/data/bar.rs index e5be5fb8397a..42fea573f0c4 100644 --- a/nautilus_core/model/src/data/bar.rs +++ b/nautilus_core/model/src/data/bar.rs @@ -13,6 +13,8 @@ // limitations under the License. // ------------------------------------------------------------------------------------------------- +//! Bar aggregate structures, data types and functionality. + use std::{ collections::HashMap, fmt::{Debug, Display, Formatter}, diff --git a/nautilus_core/model/src/data/delta.rs b/nautilus_core/model/src/data/delta.rs index 74c49218ca67..a844949de8b7 100644 --- a/nautilus_core/model/src/data/delta.rs +++ b/nautilus_core/model/src/data/delta.rs @@ -13,6 +13,8 @@ // limitations under the License. // ------------------------------------------------------------------------------------------------- +//! An `OrderBookDelta` data type intended to carry book state information. + use std::{ collections::HashMap, fmt::{Display, Formatter}, diff --git a/nautilus_core/model/src/data/deltas.rs b/nautilus_core/model/src/data/deltas.rs index 8b13b64ed4a2..2d5778787885 100644 --- a/nautilus_core/model/src/data/deltas.rs +++ b/nautilus_core/model/src/data/deltas.rs @@ -13,6 +13,8 @@ // limitations under the License. // ------------------------------------------------------------------------------------------------- +//! An `OrderBookDeltas` container type to carry a bulk of `OrderBookDelta` records. + use std::{ fmt::{Display, Formatter}, hash::{Hash, Hasher}, diff --git a/nautilus_core/model/src/data/depth.rs b/nautilus_core/model/src/data/depth.rs index af16a94810a5..087fe8d0f2b6 100644 --- a/nautilus_core/model/src/data/depth.rs +++ b/nautilus_core/model/src/data/depth.rs @@ -13,6 +13,8 @@ // limitations under the License. // ------------------------------------------------------------------------------------------------- +//! An `OrderBookDepth10` aggregated top-of-book data type with a fixed depth of 10 levels per side. + use std::{ collections::HashMap, fmt::{Display, Formatter}, @@ -27,9 +29,9 @@ use crate::identifiers::instrument_id::InstrumentId; pub const DEPTH10_LEN: usize = 10; -/// Represents a self-contained order book update with a fixed depth of 10 levels per side. +/// Represents a aggregated order book update with a fixed depth of 10 levels per side. /// -/// This struct is specifically designed for scenarios where a snapshot of the top 10 bid and +/// This structure is specifically designed for scenarios where a snapshot of the top 10 bid and /// ask levels in an order book is needed. It differs from `OrderBookDelta` or `OrderBookDeltas` /// in its fixed-depth nature and is optimized for cases where a full depth representation is not /// required or practical. diff --git a/nautilus_core/model/src/data/order.rs b/nautilus_core/model/src/data/order.rs index c25fcd83f9df..37d426840319 100644 --- a/nautilus_core/model/src/data/order.rs +++ b/nautilus_core/model/src/data/order.rs @@ -13,6 +13,8 @@ // limitations under the License. // ------------------------------------------------------------------------------------------------- +//! A `BookOrder` for use with the `OrderBookDelta` data type. + use std::{ fmt::{Display, Formatter}, hash::{Hash, Hasher}, diff --git a/nautilus_core/model/src/data/quote.rs b/nautilus_core/model/src/data/quote.rs index 0d82d2bbdbd8..909d42bc6a36 100644 --- a/nautilus_core/model/src/data/quote.rs +++ b/nautilus_core/model/src/data/quote.rs @@ -13,6 +13,8 @@ // limitations under the License. // ------------------------------------------------------------------------------------------------- +//! A `QuoteTick` data type representing a top-of-book quote state. + use std::{ cmp, collections::HashMap, diff --git a/nautilus_core/model/src/data/trade.rs b/nautilus_core/model/src/data/trade.rs index 4c7c13bc9160..98db02bc08c7 100644 --- a/nautilus_core/model/src/data/trade.rs +++ b/nautilus_core/model/src/data/trade.rs @@ -13,6 +13,8 @@ // limitations under the License. // ------------------------------------------------------------------------------------------------- +//! A `TradeTick` data type representing a single trade in a market. + use std::{ collections::HashMap, fmt::{Display, Formatter}, diff --git a/nautilus_trader/core/includes/model.h b/nautilus_trader/core/includes/model.h index bf73015a0fdf..85ee4062b12a 100644 --- a/nautilus_trader/core/includes/model.h +++ b/nautilus_trader/core/includes/model.h @@ -838,9 +838,9 @@ typedef struct OrderBookDeltas_API { } OrderBookDeltas_API; /** - * Represents a self-contained order book update with a fixed depth of 10 levels per side. + * Represents a aggregated order book update with a fixed depth of 10 levels per side. * - * This struct is specifically designed for scenarios where a snapshot of the top 10 bid and + * This structure is specifically designed for scenarios where a snapshot of the top 10 bid and * ask levels in an order book is needed. It differs from `OrderBookDelta` or `OrderBookDeltas` * in its fixed-depth nature and is optimized for cases where a full depth representation is not * required or practical. diff --git a/nautilus_trader/core/rust/model.pxd b/nautilus_trader/core/rust/model.pxd index 4dd425b87c7a..0a3f2e6218f2 100644 --- a/nautilus_trader/core/rust/model.pxd +++ b/nautilus_trader/core/rust/model.pxd @@ -462,9 +462,9 @@ cdef extern from "../includes/model.h": cdef struct OrderBookDeltas_API: OrderBookDeltas_t *_0; - # Represents a self-contained order book update with a fixed depth of 10 levels per side. + # Represents a aggregated order book update with a fixed depth of 10 levels per side. # - # This struct is specifically designed for scenarios where a snapshot of the top 10 bid and + # This structure is specifically designed for scenarios where a snapshot of the top 10 bid and # ask levels in an order book is needed. It differs from `OrderBookDelta` or `OrderBookDeltas` # in its fixed-depth nature and is optimized for cases where a full depth representation is not # required or practical.