Skip to content

Commit 17fbba6

Browse files
luisleo526claude
andcommitted
docs: update prerequisites (SQLite3), fix config keys and CLI flags
- Add libsqlite3-dev / sqlite3 to system requirements - Fix config examples: buy_group/sell_group → group_a/group_b - Add --trade-db and --bench-warmup to CLI flags table - Fix --bench-rounds default from 5 → 20 - Add --trade-db to systemd service examples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7a58bbb commit 17fbba6

9 files changed

Lines changed: 73 additions & 61 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Low-latency crypto spot arbitrage system built in C++17. Monitors price differen
88

99
```bash
1010
# Build
11-
sudo apt install -y build-essential cmake libssl-dev libcurl4-openssl-dev zlib1g-dev
11+
sudo apt install -y build-essential cmake libssl-dev libcurl4-openssl-dev zlib1g-dev libsqlite3-dev
1212
mkdir build && cd build
1313
cmake .. -DCMAKE_BUILD_TYPE=Release
1414
make -j$(nproc)

docs/deployment.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"threshold": 2.0,
1010
"interval_sec": 1,
1111
"coins": ["BTC", "ETH", "XRP"],
12-
"buy_group": {
12+
"group_a": {
1313
"quote_currency": "USDT",
1414
"exchanges": ["bybit"]
1515
},
16-
"sell_group": {
16+
"group_b": {
1717
"quote_currency": "KRW",
1818
"exchanges": ["upbit"]
1919
},
@@ -71,8 +71,8 @@ Same as single binary config, plus `listen_port`. Credentials are **not** needed
7171
| `threshold` | Premium percentage that triggers a trade |
7272
| `interval_sec` | Display table refresh interval (seconds) |
7373
| `coins` | Coins to monitor/trade (e.g., `["BTC", "ETH", "XRP"]`) |
74-
| `buy_group` | Exchanges to buy on`quote_currency` + exchange names |
75-
| `sell_group` | Exchanges to sell on`quote_currency` + exchange names |
74+
| `group_a` | Exchange group A`quote_currency` + exchange names |
75+
| `group_b` | Exchange group B`quote_currency` + exchange names |
7676
| `cross_rate` | Currency conversion config (averaged mid-price from `sources`) |
7777
| `trade.*` | See [Trading](trading.md#configuration) |
7878
| `listen_port` | Master TCP listen port (master config only) |
@@ -107,7 +107,7 @@ Environment variables take precedence over the config file.
107107
```
108108
./spot_arb [--config <path>] [--threshold <pct>] [--interval <sec>]
109109
[--web PORT] [--dry-run] [--benchmark] [--bench-rounds N]
110-
[--latency-log <path>]
110+
[--bench-warmup N] [--latency-log <path>] [--trade-db <path>]
111111
```
112112

113113
| Flag | Default | Description |
@@ -118,8 +118,10 @@ Environment variables take precedence over the config file.
118118
| `--web PORT` | *(off)* | Start web dashboard on PORT |
119119
| `--dry-run` | *(off)* | Simulate trades without placing real orders |
120120
| `--benchmark` | *(off)* | Run order latency benchmark and exit |
121-
| `--bench-rounds` | `5` | Number of benchmark rounds |
122-
| `--latency-log` | *(off)* | CSV file for trade execution data |
121+
| `--bench-rounds` | `20` | Number of benchmark rounds |
122+
| `--bench-warmup` | `5` | Number of benchmark warmup rounds |
123+
| `--latency-log` | *(off)* | CSV file for trade latency data (truncated on restart) |
124+
| `--trade-db` | *(off)* | SQLite database for persistent trade history |
123125

124126
### `spot_master`
125127

@@ -200,21 +202,22 @@ graph TD
200202

201203
### systemd service files
202204

203-
=== "Master"
205+
=== "Single Binary"
204206

205207
```ini
206-
# /etc/systemd/system/spot-master.service
208+
# /etc/systemd/system/spot-arb.service
207209
[Unit]
208-
Description=Spot Arbitrage Master
210+
Description=Spot Arbitrage
209211
After=network.target
210212

