Upload folder using huggingface_hub
Browse files- README.md +31 -0
- config.json +19 -0
- model.pt +3 -0
README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LOBPatternNet - 主力下单模式识别模型
|
| 2 |
+
|
| 3 |
+
## 模型简介
|
| 4 |
+
基于Level-2十档委托单数据的主力(机构)交易模式识别深度学习模型。
|
| 5 |
+
|
| 6 |
+
## 模型架构
|
| 7 |
+
- **输入**: 100个连续的Level-2委托快照,每个快照包含40个特征(10档买/卖价格+数量)
|
| 8 |
+
- **特征工程**: 订单流不平衡(OFI)、价差动态、深度不平衡、大单集中度、价格压力、OFI波动率
|
| 9 |
+
- **编码器**: CNN空间编码器 + Inception多尺度时间特征 + Transformer注意力机制
|
| 10 |
+
- **输出**: 3分类(主力买入 / 中性 / 主力卖出)
|
| 11 |
+
|
| 12 |
+
## 性能指标
|
| 13 |
+
- Test Accuracy: 0.8752
|
| 14 |
+
- Test F1 (weighted): 0.8169
|
| 15 |
+
|
| 16 |
+
## 使用方法
|
| 17 |
+
```python
|
| 18 |
+
from model import LOBPatternNet
|
| 19 |
+
import torch
|
| 20 |
+
|
| 21 |
+
model = LOBPatternNet(seq_len=100, num_classes=3)
|
| 22 |
+
model.load_state_dict(torch.load("model.pt"))
|
| 23 |
+
model.eval()
|
| 24 |
+
|
| 25 |
+
# Input: (batch, 100, 40) LOB snapshots
|
| 26 |
+
# Output: (batch, 3) logits [主力买入, 中性, 主力卖出]
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## 引用
|
| 30 |
+
- DeepLOB: Zhang et al., TNNLS 2019
|
| 31 |
+
- TLOB: Berti & Kasneci, arxiv:2502.15757
|
config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "LOBPatternNet",
|
| 3 |
+
"num_levels": 10,
|
| 4 |
+
"seq_len": 100,
|
| 5 |
+
"num_classes": 3,
|
| 6 |
+
"d_model": 128,
|
| 7 |
+
"nhead": 4,
|
| 8 |
+
"num_attn_layers": 2,
|
| 9 |
+
"dropout": 0.3,
|
| 10 |
+
"class_names": [
|
| 11 |
+
"\u4e3b\u529b\u4e70\u5165 (Institutional Buy)",
|
| 12 |
+
"\u4e2d\u6027 (Neutral)",
|
| 13 |
+
"\u4e3b\u529b\u5356\u51fa (Institutional Sell)"
|
| 14 |
+
],
|
| 15 |
+
"description": "Institutional trading pattern detection from Level-2 order book data",
|
| 16 |
+
"architecture": "CNN + Inception + Transformer Attention",
|
| 17 |
+
"test_f1": 0.8168909018517501,
|
| 18 |
+
"test_acc": 0.8751566808723991
|
| 19 |
+
}
|
model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b89a47feff6243a25222dcc4958860cb43dd705da131902c8fc3c4cc771bbb6
|
| 3 |
+
size 1073163
|