## Flowchart: Order Expiry and Mode Check Process
### Overview
This flowchart illustrates a multi-step process for checking order expiry and mode changes over time, with specific conditions triggering state transitions. It includes two primary ticks (time intervals) and highlights critical violations of a rule labeled "MIT201" when conflicting events occur simultaneously.
---
### Components/Axes
1. **Header Section**:
- **Time**: Vertical axis labeled with timestamps (e.g., `t = 2699`, `t = 2700`, `t = 2701`).
- **GTT Expiry Check**: Boxes for expiry validation.
- **Mode/Uncross Check**: Boxes for mode validation and uncross detection.
- **State**: Final outcomes (e.g., "Order NOT expired," "ORDER EXPIRES," "UNCROSS").
2. **Main Flow**:
- **Initial State**: `t = 2699`, Auction Mode, `uncross.at = 2700`, `order.expires.at = 2700`, `market_extension = 1`.
- **Tick 1**: Transition from `t = 2699 → 2700`.
- **Tick 2**: Transition from `t = 2700 → 2701`.
3. **Decision Nodes**:
- **Check expiry**: Validates if `t >= order.expires.at`.
- **In auction mode?**: Conditional check for mode.
- **Extend to max(2700, 2700+1) = 2701**: Adjusts expiry time.
- **Market orders present?**: Checks for market orders at `t + 1`.
4. **Outcomes**:
- **Order NOT expired**: Path when expiry conditions fail.
- **ORDER EXPIRES**: Path when expiry conditions pass.
- **UNCROSS**: Path when uncross conditions pass.
- **MIT201 violated**: Highlighted box indicating simultaneous expiry and uncross events.
---
### Detailed Analysis
1. **Initial State**:
- `t = 2699`: Auction Mode active.
- `uncross.at = 2700`: Uncross event scheduled at `t = 2700`.
- `order.expires.at = 2700`: Order expiry scheduled at `t = 2700`.
- `market_extension = 1`: Market orders allowed until `t + 1`.
2. **Tick 1 (`t = 2699 → 2700`)**:
- **Check expiry**: `2700 >= 2700` (YES).
- **In auction mode?**: YES → Extend expiry to `max(2700, 2701) = 2701`.
- **Market orders present?**: `2700 >= 2700 + 1` (NO) → Stay in auction.
- **After Tick 1**: `t = 2700`, Still in auction.
3. **Tick 2 (`t = 2700 → 2701`)**:
- **Check expiry**: `2701 >= 2701` (YES) → ORDER EXPIRES.
- **Check mode change**: `2701 >= 2700` (YES).
- **Market orders present?**: `2701 >= 2700 + 1` (YES) → UNCROSS.
- **Both events occur in the same tick**: MIT201 violated (highlighted in pink).
---
### Key Observations
1. **MIT201 Violation**: Occurs when both expiry and uncross events are triggered in the same tick (`t = 2701`), indicating a conflict in state transitions.
2. **Expiry Logic**: Orders expire at `t = 2701` after extension, but market orders at `t + 1` trigger uncross checks.
3. **Mode Persistence**: The system remains in auction mode until conflicting events occur.
---
### Interpretation
This flowchart models a time-sensitive order management system where:
- **Expiry and uncross events** are interdependent, with expiry checks extending deadlines under certain conditions.
- The **MIT201 violation** highlights a critical edge case where simultaneous events (`ORDER EXPIRES` and `UNCROSS`) at `t = 2701` create ambiguity, requiring resolution to avoid state inconsistency.
- The process emphasizes **temporal sequencing** (e.g., `market_extension = 1` delaying market order checks until `t + 1`), ensuring orderly state transitions.
The diagram underscores the importance of precise timing and conditional logic in systems managing auction modes and order lifecycles.