republic8's picture
update README
ce8e1e1
---
title: Limit Order Matching Microstructure
emoji: πŸ“ˆ
colorFrom: pink
colorTo: indigo
sdk: static
pinned: false
---
# Limit-Order-Matching-Microstructure
Paper: https://arxiv.org/abs/2511.20606
Code: https://github.com/Republic1024/Limit-Order-Matching-Microstructure
### Unifying Matching Markets and Limit Order Books through Microstructure Dynamics
### Code Release for: *Limit Order Book Dynamics in Matching Markets: Microstructure, Spread, and Execution Slippage*
![simulation_results.png](simulation_results.png)
---
## πŸ“Œ Overview
This repository contains the full simulation code, experiments, and visualization pipeline for the paper:
**β€œLimit Order Book Dynamics in Matching Markets: Microstructure, Spread, and Execution Slippage”**
arXiv: https://arxiv.org/abs/2511.20606
The project proposes a unified framework where **matching markets** (e.g., marriage, partner choice, labor matching) are modeled as **limit order books**, with:
- **Intrinsic value** β†’ `ask`
- **Reachability constraint** β†’ `bid-depth / liquidity drought`
- **Ξ”V gap** β†’ structural **spread**
- **Compensation C** β†’ imperfect price improvement
- **Slippage (regret)** β†’ execution shortfall
- **Settling** β†’ threshold-decay crossing event
The framework shows that **linear compensation cannot close structural preference gaps**, unless it triggers a **categorical identity shift** (`Identity Collapse Threshold`).
---
## πŸ” Core Concepts
### **1. Unconditional vs. Reachable Maximum**
- `V_uncond_max`: Best perceived partner that exists in the population.
- `V_reach_max`: Best partner currently reachable under social liquidity constraints.
- `Ξ”V = V_uncond_max - V_reach_max`:
β†’ The **structural preference gap**, analogous to a *bid-ask spread*.
### **2. Theorem 1 β€” Compensation Clipping & Identity Collapse**
If compensation utility is:
```
h(C) = min(Ξ΅C, C_max)
```
Then:
- If `Ξ΅C < C_max` β†’ **Compensation is ineffective**: Ξ”V persists
- If `Ξ΅C β‰₯ C_max` β†’ **Identity Collapse**: category shift occurs
This mirrors slippage-bounded execution in microstructure.
### **3. Threshold Dynamics (Settling)**
Commitment occurs when:
```
ΞΈ = U_effective / V_uncond_max β‰₯ T(t)
```
Where `T(t)` is a decaying liquidity threshold (similar to urgency-driven execution).
---
## πŸ“ Repository Structure
```
Limit-Order-Matching-Microstructure/
β”‚
β”œβ”€β”€ exp1-5.py # Main experiments (Sections 4.2–4.6)
β”œβ”€β”€ exp1-5-Chinese.py # Chinese commented version
β”œβ”€β”€ simulation_results.png # Fig 5 replication
β”œβ”€β”€ simulation_results2.png # Slippage + Clipping + Settling plots
β”œβ”€β”€ data/ # (Empty / Ignored) placeholder for datasets
β”œβ”€β”€ img1.jpg # Paper figure assets
β”œβ”€β”€ img2.jpg
β”œβ”€β”€ img3.jpg
β”œβ”€β”€ .gitignore
└── README.md
```
---
## πŸ“Š Experiments Included (Sections 4.2–4.6)
### **Experiment 1 β€” Compensation Failure**
Shows why compensation cannot close Ξ”V under clipping.
### **Experiment 2 β€” Settling Dynamics**
Implements the threshold-decay commitment model.
### **Experiment 3 β€” Instant Commitment**
High-tier reachable candidate β†’ immediate match.
### **Experiment 4 β€” Regional Differences**
Despite different compensation norms (Jiangsu vs Guangdong),
**ranking is invariant** β†’ structural gaps dominate.
### **Experiment 5 β€” Regret Prediction**
Shock to `V_uncond_max` yields post-match ΞΈ decline β†’ slippage regret.
---
## 🎨 Visualization
`generate_academic_plots()` reproduces Figures:
- Settling curve `T(t)` vs ΞΈ
- Compensation utility clipping (Theorem 1)
- Structural slippage bars
Outputs:
```
simulation_results2.png
```
---
## ▢️ How to Run
### **1. Install dependencies**
```
pip install numpy pandas matplotlib
```
### **2. Run the experiments**
```
python exp1-5.py
```
### **3. Generate visualizations**
(automatically triggered at the end)
---
## πŸ“š Citation
If you use this framework, please cite:
```
Wu, Y. (2025). Limit Order Book Dynamics in Matching Markets:
Microstructure, Spread, and Execution Slippage.
arXiv:2511.20606.
```
---
## 🧠 Philosophy Behind the Model (Short)
This project formalizes a fundamental principle:
> **Compensation cannot close structural gaps.
> Only identity shifts can.**
This emerges naturally from the microstructure mapping between
Ξ”V β†’ spread,
C β†’ bounded price improvement,
and slippage β†’ structural regret.