m-marcolazzeri/defi-monitor
GitHub: m-marcolazzeri/defi-monitor
基于 Python 和机器学习的 DeFi 收益监控系统,用于追踪 Arbitrum 借贷协议的 APY、TVL 等指标并检测异常行为。
Stars: 0 | Forks: 0
# DeFi 监控
一个用于监控 Arbitrum 上 DeFi 借贷协议中稳定币收益策略的数据管道和机器学习系统。
每日追踪 APY、TVL 和利用率,运行异常检测以标记异常的协议行为,并在实时仪表板中可视化所有内容。该项目旨在研究像 [Dialectic](https://dialectic.ky) 这样的机构 DeFi 运营商如何监控和优化收益策略。
## 架构
```
DefiLlama API ─┐
├─▶ pipeline/multi_protocol.py ─▶ data/multi_protocol.csv
Aave v3 RPC ─┘ │
▼
models/anomaly_detector.py
│
▼
dashboard/app.py (Streamlit)
```
GitHub Actions 每日于 UTC 时间 09:00 运行管道并自动提交新数据。
## 结构
```
defi-monitor/
├── pipeline/
│ └── multi_protocol.py # Data collection: DefiLlama + on-chain Web3
├── models/
│ └── anomaly_detector.py # Isolation Forest on APY, TVL, utilization rate
├── dashboard/
│ └── app.py # Streamlit dashboard
├── web3_utils.py # Aave v3 on-chain data reader
├── data/ # Auto-updated CSVs (via GitHub Actions)
└── .github/workflows/
└── collect_data.yml
```
## 快速开始
```
git clone https://github.com/m-marcolazzeri/defi-monitor
cd defi-monitor
pip install -r requirements.txt
python pipeline/multi_protocol.py
streamlit run dashboard/app.py
```
## 指标
| 指标 | 描述 |
|---|---|
| `apy_total` | 存款人的年化收益率(基础 + 奖励) |
| `utilization_rate` | 当前已借出的可用流动性份额 |
| `tvl_usd` | 协议中存入的总资本 |
| `anomaly_score` | Isolation Forest 分数 —— 负值越小越异常 |
## 技术栈
Python · Pandas · Scikit-learn · Web3.py · Streamlit · Plotly · DefiLlama API · GitHub Actions
标签:Aave v3, Apex, APY, Arbitrum, DeFi, DefiLlama, GitHub Actions, Isolation Forest, Kubernetes, Layer 2, Python, RPC, Streamlit, TVL, Web3, 互联网扫描, 代码示例, 借贷协议, 加密货币, 区块链, 占用监测, 可视化仪表盘, 异常检测, 收益监控, 数据分析, 数据管道, 无后门, 机器学习, 稳定币, 网络调试, 自动化, 自动笔记, 访问控制, 资产管理, 软件工程, 逆向工具, 量化金融, 金融科技