Skip to content

Commit

Permalink
Add additional Rust docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Apr 20, 2024
1 parent b8ce7ad commit 8dd3c5f
Show file tree
Hide file tree
Showing 42 changed files with 227 additions and 1 deletion.
13 changes: 13 additions & 0 deletions nautilus_core/accounting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
//! algorithmic trading platform, providing quantitative traders with the ability to backtest
//! portfolios of automated trading strategies on historical data with an event-driven engine,
//! and also deploy those same strategies live, with no code changes.
//!
//! # Feature flags
//!
//! This crate provides feature flags to control source code inclusion during compilation,
//! depending on the intended use case, i.e. whether to provide Python bindings
//! for the main `nautilus_trader` Python package, or as part of a Rust only build.
//!
//! - `python`: Enables Python bindings from `pyo3`
pub mod account;
#[cfg(test)]
pub mod stubs;
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/accounting/src/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides Python bindings from `pyo3`.
#![allow(warnings)] // non-local `impl` definition, temporary allow until pyo3 upgrade

use pyo3::{prelude::*, pymodule};
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/adapters/src/databento/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides Python bindings from `pyo3`.
#![allow(warnings)] // non-local `impl` definition, temporary allow until pyo3 upgrade

pub mod enums;
Expand Down
15 changes: 15 additions & 0 deletions nautilus_core/adapters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,20 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
//! algorithmic trading platform, providing quantitative traders with the ability to backtest
//! portfolios of automated trading strategies on historical data with an event-driven engine,
//! and also deploy those same strategies live, with no code changes.
//!
//! # Feature flags
//!
//! This crate provides feature flags to control source code inclusion during compilation,
//! depending on the intended use case, i.e. whether to provide Python bindings
//! for the main `nautilus_trader` Python package, or as part of a Rust only build.
//!
//! - `databento`: Includes the Databento integration adapter
//! - `ffi`: Enables the C foreign function interface (FFI) from `cbindgen`
//! - `python`: Enables Python bindings from `pyo3`
#[cfg(feature = "databento")]
pub mod databento;
14 changes: 14 additions & 0 deletions nautilus_core/backtest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,19 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
//! algorithmic trading platform, providing quantitative traders with the ability to backtest
//! portfolios of automated trading strategies on historical data with an event-driven engine,
//! and also deploy those same strategies live, with no code changes.
//!
//! # Feature flags
//!
//! This crate provides feature flags to control source code inclusion during compilation,
//! depending on the intended use case, i.e. whether to provide Python bindings
//! for the main `nautilus_trader` Python package, or as part of a Rust only build.
//!
//! - `ffi`: Enables the C foreign function interface (FFI) from `cbindgen`
//! - `python`: Enables Python bindings from `pyo3`
pub mod engine;
pub mod matching_engine;
2 changes: 2 additions & 0 deletions nautilus_core/common/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides a C foreign function interface (FFI) from `cbindgen`.
pub mod clock;
pub mod enums;
pub mod logging;
Expand Down
15 changes: 15 additions & 0 deletions nautilus_core/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
//! algorithmic trading platform, providing quantitative traders with the ability to backtest
//! portfolios of automated trading strategies on historical data with an event-driven engine,
//! and also deploy those same strategies live, with no code changes.
//!
//! # Feature flags
//!
//! This crate provides feature flags to control source code inclusion during compilation,
//! depending on the intended use case, i.e. whether to provide Python bindings
//! for the main `nautilus_trader` Python package, or as part of a Rust only build.
//!
//! - `ffi`: Enables the C foreign function interface (FFI) from `cbindgen`
//! - `python`: Enables Python bindings from `pyo3`
//! - `stubs`: Enables type stubs for use in testing scenarios
pub mod cache;
pub mod clock;
pub mod enums;
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/common/src/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides Python bindings from `pyo3`.
#![allow(warnings)] // non-local `impl` definition, temporary allow until pyo3 upgrade

pub mod clock;
Expand Down
2 changes: 1 addition & 1 deletion nautilus_core/core/src/correctness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines static condition checks similar to the *design by contract* philosophy
//! Provides static condition checks similar to the *design by contract* philosophy
//! to help ensure logical correctness.
//!
//! This module provides validation checking of function or method conditions.
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/core/src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides common data and time functions.
use std::time::{Duration, UNIX_EPOCH};

