1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Market Making Library
//!
//! A Rust library implementing quantitative market making strategies, starting with the
//! Avellaneda-Stoikov model. This library provides the mathematical foundations and domain models
//! necessary for building automated market making systems for financial markets.
//!
//! # Overview
//!
//! Market making is the practice of simultaneously providing buy (bid) and sell (ask) quotes
//! in a financial market. The market maker profits from the bid-ask spread while providing
//! liquidity to the market.
//!
//! ## Key Challenges
//!
//! - **Inventory Risk**: Holding positions exposes the market maker to price movements
//! - **Adverse Selection**: Informed traders may trade against you when they have better information
//! - **Optimal Pricing**: Balance between execution probability and profitability
//!
//! # The Avellaneda-Stoikov Model
//!
//! The Avellaneda-Stoikov model (2008) solves the optimal market making problem using
//! stochastic control theory. It determines optimal bid and ask prices given:
//!
//! - Current market price and volatility
//! - Current inventory position
//! - Risk aversion
//! - Time remaining in trading session
//! - Order arrival dynamics
//!
//! # Modules
//!
//! - [`strategy`]: Pure mathematical calculations for quote generation
//! - [`position`]: Inventory tracking and PnL management
//! - [`market_state`]: Market data representation
//! - [`types`]: Common types and error definitions
//! - [`prelude`]: Convenient re-exports of commonly used types
//!
//! # Quick Start
//!
//! Import commonly used types with the prelude:
//!
//! ```rust
//! use market_maker_rs::prelude::*;
//! ```
//!
//! # Examples
//!
//! Examples will be added once core functionality is implemented.
// Re-export Decimal for use throughout the library
pub use Decimal;
pub use dec;
/// Market state module containing market data representations.
/// Position tracking module for inventory and PnL management.
/// Strategy module containing pure mathematical calculations for market making.
///
/// This module implements the Avellaneda-Stoikov model calculations:
/// - Reservation price computation
/// - Optimal spread calculation
/// - Bid/ask quote generation
/// Common types and errors.
/// Prelude module for convenient imports.