211213
[Service]
212214
Type=simple
213215
User=ubuntu
214216
WorkingDirectory=/home/ubuntu/spot_arbitrage
215-
ExecStart=/home/ubuntu/spot_arbitrage/build/spot_master \
216-
--config config_master.json \
217-
--latency-log /var/log/spot_trades.csv
217+
ExecStart=/home/ubuntu/spot_arbitrage/build/spot_arb \
218+
--config config.json \
219+
--latency-log /var/log/spot_trades.csv \
220+
--trade-db /var/lib/spot_arb/trades.db
218221
Restart=always
219222
RestartSec=3
220223
LimitNOFILE=65536
@@ -223,20 +226,21 @@ graph TD
223226
WantedBy=multi-user.target
224227
```
225228

226-
=== "Slave"
229+
=== "Master"
227230

228231
```ini
229-
# /etc/systemd/system/spot-slave.service
232+
# /etc/systemd/system/spot-master.service
230233
[Unit]
231-
Description=Spot Arbitrage Slave
234+
Description=Spot Arbitrage Master
232235
After=network.target
233236

234237
[Service]
235238
Type=simple
236239
User=ubuntu
237240
WorkingDirectory=/home/ubuntu/spot_arbitrage
238-
ExecStart=/home/ubuntu/spot_arbitrage/build/spot_slave \
239-
--config config_slave.json
241+
ExecStart=/home/ubuntu/spot_arbitrage/build/spot_master \
242+
--config config_master.json \
243+
--latency-log /var/log/spot_trades.csv
240244
Restart=always
241245
RestartSec=3
242246
LimitNOFILE=65536
@@ -245,21 +249,20 @@ graph TD
245249
WantedBy=multi-user.target
246250
```
247251

248-
=== "Single Binary"
252+
=== "Slave"
249253

250254
```ini
251-
# /etc/systemd/system/spot-arb.service
255+
# /etc/systemd/system/spot-slave.service
252256
[Unit]
253-
Description=Spot Arbitrage
257+
Description=Spot Arbitrage Slave
254258
After=network.target
255259

256260
[Service]
257261
Type=simple
258262
User=ubuntu
259263
WorkingDirectory=/home/ubuntu/spot_arbitrage
260-
ExecStart=/home/ubuntu/spot_arbitrage/build/spot_arb \
261-
--config config.json \
262-
--latency-log /var/log/spot_trades.csv
264+
ExecStart=/home/ubuntu/spot_arbitrage/build/spot_slave \
265+
--config config_slave.json
263266
Restart=always
264267
RestartSec=3
265268
LimitNOFILE=65536

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ make -j$(nproc)
7373

7474
- C++17 compiler (GCC 11+ or Clang 14+)
7575
- CMake 3.14+
76-
- OpenSSL, libcurl, zlib development headers
76+
- OpenSSL, libcurl, zlib, SQLite3 development headers
7777

7878
All other dependencies (ixwebsocket, nlohmann/json, fmt) are fetched automatically via CMake FetchContent.
7979

8080
=== "Ubuntu/Debian"
8181

8282
```bash
8383
sudo apt update && sudo apt install -y \
84-
build-essential cmake libssl-dev libcurl4-openssl-dev zlib1g-dev
84+
build-essential cmake libssl-dev libcurl4-openssl-dev zlib1g-dev libsqlite3-dev
8585
```
8686

8787
=== "macOS"
8888

8989
```bash
90-
brew install cmake openssl curl
90+
brew install cmake openssl curl sqlite3
9191
```
9292

9393
## Build Outputs

