File size: 4,542 Bytes
ce8e1e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb772c8
ce8e1e1
cb772c8
ce8e1e1
 
 
cb772c8
 
ce8e1e1
 
 
 
 
 
 
 
 
 
 
b91c767
cb772c8
ce8e1e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb772c8
b91c767
 
ce8e1e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
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.