Skip to content

Commit 1ee8c7a

Browse files
committed
Merge branch 'release/0.2.0'
2 parents 3cc5403 + 7c93893 commit 1ee8c7a

File tree

248 files changed

+5828
-5511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+5828
-5511
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,3 @@ cython_debug/
163163
config.toml
164164
config.test.toml
165165
.DS_Store
166-
167-
# VS Code
168-
.vscode/

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.3.4
4+
hooks:
5+
- id: ruff
6+
args: [--fix, --exit-non-zero-on-fix]
7+
- id: ruff-format
8+
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v4.5.0
11+
hooks:
12+
- id: trailing-whitespace
13+
- id: end-of-file-fixer
14+
- id: check-yaml
15+
- id: check-toml
16+
- id: check-added-large-files
17+
- id: debug-statements
18+
- id: check-merge-conflict

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"makefile.configureOnOpen": false,
3+
"python.testing.pytestArgs": [
4+
"tests"
5+
],
6+
"python.testing.unittestEnabled": false,
7+
"python.testing.pytestEnabled": true,
8+
"[python]": {
9+
"editor.codeActionsOnSave": {
10+
"source.fixAll": "explicit",
11+
"source.organizeImports": "explicit"
12+
},
13+
"editor.defaultFormatter": "charliermarsh.ruff"
14+
}
15+
}

