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
// -------------------------------------------------------------------------------------------------
// Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.
// https://nautechsystems.io
//
// Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -------------------------------------------------------------------------------------------------
//! Execution state reconciliation.
//!
//! Pure functions for bringing the engine's local order, fill, and position state
//! into line with what the venue reports. Called at startup (mass status) and
//! continuously at runtime (open-order and position checks).
//!
//! Public entry points:
//! - [`process_mass_status_for_reconciliation`] - partial-window fill reconstruction
//! - [`generate_reconciliation_order_events`] - venue-temporal event sequence for a report
//! - [`reconcile_order_report`] - core order-state reconciliation
//! - [`reconcile_fill_report`] - apply a venue fill to a cached order, with dedup
//! - [`generate_external_order_status_events`] - synthesize events for an external order
//! - [`check_position_reconciliation`] - final qty and avg-px tolerance check
//!
//! Invariants maintained across all paths:
//! 1. Final position quantity matches the venue within instrument precision.
//! 2. Position average price matches within tolerance (default 0.01%).
//! 3. All generated fills preserve correct unrealized PnL.
//! 4. Synthetic `trade_id` and `venue_order_id` values are deterministic
//! functions of the logical event, so restart replays dedupe.
//!
//! See `docs/concepts/live.md` for the operator-facing description.
pub use ;
pub use ;
pub use ;
pub use ReconciliationResult;