모의투자 관리 기능 추가

This commit is contained in:
Macbook
2026-05-31 03:47:07 +09:00
parent 9d7dddfa57
commit 16d0e2c226
78 changed files with 4688 additions and 972 deletions
+17
View File
@@ -867,6 +867,23 @@ goldenChart/
---
## 모의투자 (Paper Trading) — V18 + V51 + V52
| 테이블 | 설명 |
|--------|------|
| `gc_paper_account` | device당 1계좌. `cash_balance`, `reserved_cash`, `initial_capital_snapshot`, `realized_pnl`, `reset_count` |
| `gc_paper_position` | 종목별 보유 수량·평단 |
| `gc_paper_trade` | 체결 이력. `realized_pnl_delta`, `position_qty_after`, `cash_after` |
| `gc_paper_symbol_allocation` | 종목별 `max_invest_krw`, `strategy_id`, `is_active` (UK: account_id + symbol) |
| `gc_paper_cash_ledger` | 자금 원장 (`INITIAL`, `BUY_SETTLE`, `SELL_SETTLE`, `RESET`) |
| `gc_paper_daily_snapshot` | 일별 EOD 자산 (UK: account_id + snapshot_date) |
| `gc_paper_reset_log` | 계좌 초기화 감사 이력 |
| `gc_paper_order` | 미체결 주문 (`PENDING` / `FILLED` / `CANCELLED`) |
API prefix: `/paper/*` — [PaperTradingController](backend/src/main/java/com/goldenchart/controller/PaperTradingController.java)
---
## 주의사항
1. **JPA FK vs 논리 참조**: `users`, `strategy_rule` 등을 참조하는 컬럼 다수가 JPA `@ManyToOne` 없이 Long ID만 보관하므로 DB 레벨 FK 제약이 없습니다. 참조 무결성은 애플리케이션 로직에 의존합니다.