stock-bot/apps/stock/engine/src/financial/mod.rs

55 lines
1.6 KiB
Rust

//! Authoritative financial core shared by canonical research and paper execution.
//!
//! Follow one historical decision through these modules:
//! - [`replay`] publishes available bars and pauses at a strategy decision barrier.
//! - [`matching`] turns the submitted intent into orders and selects eligible fills.
//! - [`risk`] reserves cash/inventory and checks constraints again before a fill.
//! - [`ledger`] posts the accepted fill and fee to owned positions and shared cash.
//!
//! [`scalar`] supplies checked decimal arithmetic; [`contract`] defines commands
//! and effects. [`result`] and [`reporting`] read committed facts for output.
//! The native adapters in `api/replay.rs` and `api/paper.rs` expose this core to
//! TypeScript. Strategies, SQL custody and worker supervision stay outside it.
//! Historical replay supplies bar-open events; paper supplies quote events to
//! the same matcher/risk/ledger rather than a second accounting implementation.
pub mod contract;
pub mod ledger;
pub mod matching;
pub mod replay;
pub mod reporting;
pub mod result;
pub mod risk;
pub mod scalar;
#[cfg(test)]
mod tests;
#[cfg(test)]
mod ledger_tests;
#[cfg(test)]
mod risk_tests;
#[cfg(test)]
mod matching_tests;
#[cfg(test)]
mod replay_tests;
#[cfg(test)]
mod result_tests;
#[cfg(test)]
mod reporting_tests;
// Exercise the pure host adapters and shared helpers without linking every legacy NAPI export.
#[cfg(test)]
#[path = "../api/canonical.rs"]
mod canonical;
#[cfg(test)]
#[path = "../api/replay.rs"]
mod native_replay_tests;
#[cfg(test)]
#[path = "../api/paper.rs"]
mod native_paper_tests;