REST API for real-time stock data, integrated with the Alpha Vantage API. Allows fetching quotes, company overviews, price history, and managing a list of favorite stocks.
| Method | Route | Description | Status |
|---|---|---|---|
GET |
/api/v1/stocks/{symbol} |
Returns the current quote for a stock | ✅ |
GET |
/api/v1/stocks/{symbol}/overview |
Returns general information about the company | ✅ |
GET |
/api/v1/stocks/{symbol}/history?days=30 |
Returns price history (default: 30 days) | ✅ |
POST |
/api/v1/stocks/favorites |
Adds a stock to the favorites list | ✅ |
GET |
/api/v1/stocks/favorites |
Lists all favorite stocks | ✅ |
- Spring Boot 4.0.3
- Java 25
- MySQL — primary database
- Alpha Vantage API — market data source
| Library | Purpose |
|---|---|
| Spring Web MVC | REST endpoints |
| Spring WebFlux | Reactive HTTP client (WebClient) |
| Spring Data JPA | Data persistence |
| Lombok | Boilerplate reduction |
| MySQL Driver | MySQL connector |
| H2 Database | In-memory database for development |
- Java 25+
- Maven 3.9+
- MySQL running locally (or use H2 for development)
- Alpha Vantage API key (free)
-
Copy the example file and create your
application.properties:cp src/main/resources/application.example src/main/resources/application.properties
-
Fill in the variables in
application.properties:alpha.vantage.api.key=YOUR_API_KEY_HERE # For MySQL spring.datasource.url=jdbc:mysql://localhost:3306/stock_tracer_db spring.datasource.username=your_username spring.datasource.password=your_password
./mvnw spring-boot:runThe application will be available at http://localhost:8080.
# Current quote
GET /api/v1/stocks/AAPL
# Company overview
GET /api/v1/stocks/AAPL/overview
# Price history for the last 7 days
GET /api/v1/stocks/AAPL/history?days=7
# Add to favorites
POST /api/v1/stocks/favorites
Content-Type: application/json
{ "symbol": "AAPL" }