.vscode/tasks.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "运行 Cache Preloader 服务",
6+
"type": "shell",
7+
"command": "uv run python app/cache-preloader/cache_preloader/main.py",
8+
"problemMatcher": [],
9+
"group": {
10+
"kind": "build",
11+
"isDefault": true
12+
},
13+
"presentation": {
14+
"reveal": "always",
15+
"panel": "new",
16+
"focus": true
17+
},
18+
"detail": "启动 Cache Preloader 服务"
19+
},
20+
{
21+
"label": "运行 Wallet Tracker 服务",
22+
"type": "shell",
23+
"command": "uv run python app/wallet-tracker/wallet_tracker/main.py",
24+
"problemMatcher": [],
25+
"group": {
26+
"kind": "build",
27+
"isDefault": true
28+
},
29+
"presentation": {
30+
"reveal": "always",
31+
"panel": "new",
32+
"focus": true
33+
},
34+
"detail": "启动 Wallet Tracker 服务"
35+
},
36+
{
37+
"label": "运行 Trading 服务",
38+
"type": "shell",
39+
"command": "uv run python app/trading/trading/main.py",
40+
"problemMatcher": [],
41+
"group": {
42+
"kind": "build",
43+
"isDefault": true
44+
},
45+
"presentation": {
46+
"reveal": "always",
47+
"panel": "new",
48+
"focus": true
49+
},
50+
"detail": "启动 Trading 服务"
51+
},
52+
{
53+
"label": "运行 Tg Bot 服务",
54+
"type": "shell",
55+
"command": "uv run python app/tg-bot/tg_bot/main.py",
56+
"problemMatcher": [],
57+
"group": {
58+
"kind": "build",
59+
"isDefault": true
60+
},
61+
"presentation": {
62+
"reveal": "always",
63+
"panel": "new",
64+
"focus": true
65+
},
66+
"detail": "启动 Tg Bot 服务"
67+
}
68+
]
69+
}

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
8282
available at [https://contributor-covenant.org/version/1/4][version]
8383

8484
[homepage]: https://contributor-covenant.org
85-
[version]: https://contributor-covenant.org/version/1/4/
85+
[version]: https://contributor-covenant.org/version/1/4/

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ DOCKER_EXEC := podman # podman or docker
44

55
# 安装开发依赖
66
dev-deps:
7-
pdm install -G dev -G local
7+
uv sync
88

99
# 基础设施服务
1010
infra-up:
@@ -47,4 +47,7 @@ clean:
4747
find . -type d -name ".eggs" -exec rm -r {} +
4848

4949
update-version:
50-
python scripts/update-version.py
50+
uv run python scripts/update-version.py
51+
52+
pre-commit-check:
53+
uv run pre-commit run --all-files | cat

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ cp example.config.toml config.toml
9292
shyft_api_base_url = "https://api.shyft.to"
9393
shyft_api_key = ""
9494
```
95+
- `db`: 数据库连接配置,默认配置适用于本地开发环境。在 Docker 环境中会自动使用容器别名。
96+
```
97+
[db]
98+
# 本地开发环境(从源码运行)
99+
mysql_url = "mysql+pymysql://root:[email protected]:3307/solana_trade_bot"
100+
redis_url = "redis://127.0.0.1:6380/0"
101+
```
95102

96103
> 💡 为了获得更快的跟单速度,默认使用 `geyser` 模式,同时也支持 WebSocket 订阅方式
97104

app/cache-preloader/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Build base image first
2+
FROM python:3.10-slim as builder
3+
4+
# Set environment variables
5+
ENV PYTHONUNBUFFERED=1 \
6+
PDM_USE_VENV=false \
7+
PDM_INSTALL_PATH=/app \
8+
PROJECT_ROOT=/app
9+
10+
# Install system dependencies
11+
RUN apt-get update && apt-get install -y \
12+
build-essential \
13+
curl \
14+
git \
15+
libssl-dev \
16+
pkg-config \
17+
&& rm -rf /var/lib/apt/lists/*
18+
19+
# Install PDM
20+
RUN curl -sSL https://pdm.fming.dev/install-pdm.py | python3 - && \
21+
ln -s /root/.local/bin/pdm /usr/bin/pdm
22+
23+
WORKDIR /app
24+
25+
# Create necessary directories
26+
RUN mkdir -p /app/libs /app/logs
27+
28+
# Build final image
29+
FROM builder as final
30+
31+
# Install dependencies
32+
COPY ./libs /app/libs
33+
COPY ./app/cache-preloader/pyproject.toml /app/
34+
RUN pdm config python.use_venv false && \
35+
pdm install -G local
36+
37+
ENTRYPOINT [ "pdm", "run", "python", "-m" ]

app/cache-preloader/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# 缓存预加载微服务
2+
3+
此微服务负责预加载和维护各种缓存数据,以提高主应用程序的性能。
4+
5+
## 项目结构
6+
7+
```
8+
cache_preloader/
9+
├── __init__.py # 包初始化文件
10+
├── main.py # 主入口点
11+
├── core/ # 核心组件
12+
│ ├── __init__.py # 核心包初始化文件
13+
│ ├── protocols.py # 协议定义
14+
│ └── base.py # 基础类实现
15+
├── caches/ # 具体缓存实现
16+
│ ├── __init__.py # 缓存包初始化文件
17+
│ ├── blockhash.py # 区块哈希缓存
18+
│ ├── min_balance_rent.py # 最小租金余额缓存
19+
│ └── raydium_pool.py # Raydium 池缓存
20+
└── services/ # 服务实现
21+
├── __init__.py # 服务包初始化文件
22+
└── auto_update_service.py # 自动更新服务
23+
```
24+
25+
## 组件说明
26+
27+
### 核心组件 (core/)
28+
29+
- **protocols.py**: 定义缓存系统的协议接口
30+
- **base.py**: 实现基础缓存类,提供通用功能
31+
32+
### 缓存实现 (caches/)
33+
34+
- **blockhash.py**: 区块哈希缓存实现
35+
- **min_balance_rent.py**: 最小租金余额缓存实现
36+
- **raydium_pool.py**: Raydium 池缓存实现
37+
38+
### 服务实现 (services/)
39+
40+
- **auto_update_service.py**: 自动更新缓存服务,协调和管理各种缓存的更新
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
缓存预加载微服务
3+
4+
此微服务负责预加载和维护各种缓存数据,以提高主应用程序的性能。
5+
"""
6+
7+
__version__ = "0.1.0"

0 commit comments

Comments
 (0)