diff --git a/CLAUDE.md b/CLAUDE.md index 24e1c25..ad2f2b0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,7 +1,5 @@ # CLAUDE.md -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - ## Project Overview Galaxis-Po is a quant portfolio management application for DC pension (퇴직연금) investing. It implements the Kim Jong-bong (김종봉) strategy for backtesting, signal generation, and portfolio management. The strategy logic is defined in `quant.md` — do not modify it without explicit instruction. @@ -24,9 +22,6 @@ cd frontend && npm run dev # Run all backend tests cd backend && uv run pytest -# Run a single test file -cd backend && uv run pytest tests/unit/test_kjb_signal.py -v - # Run e2e tests cd backend && uv run pytest tests/e2e/ -v @@ -41,48 +36,13 @@ cd frontend && npm run lint # Frontend type check cd frontend && npx tsc --noEmit - -# Start all services via Docker -docker-compose up -d ``` -## Architecture - -### Backend (`backend/`) - -- `app/main.py` — FastAPI app with lifespan manager (seeds admin user, starts APScheduler) -- `app/api/` — Route handlers (routers): auth, admin, portfolio, strategy, market, backtest, snapshot, data_explorer, signal -- `app/models/` — SQLAlchemy ORM models: user, stock, portfolio, signal, backtest -- `app/schemas/` — Pydantic request/response schemas -- `app/services/` — Business logic layer: - - `collectors/` — Market data collectors (pykrx for Korean stock data, DART API for financials) - - `strategy/` — Kim Jong-bong strategy implementation (signal generation, factor calculation) - - `backtest/` — Backtesting engine - - `rebalance.py` — Portfolio rebalancing logic - - `price_service.py`, `factor_calculator.py`, `returns_calculator.py` — Quant utilities -- `app/core/` — Config (pydantic-settings from `.env`), database (SQLAlchemy), security (JWT/bcrypt) -- `jobs/` — APScheduler background jobs: data collection, signal generation, portfolio snapshots -- `alembic/` — Database migrations -- `tests/` — `unit/` and `e2e/` test directories - -### Frontend (`frontend/`) - -- Next.js App Router at `src/app/` with pages: portfolio, strategy, signals, backtest, admin, login -- `src/components/` — UI components organized by domain (portfolio, strategy, charts, layout, ui) -- `src/lib/api.ts` — Backend API client -- Uses lightweight-charts for financial charts, recharts for other visualizations - ## Development Rules 1. Check `docs/plans/` for relevant design documents before implementing features 2. All API endpoints go under `backend/app/api/` as routers 3. DB schema changes require an alembic migration — autogenerate 후 반드시 리뷰하고 즉시 `alembic upgrade head` 4. Do not modify `.env` or `docker-compose.prod.yml` (`.env` 설정 안내는 허용, 자동 수정은 금지) -5. Python: snake_case; TypeScript: camelCase -6. External APIs: pykrx (한국 거래소 데이터, 백테스트/시그널 주력), KIS (실시간 매매), DART (재무제표) -7. 커밋은 논리 단위별로 개별 생성. 커밋 전 관련 테스트 실행 필수 -8. Frontend 변경 후 `cd frontend && npx tsc --noEmit` 필수 - -## Environment - -Backend config is loaded via pydantic-settings from environment variables / `.env` file. Key variables: `DATABASE_URL`, `JWT_SECRET`, `KIS_APP_KEY`, `KIS_APP_SECRET`, `KIS_ACCOUNT_NO`, `DART_API_KEY`. See `.env.example` for reference. +5. External APIs: pykrx (한국 거래소 데이터, 백테스트/시그널 주력), KIS (실시간 매매), DART (재무제표) +6. Frontend 변경 후 `cd frontend && npx tsc --noEmit` 필수