use chrono::{
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/core/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides a C foreign function interface (FFI) from `cbindgen`.
pub mod cvec;
pub mod datetime;
pub mod parsing;
Expand Down
14 changes: 14 additions & 0 deletions nautilus_core/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
//! algorithmic trading platform, providing quantitative traders with the ability to backtest
//! portfolios of automated trading strategies on historical data with an event-driven engine,
//! and also deploy those same strategies live, with no code changes.
//!
//! # Feature flags
//!
//! This crate provides feature flags to control source code inclusion during compilation,
//! depending on the intended use case, i.e. whether to provide Python bindings
//! for the main `nautilus_trader` Python package, or as part of a Rust only build.
//!
//! - `ffi`: Enables the C foreign function interface (FFI) from `cbindgen`
//! - `python`: Enables Python bindings from `pyo3`
pub mod correctness;
pub mod datetime;
pub mod message;
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/core/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines common message types.
use crate::{nanos::UnixNanos, uuid::UUID4};

#[derive(Debug, Clone)]
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/core/src/nanos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines `UnixNanos` type for working with UNIX epoch (nanoseconds).
use std::{
cmp::Ordering,
fmt::Display,
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/core/src/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides core parsing functions.
/// Returns the decimal precision inferred from the given string.
#[must_use]
pub fn precision_from_str(s: &str) -> u8 {
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/core/src/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides Python bindings from `pyo3`.
#![allow(warnings)] // non-local `impl` definition, temporary allow until pyo3 upgrade

use std::fmt;
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/core/src/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines common serialization traits.
use serde::{Deserialize, Serialize};

/// Represents types which are serializable for JSON and `MsgPack` specifications.
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/core/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides the core `AtomicTime` real-time and static clocks.
use std::{
ops::Deref,
sync::{
Expand Down
3 changes: 3 additions & 0 deletions nautilus_core/core/src/uuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines a core `UUID4` universally unique identifier (UUID) version 4 based on a 128-bit
//! label as specified in RFC 4122.
use std::{
ffi::{CStr, CString},
fmt::{Debug, Display, Formatter},
Expand Down
14 changes: 14 additions & 0 deletions nautilus_core/execution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
//! algorithmic trading platform, providing quantitative traders with the ability to backtest
//! portfolios of automated trading strategies on historical data with an event-driven engine,
//! and also deploy those same strategies live, with no code changes.
//!
//! # Feature flags
//!
//! This crate provides feature flags to control source code inclusion during compilation,
//! depending on the intended use case, i.e. whether to provide Python bindings
//! for the main `nautilus_trader` Python package, or as part of a Rust only build.
//!
//! - `ffi`: Enables the C foreign function interface (FFI) from `cbindgen`
//! - `python`: Enables Python bindings from `pyo3`
pub mod client;
pub mod engine;
pub mod matching_core;
Expand Down
13 changes: 13 additions & 0 deletions nautilus_core/indicators/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
//! algorithmic trading platform, providing quantitative traders with the ability to backtest
//! portfolios of automated trading strategies on historical data with an event-driven engine,
//! and also deploy those same strategies live, with no code changes.
//!
//! # Feature flags
//!
//! This crate provides feature flags to control source code inclusion during compilation,
//! depending on the intended use case, i.e. whether to provide Python bindings
//! for the main `nautilus_trader` Python package, or as part of a Rust only build.
//!
//! - `python`: Enables Python bindings from `pyo3`
pub mod average;
pub mod book;
pub mod indicator;
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/indicators/src/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides Python bindings from `pyo3`.
#![allow(warnings)] // non-local `impl` definition, temporary allow until pyo3 upgrade

use pyo3::{prelude::*, pymodule};
Expand Down
14 changes: 14 additions & 0 deletions nautilus_core/infrastructure/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
//! algorithmic trading platform, providing quantitative traders with the ability to backtest
//! portfolios of automated trading strategies on historical data with an event-driven engine,
//! and also deploy those same strategies live, with no code changes.
//!
//! # Feature flags
//!
//! This crate provides feature flags to control source code inclusion during compilation,
//! depending on the intended use case, i.e. whether to provide Python bindings
//! for the main `nautilus_trader` Python package, or as part of a Rust only build.
//!
//! - `python`: Enables Python bindings from `pyo3`
//! - `redis`: Enables the Redis cache database and message bus backing implementations
#[cfg(feature = "python")]
pub mod python;

Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/infrastructure/src/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides Python bindings from `pyo3`.
#![allow(warnings)] // non-local `impl` definition, temporary allow until pyo3 upgrade

use pyo3::{prelude::*, pymodule};
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/infrastructure/src/python/redis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides a Redis cache database and message bus backing.
pub mod cache;
pub mod msgbus;
2 changes: 2 additions & 0 deletions nautilus_core/model/src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Provides a C foreign function interface (FFI) from `cbindgen`.
pub mod data;
pub mod enums;
pub mod events;
Expand Down
15 changes: 15 additions & 0 deletions nautilus_core/model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! [NautilusTrader](http://nautilustrader.io) is an open-source, high-performance, production-grade
//! algorithmic trading platform, providing quantitative traders with the ability to backtest
//! portfolios of automated trading strategies on historical data with an event-driven engine,
//! and also deploy those same strategies live, with no code changes.
//!
//! # Feature flags
//!
//! This crate provides feature flags to control source code inclusion during compilation,
//! depending on the intended use case, i.e. whether to provide Python bindings
//! for the main `nautilus_trader` Python package, or as part of a Rust only build.
//!
//! - `ffi`: Enables the C foreign function interface (FFI) from `cbindgen`
//! - `python`: Enables Python bindings from `pyo3`
//! - `stubs`: Enables type stubs for use in testing scenarios
pub mod currencies;
pub mod data;
pub mod enums;
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/model/src/python/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines data types for the trading domain model.
pub mod bar;
pub mod delta;
pub mod deltas;
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/model/src/python/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines enumerations for the trading domain model.
use std::str::FromStr;

use nautilus_core::python::to_pyvalue_err;
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/model/src/python/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines events for the trading domain model.
pub mod account;
pub mod order;
2 changes: 2 additions & 0 deletions nautilus_core/model/src/python/identifiers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines identifiers the trading domain model.
use std::str::FromStr;

use nautilus_core::python::to_pyvalue_err;
Expand Down
2 changes: 2 additions & 0 deletions nautilus_core/model/src/python/instruments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// -------------------------------------------------------------------------------------------------

//! Defines instrument definitions the trading domain model.
use nautilus_core::python::to_pyvalue_err;
use pyo3::{IntoPy, PyObject, PyResult, Python};

Expand Down
Loading

0 comments on commit 8dd3c5f

Please sign in to comment.