docs/ko/deployment.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"threshold": 2.0,
1010
"interval_sec": 1,
1111
"coins": ["BTC", "ETH", "XRP"],
12-
"buy_group": {
12+
"group_a": {
1313
"quote_currency": "USDT",
1414
"exchanges": ["bybit"]
1515
},
16-
"sell_group": {
16+
"group_b": {
1717
"quote_currency": "KRW",
1818
"exchanges": ["upbit"]
1919
},
@@ -71,8 +71,8 @@
7171
| `threshold` | 거래를 트리거하는 프리미엄 백분율 |
7272
| `interval_sec` | 화면 테이블 갱신 간격 (초) |
7373
| `coins` | 모니터링/거래할 코인 (예: `["BTC", "ETH", "XRP"]`) |
74-
| `buy_group` | 매수 거래소 — `quote_currency` + 거래소 이름 |
75-
| `sell_group` | 매도 거래소 — `quote_currency` + 거래소 이름 |
74+
| `group_a` | 거래소 그룹 A`quote_currency` + 거래소 이름 |
75+
| `group_b` | 거래소 그룹 B`quote_currency` + 거래소 이름 |
7676
| `cross_rate` | 환율 변환 설정 (소스 거래소의 중간 가격 평균) |
7777
| `trade.*` | [거래](trading.md#설정) 참조 |
7878
| `listen_port` | 마스터 TCP 리슨 포트 (마스터 전용) |
@@ -107,7 +107,7 @@ export UPBIT_API_SECRET="your_secret"
107107
```
108108
./spot_arb [--config <경로>] [--threshold <퍼센트>] [--interval <초>]
109109
[--web PORT] [--dry-run] [--benchmark] [--bench-rounds N]
110-
[--latency-log <경로>]
110+
[--bench-warmup N] [--latency-log <경로>] [--trade-db <경로>]
111111
```
112112

113113
| 인수 | 기본값 | 설명 |
@@ -118,8 +118,10 @@ export UPBIT_API_SECRET="your_secret"
118118
| `--web PORT` | *(비활성)* | 웹 대시보드 시작 |
119119
| `--dry-run` | *(비활성)* | 실제 주문 없이 거래 시뮬레이션 |
120120
| `--benchmark` | *(비활성)* | 주문 지연 벤치마크 실행 후 종료 |
121-
| `--bench-rounds` | `5` | 벤치마크 라운드 수 |
122-
| `--latency-log` | *(비활성)* | 거래 실행 데이터 CSV 파일 |
121+
| `--bench-rounds` | `20` | 벤치마크 라운드 수 |
122+
| `--bench-warmup` | `5` | 벤치마크 워밍업 라운드 수 |
123+
| `--latency-log` | *(비활성)* | 거래 지연 데이터 CSV 파일 (재시작 시 초기화) |
124+
| `--trade-db` | *(비활성)* | 영구 거래 기록용 SQLite 데이터베이스 |
123125

124126
## 클라우드 배포
125127

@@ -193,7 +195,8 @@ graph TD
193195
WorkingDirectory=/home/ubuntu/spot_arbitrage
194196
ExecStart=/home/ubuntu/spot_arbitrage/build/spot_arb \
195197
--config config.json \
196-
--latency-log /var/log/spot_trades.csv
198+
--latency-log /var/log/spot_trades.csv \
199+
--trade-db /var/lib/spot_arb/trades.db
197200
Restart=always
198201
RestartSec=3
199202
LimitNOFILE=65536

docs/ko/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ make -j$(nproc)
7373

7474
- C++17 컴파일러 (GCC 11+ 또는 Clang 14+)
7575
- CMake 3.14+
76-
- OpenSSL, libcurl, zlib 개발 헤더
76+
- OpenSSL, libcurl, zlib, SQLite3 개발 헤더
7777

7878
기타 의존성(ixwebsocket, nlohmann/json, fmt)은 CMake FetchContent를 통해 자동으로 다운로드됩니다.
7979

8080
=== "Ubuntu/Debian"
8181

8282
```bash
8383
sudo apt update && sudo apt install -y \
84-
build-essential cmake libssl-dev libcurl4-openssl-dev zlib1g-dev
84+
build-essential cmake libssl-dev libcurl4-openssl-dev zlib1g-dev libsqlite3-dev
8585
```
8686

8787
=== "macOS"
8888

8989
```bash
90-
brew install cmake openssl curl
90+
brew install cmake openssl curl sqlite3
9191
```
9292

9393
## 빌드 산출물

docs/zh-cn/deployment.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"threshold": 2.0,
1010
"interval_sec": 1,
1111
"coins": ["BTC", "ETH", "XRP"],
12-
"buy_group": {
12+
"group_a": {
1313
"quote_currency": "USDT",
1414
"exchanges": ["bybit"]
1515
},
16-
"sell_group": {
16+
"group_b": {
1717
"quote_currency": "KRW",
1818
"exchanges": ["upbit"]
1919
},
@@ -71,8 +71,8 @@
7171
| `threshold` | 触发交易的溢价百分比 |
7272
| `interval_sec` | 显示表格的更新间隔(秒) |
7373
| `coins` | 监控/交易的币种(如 `["BTC", "ETH", "XRP"]`|
74-
| `buy_group` | 买入的交易所——`quote_currency` + 交易所名称 |
75-
| `sell_group` | 卖出的交易所——`quote_currency` + 交易所名称 |
74+
| `group_a` | 交易所分组 A——`quote_currency` + 交易所名称 |
75+
| `group_b` | 交易所分组 B——`quote_currency` + 交易所名称 |
7676
| `cross_rate` | 汇率转换配置(来源交易所的中间价平均) |
7777
| `trade.*` | 详见[交易](trading.md#配置) |
7878
| `listen_port` | 主节点 TCP 监听端口(仅主节点配置) |
@@ -107,7 +107,7 @@ export UPBIT_API_SECRET="your_secret"
107107
```
108108
./spot_arb [--config <路径>] [--threshold <百分比>] [--interval <秒>]
109109
[--web PORT] [--dry-run] [--benchmark] [--bench-rounds N]
110-
[--latency-log <路径>]
110+
[--bench-warmup N] [--latency-log <路径>] [--trade-db <路径>]
111111
```
112112

113113
| 参数 | 默认值 | 说明 |
@@ -118,8 +118,10 @@ export UPBIT_API_SECRET="your_secret"
118118
| `--web PORT` | *(关闭)* | 启动 Web 仪表板 |
119119
| `--dry-run` | *(关闭)* | 模拟交易,不下真实订单 |
120120
| `--benchmark` | *(关闭)* | 执行订单延迟测试后退出 |
121-
| `--bench-rounds` | `5` | 测试回合数 |
122-
| `--latency-log` | *(关闭)* | 交易执行数据的 CSV 文件 |
121+
| `--bench-rounds` | `20` | 测试回合数 |
122+
| `--bench-warmup` | `5` | 预热回合数 |
123+
| `--latency-log` | *(关闭)* | 交易延迟数据的 CSV 文件(重启时清空) |
124+
| `--trade-db` | *(关闭)* | 持久化交易记录的 SQLite 数据库 |
123125

124126
## 云端部署
125127

@@ -193,7 +195,8 @@ graph TD
193195
WorkingDirectory=/home/ubuntu/spot_arbitrage
194196
ExecStart=/home/ubuntu/spot_arbitrage/build/spot_arb \
195197
--config config.json \
196-
--latency-log /var/log/spot_trades.csv
198+
--latency-log /var/log/spot_trades.csv \
199+
--trade-db /var/lib/spot_arb/trades.db
197200
Restart=always
198201
RestartSec=3
199202
LimitNOFILE=65536

docs/zh-cn/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ make -j$(nproc)
7373

7474
- C++17 编译器(GCC 11+ 或 Clang 14+)
7575
- CMake 3.14+
76-
- OpenSSL、libcurl、zlib 开发头文件
76+
- OpenSSL、libcurl、zlib、SQLite3 开发头文件
7777

7878
其他依赖(ixwebsocket、nlohmann/json、fmt)会由 CMake FetchContent 自动下载。
7979

8080
=== "Ubuntu/Debian"
8181

8282
```bash
8383
sudo apt update && sudo apt install -y \
84-
build-essential cmake libssl-dev libcurl4-openssl-dev zlib1g-dev
84+
build-essential cmake libssl-dev libcurl4-openssl-dev zlib1g-dev libsqlite3-dev
8585
```
8686

8787
=== "macOS"
8888

8989
```bash
90-
brew install cmake openssl curl
90+
brew install cmake openssl curl sqlite3
9191
```
9292

9393
## 编译产物

docs/zh-tw/deployment.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"threshold": 2.0,
1010
"interval_sec": 1,
1111
"coins": ["BTC", "ETH", "XRP"],
12-
"buy_group": {
12+
"group_a": {
1313
"quote_currency": "USDT",
1414
"exchanges": ["bybit"]
1515
},
16-
"sell_group": {
16+
"group_b": {
1717
"quote_currency": "KRW",
1818
"exchanges": ["upbit"]
1919
},
@@ -71,8 +71,8 @@
7171
| `threshold` | 觸發交易的溢價百分比 |
7272
| `interval_sec` | 顯示表格的更新間隔(秒) |
7373
| `coins` | 監控/交易的幣種(如 `["BTC", "ETH", "XRP"]`|
74-
| `buy_group` | 買入的交易所——`quote_currency` + 交易所名稱 |
75-
| `sell_group` | 賣出的交易所——`quote_currency` + 交易所名稱 |
74+
| `group_a` | 交易所分組 A——`quote_currency` + 交易所名稱 |
75+
| `group_b` | 交易所分組 B——`quote_currency` + 交易所名稱 |
7676
| `cross_rate` | 匯率轉換設定(來源交易所的中間價平均) |
7777
| `trade.*` | 詳見[交易](trading.md#設定) |
7878
| `listen_port` | 主節點 TCP 監聽埠(僅主節點設定) |
@@ -107,7 +107,7 @@ export UPBIT_API_SECRET="your_secret"
107107
```
108108
./spot_arb [--config <路徑>] [--threshold <百分比>] [--interval <秒>]
109109
[--web PORT] [--dry-run] [--benchmark] [--bench-rounds N]
110-
[--latency-log <路徑>]
110+
[--bench-warmup N] [--latency-log <路徑>] [--trade-db <路徑>]
111111
```
112112

113113
| 參數 | 預設值 | 說明 |
@@ -118,8 +118,10 @@ export UPBIT_API_SECRET="your_secret"
118118
| `--web PORT` | *(關閉)* | 啟動 Web 儀表板 |
119119
| `--dry-run` | *(關閉)* | 模擬交易,不下真實訂單 |
120120
| `--benchmark` | *(關閉)* | 執行訂單延遲測試後退出 |
121-
| `--bench-rounds` | `5` | 測試回合數 |
122-
| `--latency-log` | *(關閉)* | 交易執行資料的 CSV 檔案 |
121+
| `--bench-rounds` | `20` | 測試回合數 |
122+
| `--bench-warmup` | `5` | 預熱回合數 |
123+
| `--latency-log` | *(關閉)* | 交易延遲資料的 CSV 檔案(重啟時清空) |
124+
| `--trade-db` | *(關閉)* | 持久化交易紀錄的 SQLite 資料庫 |
123125

124126
## 雲端部署
125127

@@ -193,7 +195,8 @@ graph TD
193195
WorkingDirectory=/home/ubuntu/spot_arbitrage
194196
ExecStart=/home/ubuntu/spot_arbitrage/build/spot_arb \
195197
--config config.json \
196-
--latency-log /var/log/spot_trades.csv
198+
--latency-log /var/log/spot_trades.csv \
199+
--trade-db /var/lib/spot_arb/trades.db
197200
Restart=always
198201
RestartSec=3
199202
LimitNOFILE=65536

0 commit comments

Comments
 (0)