From the backend/ directory:
- Run tests:
./mvnw test - Run app:
./mvnw spring-boot:run
- Set FRED key:
- macOS/Linux:
export FRED_API_KEY=your_key_here - The backend reads
fred.apiKey, which defaults to${FRED_API_KEY}when unset.
- macOS/Linux:
- Risk-free rate (
Rf):- Source: FRED DGS10 via
fred.baseUrl(defaulthttps://api.stlouisfed.org/fred). - Fallback:
capm.riskFreeFallback(default0.04) when key/network/parse fails.
- Source: FRED DGS10 via
- Market return (
Rm):- Source: public Yahoo Finance S&P 500 chart endpoint (
^GSPC) using the latest 5-year monthly close data. - Computation: 5-year CAGR,
Rm = (end / start)^(1/5) - 1. - Fallback:
capm.marketReturn5y(default0.10) if fetch or parsing fails.
- Source: public Yahoo Finance S&P 500 chart endpoint (
- Caching:
- Both
RfandRmare cached for 24 hours to reduce external calls.
- Both
Backend runs at http://localhost:8080 (API base: /api).
From the frontend/ directory:
- Install dependencies (first time):
npm install - Run dev server:
npm run dev
Frontend runs at http://localhost:5173 (configured to talk to the backend).
- In one terminal:
cd backend && ./mvnw spring-boot:run - In another terminal:
cd frontend && npm install && npm run dev - Open http://localhost:5173 in your browser.