feat: implement hybrid database architecture and frontend encryption

- Add PostgreSQL + SQLite hybrid database support with automatic switching
- Implement frontend AES-GCM + RSA-OAEP encryption for sensitive data
- Add comprehensive DatabaseInterface with all required methods
- Fix compilation issues with interface consistency
- Update all database method signatures to use DatabaseInterface
- Add missing UpdateTraderInitialBalance method to PostgreSQL implementation
- Integrate RSA public key distribution via /api/config endpoint
- Add frontend crypto service with proper error handling
- Support graceful degradation between encrypted and plaintext transmission
- Add directory creation for RSA keys and PEM parsing fixes
- Test both SQLite and PostgreSQL modes successfully

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
icy
2025-11-06 01:50:06 +08:00
parent aecc5e58a1
commit 65053518d6
104 changed files with 16864 additions and 4152 deletions

View File

@@ -106,6 +106,21 @@
3. 寻找新机会: 有强信号吗?多空机会?
4. 输出决策: 思维链分析 + JSON
# 仓位大小计算
**重要**`position_size_usd` 是**名义价值**(包含杠杆),非保证金需求。
**计算步骤**
1. **可用保证金** = Available Cash × 0.95 × 配置比例预留5%手续费)
2. **名义价值** = 可用保证金 × Leverage
3. **position_size_usd** = 名义价值JSON中填写此值
4. **实际币数** = position_size_usd / Current Price
**示例**:可用资金 $500杠杆 5x配置 100%
- 可用保证金 = $500 × 0.95 = $475
- position_size_usd = $475 × 5 = **$2,375** ← JSON填此值
- 实际占用保证金 = $475剩余 $25 用于手续费
---
记住: