some changes
This commit is contained in:
commit
3568453103
45 files changed
+4557
No files matched your search
@@ -0,0 +1,15 @@
|
||||
# Build stage
|
||||
FROM maven:3.9-eclipse-temurin-21 AS build
|
||||
WORKDIR /app
|
||||
COPY pom.xml .
|
||||
COPY src ./src
|
||||
RUN mvn clean package -DskipTests
|
||||
|
||||
# Run stage
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/target/*.jar app.jar
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.stockanalyzer</groupId>
|
||||
<artifactId>backend</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>stock-analyzer-backend</name>
|
||||
<description>Stock Analyzer Backend</description>
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
<lombok.version>1.18.38</lombok.version>
|
||||
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.17.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<release>${java.version}</release>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>com.stockanalyzer.StockAnalyzerApplication</mainClass>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.stockanalyzer;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
public class StockAnalyzerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(StockAnalyzerApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.stockanalyzer.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class CorsConfig implements WebMvcConfigurer {
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${cors.allowed-origins:http://localhost:5173}")
|
||||
private String allowedOrigins;
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/api/**")
|
||||
.allowedOrigins(allowedOrigins.split(","))
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
.allowedHeaders("*")
|
||||
.allowCredentials(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.stockanalyzer.controller;
|
||||
|
||||
import com.stockanalyzer.model.AnalysisJob;
|
||||
import com.stockanalyzer.model.AnalysisResult;
|
||||
import com.stockanalyzer.model.Stock;
|
||||
import com.stockanalyzer.repository.AnalysisResultRepository;
|
||||
import com.stockanalyzer.repository.StockRepository;
|
||||
import com.stockanalyzer.service.AnalysisService;
|
||||
import com.stockanalyzer.service.JobService;
|
||||
import com.stockanalyzer.service.StockDataService;
|
||||
import com.stockanalyzer.service.StockDataService.MarketContextData;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/analysis")
|
||||
public class AnalysisController {
|
||||
|
||||
private final AnalysisService analysisService;
|
||||
private final AnalysisResultRepository analysisResultRepository;
|
||||
private final StockRepository stockRepository;
|
||||
private final StockDataService stockDataService;
|
||||
private final JobService jobService;
|
||||
|
||||
public AnalysisController(
|
||||
AnalysisService analysisService,
|
||||
AnalysisResultRepository analysisResultRepository,
|
||||
StockRepository stockRepository,
|
||||
StockDataService stockDataService,
|
||||
JobService jobService) {
|
||||
this.analysisService = analysisService;
|
||||
this.analysisResultRepository = analysisResultRepository;
|
||||
this.stockRepository = stockRepository;
|
||||
this.stockDataService = stockDataService;
|
||||
this.jobService = jobService;
|
||||
}
|
||||
|
||||
public record AnalysisProgress(
|
||||
String isin,
|
||||
String status,
|
||||
AnalysisResult result,
|
||||
String error) {
|
||||
}
|
||||
|
||||
public record DeleteByDateRangeRequest(
|
||||
String startDate,
|
||||
String endDate) {
|
||||
}
|
||||
|
||||
@PostMapping("/run")
|
||||
public List<AnalysisJob> runAnalysis() {
|
||||
List<Stock> watchlist = stockRepository.findAll();
|
||||
List<AnalysisJob> jobs = new ArrayList<>();
|
||||
|
||||
// Clear old jobs optionally or just append new ones.
|
||||
// For simplicity, we'll keep history but maybe UI only cares about recent ones.
|
||||
// Let's clear strictly pending/processing ones? No, safer to just create new ones.
|
||||
|
||||
// Actually, to avoid queueing up duplicates if user clicks twice,
|
||||
// we might want to check if there is already a PENDING job for this ISIN.
|
||||
// But for now, simple implementation: just enqueue.
|
||||
|
||||
for (Stock stock : watchlist) {
|
||||
if (!jobService.hasPendingOrProcessingJob(stock.getIsin())) {
|
||||
AnalysisJob job = jobService.createJob(stock.getIsin(), stock.getSymbol());
|
||||
jobs.add(job);
|
||||
}
|
||||
}
|
||||
|
||||
// Return all current jobs (including existing ones) so UI knows status
|
||||
List<AnalysisJob> allJobs = jobService.getAllJobs();
|
||||
// Filter to return only jobs relevant to the watchlist if needed,
|
||||
// but returning all jobs is fine for the status view.
|
||||
return allJobs;
|
||||
}
|
||||
|
||||
@PostMapping("/run/{isin}")
|
||||
public List<AnalysisJob> runSingleAnalysis(@PathVariable String isin) {
|
||||
stockRepository.findByIsin(isin).ifPresent(stock -> {
|
||||
if (!jobService.hasPendingOrProcessingJob(stock.getIsin())) {
|
||||
jobService.createJob(stock.getIsin(), stock.getSymbol());
|
||||
}
|
||||
});
|
||||
return jobService.getAllJobs();
|
||||
}
|
||||
|
||||
@GetMapping("/jobs")
|
||||
public List<AnalysisJob> getJobStatus() {
|
||||
return jobService.getAllJobs();
|
||||
}
|
||||
|
||||
@PostMapping("/stop")
|
||||
public ResponseEntity<Void> stopAnalysis() {
|
||||
jobService.cancelAllJobs();
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/history")
|
||||
public ResponseEntity<List<AnalysisResult>> getHistory() {
|
||||
List<AnalysisResult> results = analysisResultRepository.findAll().stream()
|
||||
.sorted((r1, r2) -> r2.getAnalyzedAt().compareTo(r1.getAnalyzedAt()))
|
||||
.limit(50)
|
||||
.toList();
|
||||
return ResponseEntity.ok(results);
|
||||
}
|
||||
|
||||
@GetMapping("/history/{isin}")
|
||||
public ResponseEntity<List<AnalysisResult>> getHistoryByIsin(@PathVariable String isin) {
|
||||
List<AnalysisResult> results = analysisResultRepository.findByIsinOrderByAnalyzedAtDesc(isin).stream()
|
||||
.limit(30)
|
||||
.toList();
|
||||
return ResponseEntity.ok(results);
|
||||
}
|
||||
|
||||
@DeleteMapping("/history")
|
||||
public ResponseEntity<Map<String, Object>> deleteByDateRange(@RequestBody DeleteByDateRangeRequest request) {
|
||||
try {
|
||||
long count = analysisResultRepository.deleteByDateBetween(request.startDate(), request.endDate());
|
||||
return ResponseEntity.ok(Map.of("deleted", count));
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest()
|
||||
.body(Map.of("error", e.getMessage() != null ? e.getMessage() : "Unknown error"));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/market-context")
|
||||
public ResponseEntity<Map<String, Object>> getMarketContext() {
|
||||
MarketContextData context = stockDataService.getMarketContext();
|
||||
if (context != null) {
|
||||
return ResponseEntity.ok(
|
||||
Map.of(
|
||||
"symbol", context.symbol(),
|
||||
"changePercent", context.changePercent(),
|
||||
"price", context.price()));
|
||||
} else {
|
||||
return ResponseEntity.ok(Map.of("error", "Unable to fetch market context"));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/historical-price/{symbol}/{date}")
|
||||
public ResponseEntity<Map<String, Object>> getHistoricalPrice(
|
||||
@PathVariable String symbol,
|
||||
@PathVariable String date) {
|
||||
Double price = stockDataService.getHistoricalPrice(symbol, date);
|
||||
if (price != null) {
|
||||
return ResponseEntity.ok(Map.of("price", price));
|
||||
} else {
|
||||
return ResponseEntity.ok(Map.of("error", "Price not available"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/history/{id}/refresh-price")
|
||||
public ResponseEntity<AnalysisResult> refreshPrice(@PathVariable String id) {
|
||||
return analysisResultRepository.findById(id)
|
||||
.map(result -> {
|
||||
Double price = stockDataService.getHistoricalPrice(result.getSymbol(), result.getTargetDate());
|
||||
if (price != null) {
|
||||
result.setRealPrice(price);
|
||||
return ResponseEntity.ok(analysisResultRepository.save(result));
|
||||
}
|
||||
return ResponseEntity.ok(result);
|
||||
})
|
||||
.orElse(ResponseEntity.notFound().build());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.stockanalyzer.controller;
|
||||
|
||||
import com.stockanalyzer.model.Stock;
|
||||
import com.stockanalyzer.repository.StockRepository;
|
||||
import com.stockanalyzer.service.StockDataService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/watchlist")
|
||||
public class WatchlistController {
|
||||
|
||||
private final StockRepository stockRepository;
|
||||
private final StockDataService stockDataService;
|
||||
|
||||
public WatchlistController(StockRepository stockRepository, StockDataService stockDataService) {
|
||||
this.stockRepository = stockRepository;
|
||||
this.stockDataService = stockDataService;
|
||||
}
|
||||
|
||||
public record AddStockRequest(String isin) {
|
||||
}
|
||||
|
||||
public record StockResponse(
|
||||
String isin,
|
||||
String symbol,
|
||||
String name,
|
||||
String addedAt) {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<StockResponse> getAllStocks() {
|
||||
return stockRepository.findAll().stream()
|
||||
.sorted((s1, s2) -> s2.getAddedAt().compareTo(s1.getAddedAt()))
|
||||
.map(stock -> new StockResponse(
|
||||
stock.getIsin(),
|
||||
stock.getSymbol(),
|
||||
stock.getName(),
|
||||
stock.getAddedAt().toString()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<?> addStock(@RequestBody AddStockRequest request) {
|
||||
String isin = request.isin() != null ? request.isin().trim().toUpperCase() : "";
|
||||
|
||||
if (isin.isBlank()) {
|
||||
return ResponseEntity.badRequest().body(Map.of("error", "ISIN cannot be empty"));
|
||||
}
|
||||
|
||||
if (stockRepository.existsByIsin(isin)) {
|
||||
return ResponseEntity.status(HttpStatus.CONFLICT)
|
||||
.body(Map.of("error", "ISIN already exists in watchlist"));
|
||||
}
|
||||
|
||||
try {
|
||||
// Resolve ISIN to Symbol
|
||||
String symbol = stockDataService.getTickerFromIsin(isin);
|
||||
|
||||
// For now, use symbol as name (could fetch from Yahoo Finance if needed)
|
||||
String name = symbol;
|
||||
|
||||
Stock stock = Stock.builder()
|
||||
.isin(isin)
|
||||
.symbol(symbol)
|
||||
.name(name)
|
||||
.build();
|
||||
|
||||
Stock saved = stockRepository.save(stock);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(
|
||||
new StockResponse(
|
||||
saved.getIsin(),
|
||||
saved.getSymbol(),
|
||||
saved.getName(),
|
||||
saved.getAddedAt().toString()));
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body(Map.of("error", "Error adding stock: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/{isin}")
|
||||
public ResponseEntity<?> deleteStock(@PathVariable String isin) {
|
||||
if (stockRepository.existsByIsin(isin)) {
|
||||
stockRepository.deleteByIsin(isin);
|
||||
return ResponseEntity.noContent().build();
|
||||
} else {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.stockanalyzer.model;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Document(collection = "analysis_jobs")
|
||||
public class AnalysisJob {
|
||||
@Id
|
||||
private String id;
|
||||
private String isin;
|
||||
private String symbol;
|
||||
private JobStatus status;
|
||||
private String error;
|
||||
private LocalDateTime createdAt;
|
||||
private LocalDateTime startedAt;
|
||||
private LocalDateTime completedAt;
|
||||
|
||||
public enum JobStatus {
|
||||
PENDING,
|
||||
PROCESSING,
|
||||
COMPLETED,
|
||||
FAILED,
|
||||
CANCELLED
|
||||
}
|
||||
|
||||
public AnalysisJob() {}
|
||||
|
||||
public AnalysisJob(String isin, String symbol) {
|
||||
this.isin = isin;
|
||||
this.symbol = symbol;
|
||||
this.status = JobStatus.PENDING;
|
||||
this.createdAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
// Getters and Setters
|
||||
public String getId() { return id; }
|
||||
public void setId(String id) { this.id = id; }
|
||||
public String getIsin() { return isin; }
|
||||
public void setIsin(String isin) { this.isin = isin; }
|
||||
public String getSymbol() { return symbol; }
|
||||
public void setSymbol(String symbol) { this.symbol = symbol; }
|
||||
public JobStatus getStatus() { return status; }
|
||||
public void setStatus(JobStatus status) { this.status = status; }
|
||||
public String getError() { return error; }
|
||||
public void setError(String error) { this.error = error; }
|
||||
public LocalDateTime getCreatedAt() { return createdAt; }
|
||||
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
||||
public LocalDateTime getStartedAt() { return startedAt; }
|
||||
public void setStartedAt(LocalDateTime startedAt) { this.startedAt = startedAt; }
|
||||
public LocalDateTime getCompletedAt() { return completedAt; }
|
||||
public void setCompletedAt(LocalDateTime completedAt) { this.completedAt = completedAt; }
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.stockanalyzer.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
@Document(collection = "results")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class AnalysisResult {
|
||||
@Id
|
||||
private String id;
|
||||
private String isin;
|
||||
private String symbol;
|
||||
private Double price;
|
||||
private Double realPrice;
|
||||
private Double changePercent;
|
||||
private Fundamentals fundamentals;
|
||||
private Technicals technicals;
|
||||
private MarketContext marketContext;
|
||||
private List<String> newsHeadlines;
|
||||
private List<String> socialPosts;
|
||||
private LLMAnalysis llmAnalysisOpenai;
|
||||
private LLMAnalysis llmAnalysisAnthropic;
|
||||
|
||||
@Builder.Default
|
||||
private Instant analyzedAt = Instant.now();
|
||||
|
||||
private String date;
|
||||
private String targetDate;
|
||||
|
||||
public record Fundamentals(
|
||||
String peRatio,
|
||||
String marketCap,
|
||||
String high52w,
|
||||
String low52w,
|
||||
String targetMeanPrice,
|
||||
String recommendationKey) {
|
||||
}
|
||||
|
||||
public record Technicals(
|
||||
String sma20,
|
||||
String rsi) {
|
||||
}
|
||||
|
||||
public record MarketContext(
|
||||
String symbol,
|
||||
Double changePercent,
|
||||
Double price) {
|
||||
}
|
||||
|
||||
public record LLMAnalysis(
|
||||
String prediction,
|
||||
int probability,
|
||||
String reasoning,
|
||||
String error) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.stockanalyzer.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Document(collection = "stocks")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class Stock {
|
||||
@Id
|
||||
private String id;
|
||||
private String isin;
|
||||
private String symbol;
|
||||
private String name;
|
||||
|
||||
@Builder.Default
|
||||
private Instant addedAt = Instant.now();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.stockanalyzer.repository;
|
||||
|
||||
import com.stockanalyzer.model.AnalysisJob;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import java.util.List;
|
||||
|
||||
public interface AnalysisJobRepository extends MongoRepository<AnalysisJob, String> {
|
||||
List<AnalysisJob> findByStatus(AnalysisJob.JobStatus status);
|
||||
boolean existsByIsinAndStatus(String isin, AnalysisJob.JobStatus status);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.stockanalyzer.repository;
|
||||
|
||||
import com.stockanalyzer.model.AnalysisResult;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface AnalysisResultRepository extends MongoRepository<AnalysisResult, String> {
|
||||
List<AnalysisResult> findByIsinOrderByAnalyzedAtDesc(String isin);
|
||||
|
||||
@Query("{ 'date': { '$gte': ?0, '$lte': ?1 } }")
|
||||
List<AnalysisResult> findByDateBetween(String startDate, String endDate);
|
||||
|
||||
List<AnalysisResult> findByRealPriceIsNullAndTargetDateLessThan(String date);
|
||||
|
||||
List<AnalysisResult> findByIsinAndRealPriceIsNullAndTargetDateLessThan(String isin, String date);
|
||||
|
||||
long deleteByDateBetween(String startDate, String endDate);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.stockanalyzer.repository;
|
||||
|
||||
import com.stockanalyzer.model.Stock;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface StockRepository extends MongoRepository<Stock, String> {
|
||||
Optional<Stock> findByIsin(String isin);
|
||||
|
||||
boolean existsByIsin(String isin);
|
||||
|
||||
void deleteByIsin(String isin);
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
package com.stockanalyzer.service;
|
||||
|
||||
import com.stockanalyzer.model.AnalysisResult;
|
||||
import com.stockanalyzer.model.AnalysisResult.Fundamentals;
|
||||
import com.stockanalyzer.model.AnalysisResult.LLMAnalysis;
|
||||
import com.stockanalyzer.model.AnalysisResult.MarketContext;
|
||||
import com.stockanalyzer.model.AnalysisResult.Technicals;
|
||||
import com.stockanalyzer.repository.AnalysisResultRepository;
|
||||
import com.stockanalyzer.service.StockDataService.MarketContextData;
|
||||
import com.stockanalyzer.service.StockDataService.StockData;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class AnalysisService {
|
||||
|
||||
private final StockDataService stockDataService;
|
||||
private final NewsService newsService;
|
||||
private final SentimentService sentimentService;
|
||||
private final LLMService llmService;
|
||||
private final AnalysisResultRepository analysisResultRepository;
|
||||
|
||||
public AnalysisService(
|
||||
StockDataService stockDataService,
|
||||
NewsService newsService,
|
||||
SentimentService sentimentService,
|
||||
LLMService llmService,
|
||||
AnalysisResultRepository analysisResultRepository) {
|
||||
this.stockDataService = stockDataService;
|
||||
this.newsService = newsService;
|
||||
this.sentimentService = sentimentService;
|
||||
this.llmService = llmService;
|
||||
this.analysisResultRepository = analysisResultRepository;
|
||||
}
|
||||
|
||||
public AnalysisResult analyzeStock(String isin) {
|
||||
// 1. Get Stock Data
|
||||
StockData stockInfo = stockDataService.getStockPrice(isin);
|
||||
if (stockInfo.error() != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String symbol = stockInfo.symbol();
|
||||
|
||||
// 1.5 Update past results for this stock (fill in missing real prices)
|
||||
updatePastResults(isin, symbol);
|
||||
|
||||
// 2. Get News
|
||||
List<String> news = newsService.getNews(symbol);
|
||||
|
||||
// 3. Get Web Sentiment
|
||||
List<String> social = sentimentService.getWebSentiment(symbol);
|
||||
|
||||
// 4. Get Market Context
|
||||
MarketContextData marketContextData = stockDataService.getMarketContext();
|
||||
MarketContext marketContext = null;
|
||||
if (marketContextData != null) {
|
||||
marketContext = new MarketContext(
|
||||
marketContextData.symbol(),
|
||||
marketContextData.changePercent(),
|
||||
marketContextData.price());
|
||||
}
|
||||
|
||||
// 5. Prepare data for LLM
|
||||
Map<String, Object> stockDataMap = new HashMap<>();
|
||||
stockDataMap.put("symbol", symbol);
|
||||
stockDataMap.put("currentPrice", stockInfo.currentPrice());
|
||||
stockDataMap.put("changePercent", stockInfo.changePercent());
|
||||
stockDataMap.put("fundamentals", stockInfo.fundamentals());
|
||||
stockDataMap.put("technicals", stockInfo.technicals());
|
||||
|
||||
Map<String, Object> marketContextMap = null;
|
||||
if (marketContextData != null) {
|
||||
marketContextMap = new HashMap<>();
|
||||
marketContextMap.put("symbol", marketContextData.symbol());
|
||||
marketContextMap.put("changePercent", marketContextData.changePercent());
|
||||
marketContextMap.put("price", marketContextData.price());
|
||||
}
|
||||
|
||||
// 6. LLM Analysis - Both providers
|
||||
LLMAnalysis llmResultOpenai = llmService.analyzeWithLLM(stockDataMap, news, social, marketContextMap, "openai");
|
||||
LLMAnalysis llmResultAnthropic = llmService.analyzeWithLLM(stockDataMap, news, social, marketContextMap,
|
||||
"anthropic");
|
||||
|
||||
// 7. Calculate dates
|
||||
Instant now = Instant.now();
|
||||
String dateStr = now.atZone(ZoneOffset.UTC).toLocalDate().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
String targetDate = calculateTargetDate(now);
|
||||
|
||||
// 8. Build result
|
||||
Map<String, Object> fundamentalsMap = stockInfo.fundamentals();
|
||||
Fundamentals fundamentals = new Fundamentals(
|
||||
String.valueOf(fundamentalsMap.getOrDefault("pe_ratio", "N/A")),
|
||||
String.valueOf(fundamentalsMap.getOrDefault("market_cap", "N/A")),
|
||||
String.valueOf(fundamentalsMap.getOrDefault("high_52w", "N/A")),
|
||||
String.valueOf(fundamentalsMap.getOrDefault("low_52w", "N/A")),
|
||||
String.valueOf(fundamentalsMap.getOrDefault("target_mean_price", "N/A")),
|
||||
String.valueOf(fundamentalsMap.getOrDefault("recommendation_key", "N/A")));
|
||||
|
||||
Map<String, Object> technicalsMap = stockInfo.technicals();
|
||||
Technicals technicals = new Technicals(
|
||||
String.valueOf(technicalsMap.getOrDefault("sma_20", "N/A")),
|
||||
String.valueOf(technicalsMap.getOrDefault("rsi", "N/A")));
|
||||
|
||||
return AnalysisResult.builder()
|
||||
.isin(isin)
|
||||
.symbol(symbol)
|
||||
.price(stockInfo.currentPrice())
|
||||
.changePercent(stockInfo.changePercent())
|
||||
.fundamentals(fundamentals)
|
||||
.technicals(technicals)
|
||||
.marketContext(marketContext)
|
||||
.newsHeadlines(news)
|
||||
.socialPosts(social)
|
||||
.llmAnalysisOpenai(llmResultOpenai)
|
||||
.llmAnalysisAnthropic(llmResultAnthropic)
|
||||
.analyzedAt(now)
|
||||
.date(dateStr)
|
||||
.targetDate(targetDate)
|
||||
.build();
|
||||
}
|
||||
|
||||
public void saveResult(AnalysisResult result) {
|
||||
// Upsert: update if exists for this ISIN and date, insert otherwise
|
||||
List<AnalysisResult> existingList = analysisResultRepository.findByIsinOrderByAnalyzedAtDesc(result.getIsin());
|
||||
|
||||
Optional<AnalysisResult> existing = existingList.stream()
|
||||
.filter(r -> r.getDate().equals(result.getDate()))
|
||||
.findFirst();
|
||||
|
||||
if (existing.isPresent()) {
|
||||
result.setId(existing.get().getId());
|
||||
analysisResultRepository.save(result);
|
||||
} else {
|
||||
analysisResultRepository.save(result);
|
||||
}
|
||||
}
|
||||
|
||||
private String calculateTargetDate(Instant instant) {
|
||||
LocalDate date = instant.atZone(ZoneOffset.UTC).toLocalDate();
|
||||
DayOfWeek dayOfWeek = date.getDayOfWeek();
|
||||
|
||||
long daysToAdd;
|
||||
switch (dayOfWeek) {
|
||||
case FRIDAY:
|
||||
daysToAdd = 3;
|
||||
break;
|
||||
case SATURDAY:
|
||||
daysToAdd = 2;
|
||||
break;
|
||||
case SUNDAY:
|
||||
daysToAdd = 1;
|
||||
break;
|
||||
default:
|
||||
daysToAdd = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return date.plusDays(daysToAdd).format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
}
|
||||
|
||||
private void updatePastResults(String isin, String symbol) {
|
||||
String today = LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
List<AnalysisResult> pastResults = analysisResultRepository.findByIsinAndRealPriceIsNullAndTargetDateLessThan(isin, today);
|
||||
|
||||
for (AnalysisResult result : pastResults) {
|
||||
try {
|
||||
Double price = stockDataService.getHistoricalPrice(symbol, result.getTargetDate());
|
||||
if (price != null) {
|
||||
result.setRealPrice(price);
|
||||
analysisResultRepository.save(result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to update past result for " + symbol + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 21600000) // 6 hours
|
||||
public void updateMissingRealPrices() {
|
||||
String today = LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
List<AnalysisResult> pendingResults = analysisResultRepository.findByRealPriceIsNullAndTargetDateLessThan(today);
|
||||
|
||||
for (AnalysisResult result : pendingResults) {
|
||||
try {
|
||||
Double price = stockDataService.getHistoricalPrice(result.getSymbol(), result.getTargetDate());
|
||||
if (price != null) {
|
||||
result.setRealPrice(price);
|
||||
analysisResultRepository.save(result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("Failed to update real price for " + result.getSymbol() + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.stockanalyzer.service;
|
||||
|
||||
import com.stockanalyzer.model.AnalysisJob;
|
||||
import com.stockanalyzer.model.AnalysisResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class JobProcessor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JobProcessor.class);
|
||||
|
||||
private final JobService jobService;
|
||||
private final AnalysisService analysisService;
|
||||
|
||||
public JobProcessor(JobService jobService, AnalysisService analysisService) {
|
||||
this.jobService = jobService;
|
||||
this.analysisService = analysisService;
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 2000) // Poll every 2 seconds
|
||||
public void processJobs() {
|
||||
List<AnalysisJob> pendingJobs = jobService.getPendingJobs();
|
||||
|
||||
for (AnalysisJob job : pendingJobs) {
|
||||
try {
|
||||
logger.info("Starting analysis for job: {} (Stock: {})", job.getId(), job.getSymbol());
|
||||
jobService.startJob(job);
|
||||
|
||||
AnalysisResult result = analysisService.analyzeStock(job.getIsin());
|
||||
analysisService.saveResult(result);
|
||||
|
||||
jobService.completeJob(job);
|
||||
logger.info("Completed analysis for job: {}", job.getId());
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to process job: " + job.getId(), e);
|
||||
jobService.failJob(job, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.stockanalyzer.service;
|
||||
|
||||
import com.stockanalyzer.model.AnalysisJob;
|
||||
import com.stockanalyzer.repository.AnalysisJobRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class JobService {
|
||||
|
||||
private final AnalysisJobRepository jobRepository;
|
||||
|
||||
public JobService(AnalysisJobRepository jobRepository) {
|
||||
this.jobRepository = jobRepository;
|
||||
}
|
||||
|
||||
public AnalysisJob createJob(String isin, String symbol) {
|
||||
AnalysisJob job = new AnalysisJob(isin, symbol);
|
||||
return jobRepository.save(job);
|
||||
}
|
||||
|
||||
public List<AnalysisJob> getAllJobs() {
|
||||
return jobRepository.findAll();
|
||||
}
|
||||
|
||||
public List<AnalysisJob> getPendingJobs() {
|
||||
return jobRepository.findByStatus(AnalysisJob.JobStatus.PENDING);
|
||||
}
|
||||
|
||||
public boolean hasPendingOrProcessingJob(String isin) {
|
||||
return jobRepository.existsByIsinAndStatus(isin, AnalysisJob.JobStatus.PENDING) ||
|
||||
jobRepository.existsByIsinAndStatus(isin, AnalysisJob.JobStatus.PROCESSING);
|
||||
}
|
||||
|
||||
public void startJob(AnalysisJob job) {
|
||||
job.setStatus(AnalysisJob.JobStatus.PROCESSING);
|
||||
job.setStartedAt(LocalDateTime.now());
|
||||
jobRepository.save(job);
|
||||
}
|
||||
|
||||
public void completeJob(AnalysisJob job) {
|
||||
job.setStatus(AnalysisJob.JobStatus.COMPLETED);
|
||||
job.setCompletedAt(LocalDateTime.now());
|
||||
jobRepository.save(job);
|
||||
}
|
||||
|
||||
public void failJob(AnalysisJob job, String error) {
|
||||
job.setStatus(AnalysisJob.JobStatus.FAILED);
|
||||
job.setError(error);
|
||||
job.setCompletedAt(LocalDateTime.now());
|
||||
jobRepository.save(job);
|
||||
}
|
||||
|
||||
public void deleteAllJobs() {
|
||||
jobRepository.deleteAll();
|
||||
}
|
||||
|
||||
public void cancelAllJobs() {
|
||||
List<AnalysisJob> pendingJobs = jobRepository.findByStatus(AnalysisJob.JobStatus.PENDING);
|
||||
List<AnalysisJob> processingJobs = jobRepository.findByStatus(AnalysisJob.JobStatus.PROCESSING);
|
||||
|
||||
for (AnalysisJob job : pendingJobs) {
|
||||
job.setStatus(AnalysisJob.JobStatus.CANCELLED);
|
||||
job.setCompletedAt(LocalDateTime.now());
|
||||
jobRepository.save(job);
|
||||
}
|
||||
|
||||
for (AnalysisJob job : processingJobs) {
|
||||
job.setStatus(AnalysisJob.JobStatus.CANCELLED);
|
||||
job.setCompletedAt(LocalDateTime.now());
|
||||
jobRepository.save(job);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
package com.stockanalyzer.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.stockanalyzer.model.AnalysisResult.LLMAnalysis;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class LLMService {
|
||||
|
||||
@Value("${api.openai.key}")
|
||||
private String openaiApiKey;
|
||||
|
||||
@Value("${api.openai.model}")
|
||||
private String openaiModel;
|
||||
|
||||
@Value("${api.anthropic.key}")
|
||||
private String anthropicApiKey;
|
||||
|
||||
@Value("${api.anthropic.model}")
|
||||
private String anthropicModel;
|
||||
|
||||
private final OkHttpClient httpClient;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final MediaType jsonMediaType = MediaType.parse("application/json");
|
||||
|
||||
public LLMService(ObjectMapper objectMapper) {
|
||||
this.httpClient = new OkHttpClient();
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public LLMAnalysis analyzeWithLLM(
|
||||
Map<String, Object> stockData,
|
||||
List<String> newsData,
|
||||
List<String> socialData,
|
||||
Map<String, Object> marketContext,
|
||||
String provider) {
|
||||
String prompt = buildPrompt(stockData, newsData, socialData, marketContext);
|
||||
|
||||
switch (provider.toLowerCase()) {
|
||||
case "openai":
|
||||
return analyzeWithOpenAI(prompt);
|
||||
case "anthropic":
|
||||
return analyzeWithAnthropic(prompt);
|
||||
default:
|
||||
return new LLMAnalysis("", 0, "", "Unknown provider: " + provider);
|
||||
}
|
||||
}
|
||||
|
||||
private String buildPrompt(
|
||||
Map<String, Object> stockData,
|
||||
List<String> newsData,
|
||||
List<String> socialData,
|
||||
Map<String, Object> marketContext) {
|
||||
String symbol = (String) stockData.getOrDefault("symbol", "Unknown");
|
||||
Object price = stockData.getOrDefault("currentPrice", "Unknown");
|
||||
Object change = stockData.getOrDefault("changePercent", 0.0);
|
||||
|
||||
Map<?, ?> fundamentals = (Map<?, ?>) stockData.getOrDefault("fundamentals", Collections.emptyMap());
|
||||
Map<?, ?> technicals = (Map<?, ?>) stockData.getOrDefault("technicals", Collections.emptyMap());
|
||||
|
||||
String marketChange = "N/A";
|
||||
if (marketContext != null) {
|
||||
marketChange = String.valueOf(marketContext.getOrDefault("changePercent", "N/A"));
|
||||
}
|
||||
|
||||
return """
|
||||
You are a financial analyst. Analyze the following data for stock %s:
|
||||
|
||||
Current Price: %s
|
||||
Recent Change: %s%%
|
||||
|
||||
Fundamentals:
|
||||
- P/E Ratio: %s
|
||||
- Market Cap: %s
|
||||
- 52W High: %s
|
||||
- Analyst Target: %s
|
||||
- Analyst Rating: %s
|
||||
|
||||
Market Context (S&P 500):
|
||||
- Change (24h): %s%%
|
||||
|
||||
Technicals:
|
||||
- RSI (14): %s
|
||||
- SMA (20): %s
|
||||
|
||||
Recent News Headlines:
|
||||
%s
|
||||
|
||||
Recent Web Discussions & Sentiment:
|
||||
%s
|
||||
|
||||
Task:
|
||||
Predict the probability (0-100%%) of the stock rising in the next 24 hours.
|
||||
Provide a concise reasoning (max 3 sentences).
|
||||
|
||||
Output Format:
|
||||
Return ONLY a JSON object with the following keys:
|
||||
{
|
||||
"prediction": "Rise" or "Fall",
|
||||
"probability": <int 0-100>,
|
||||
"reasoning": "<string>"
|
||||
}
|
||||
""".formatted(
|
||||
symbol,
|
||||
price,
|
||||
change,
|
||||
fundamentals.get("pe_ratio"),
|
||||
fundamentals.get("market_cap"),
|
||||
fundamentals.get("high_52w"),
|
||||
fundamentals.get("target_mean_price"),
|
||||
fundamentals.get("recommendation_key"),
|
||||
marketChange,
|
||||
technicals.get("rsi"),
|
||||
technicals.get("sma_20"),
|
||||
String.join("\n", newsData),
|
||||
String.join("\n", socialData));
|
||||
}
|
||||
|
||||
private LLMAnalysis analyzeWithOpenAI(String prompt) {
|
||||
if (openaiApiKey == null || openaiApiKey.isBlank()) {
|
||||
return new LLMAnalysis("", 0, "", "OpenAI API Key missing");
|
||||
}
|
||||
|
||||
try {
|
||||
Map<String, Object> requestMap = Map.of(
|
||||
"model", openaiModel,
|
||||
"messages", List.of(
|
||||
Map.of("role", "system", "content",
|
||||
"You are a helpful financial assistant. Always return valid JSON."),
|
||||
Map.of("role", "user", "content", prompt)),
|
||||
"response_format", Map.of("type", "json_object"));
|
||||
|
||||
String requestBodyString = objectMapper.writeValueAsString(requestMap);
|
||||
RequestBody requestBody = RequestBody.create(requestBodyString, jsonMediaType);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.openai.com/v1/chat/completions")
|
||||
.header("Authorization", "Bearer " + openaiApiKey)
|
||||
.header("Content-Type", "application/json")
|
||||
.post(requestBody)
|
||||
.build();
|
||||
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
if (!response.isSuccessful() || response.body() == null) {
|
||||
return new LLMAnalysis("", 0, "", "OpenAI API error: " + response.code());
|
||||
}
|
||||
|
||||
JsonNode json = objectMapper.readTree(response.body().string());
|
||||
JsonNode choices = json.get("choices");
|
||||
if (choices != null && choices.size() > 0) {
|
||||
JsonNode message = choices.get(0).get("message");
|
||||
if (message != null && message.has("content")) {
|
||||
return parseLLMResponse(message.get("content").asText());
|
||||
}
|
||||
}
|
||||
return new LLMAnalysis("", 0, "", "No response from OpenAI");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return new LLMAnalysis("", 0, "", "Error during OpenAI analysis: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private LLMAnalysis analyzeWithAnthropic(String prompt) {
|
||||
if (anthropicApiKey == null || anthropicApiKey.isBlank()) {
|
||||
return new LLMAnalysis("", 0, "", "Anthropic API Key missing");
|
||||
}
|
||||
|
||||
try {
|
||||
Map<String, Object> requestMap = Map.of(
|
||||
"model", anthropicModel,
|
||||
"max_tokens", 1024,
|
||||
"messages", List.of(
|
||||
Map.of("role", "user", "content", prompt)));
|
||||
|
||||
String requestBodyString = objectMapper.writeValueAsString(requestMap);
|
||||
RequestBody requestBody = RequestBody.create(requestBodyString, jsonMediaType);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.anthropic.com/v1/messages")
|
||||
.header("x-api-key", anthropicApiKey)
|
||||
.header("anthropic-version", "2023-06-01")
|
||||
.header("Content-Type", "application/json")
|
||||
.post(requestBody)
|
||||
.build();
|
||||
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
if (!response.isSuccessful() || response.body() == null) {
|
||||
return new LLMAnalysis("", 0, "", "Anthropic API error: " + response.code());
|
||||
}
|
||||
|
||||
JsonNode json = objectMapper.readTree(response.body().string());
|
||||
JsonNode contentNode = json.get("content");
|
||||
if (contentNode != null && contentNode.size() > 0) {
|
||||
JsonNode textNode = contentNode.get(0).get("text");
|
||||
if (textNode != null) {
|
||||
return parseLLMResponse(textNode.asText());
|
||||
}
|
||||
}
|
||||
return new LLMAnalysis("", 0, "", "No response from Anthropic");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return new LLMAnalysis("", 0, "", "Error during Anthropic analysis: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private LLMAnalysis parseLLMResponse(String content) {
|
||||
try {
|
||||
String cleanContent = content.trim();
|
||||
|
||||
// Remove markdown code blocks if present
|
||||
if (cleanContent.startsWith("```json")) {
|
||||
cleanContent = cleanContent.replace("```json", "").replace("```", "").trim();
|
||||
} else if (cleanContent.startsWith("```")) {
|
||||
cleanContent = cleanContent.replace("```", "").trim();
|
||||
}
|
||||
|
||||
JsonNode json = objectMapper.readTree(cleanContent);
|
||||
return new LLMAnalysis(
|
||||
json.has("prediction") ? json.get("prediction").asText() : "",
|
||||
json.has("probability") ? json.get("probability").asInt() : 0,
|
||||
json.has("reasoning") ? json.get("reasoning").asText() : "",
|
||||
null);
|
||||
} catch (Exception e) {
|
||||
return new LLMAnalysis("", 0, "", "Failed to parse LLM response: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.stockanalyzer.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class NewsService {
|
||||
|
||||
@Value("${api.news.key}")
|
||||
private String newsApiKey;
|
||||
|
||||
private final OkHttpClient httpClient;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public NewsService(ObjectMapper objectMapper) {
|
||||
this.httpClient = new OkHttpClient();
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public List<String> getNews(String query) {
|
||||
if (newsApiKey == null || newsApiKey.isBlank()) {
|
||||
return Collections.singletonList("News API Key missing");
|
||||
}
|
||||
|
||||
try {
|
||||
String url = "https://newsapi.org/v2/everything?q=" + query + "&apiKey=" + newsApiKey
|
||||
+ "&language=en&sortBy=publishedAt&pageSize=5";
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
if (!response.isSuccessful() || response.body() == null) {
|
||||
return Collections.singletonList("Error fetching news: " + response.code());
|
||||
}
|
||||
|
||||
JsonNode json = objectMapper.readTree(response.body().string());
|
||||
JsonNode articles = json.get("articles");
|
||||
|
||||
if (articles != null && articles.size() > 0) {
|
||||
List<String> newsList = new ArrayList<>();
|
||||
for (JsonNode article : articles) {
|
||||
String title = article.has("title") ? article.get("title").asText() : "";
|
||||
String source = "";
|
||||
if (article.has("source") && article.get("source").has("name")) {
|
||||
source = article.get("source").get("name").asText();
|
||||
}
|
||||
newsList.add(title + " - " + source);
|
||||
}
|
||||
return newsList;
|
||||
} else {
|
||||
return Collections.singletonList("No news found");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return Collections.singletonList("Error fetching news: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.stockanalyzer.service;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SentimentService {
|
||||
|
||||
private final OkHttpClient httpClient;
|
||||
|
||||
public SentimentService() {
|
||||
this.httpClient = new OkHttpClient();
|
||||
}
|
||||
|
||||
public List<String> getWebSentiment(String query) {
|
||||
try {
|
||||
// Use DuckDuckGo HTML search
|
||||
String searchQuery = query + " stock sentiment news discussion site:reddit.com OR site:finance.yahoo.com";
|
||||
String encodedQuery = URLEncoder.encode(searchQuery, StandardCharsets.UTF_8);
|
||||
String url = "https://html.duckduckgo.com/html/?q=" + encodedQuery;
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36")
|
||||
.build();
|
||||
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
if (!response.isSuccessful() || response.body() == null) {
|
||||
return Collections.singletonList("Error fetching web sentiment: " + response.code());
|
||||
}
|
||||
|
||||
String html = response.body().string();
|
||||
Document doc = Jsoup.parse(html);
|
||||
|
||||
// Extract search results
|
||||
List<String> results = new ArrayList<>();
|
||||
Elements resultElements = doc.select(".result__body");
|
||||
|
||||
for (Element element : resultElements.subList(0, Math.min(resultElements.size(), 10))) {
|
||||
Element titleEl = element.selectFirst(".result__title");
|
||||
Element snippetEl = element.selectFirst(".result__snippet");
|
||||
|
||||
String title = titleEl != null ? titleEl.text() : "";
|
||||
String snippet = snippetEl != null ? snippetEl.text() : "";
|
||||
|
||||
if (!title.isBlank() && !snippet.isBlank()) {
|
||||
results.add(title + ": " + snippet);
|
||||
}
|
||||
}
|
||||
|
||||
if (results.isEmpty()) {
|
||||
return Collections.singletonList("No recent web discussions found.");
|
||||
} else {
|
||||
return results;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return Collections.singletonList("Error fetching web sentiment: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,368 @@
|
||||
package com.stockanalyzer.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class StockDataService {
|
||||
|
||||
private final OkHttpClient httpClient;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public StockDataService(ObjectMapper objectMapper) {
|
||||
this.httpClient = new OkHttpClient();
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
public record StockData(
|
||||
String symbol,
|
||||
Double currentPrice,
|
||||
Double changePercent,
|
||||
Map<String, Object> fundamentals,
|
||||
Map<String, Object> technicals,
|
||||
String error) {
|
||||
}
|
||||
|
||||
public record MarketContextData(
|
||||
String symbol,
|
||||
Double changePercent,
|
||||
Double price) {
|
||||
}
|
||||
|
||||
public String getTickerFromIsin(String isin) {
|
||||
String url = "https://query2.finance.yahoo.com/v1/finance/search?q=" + isin;
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.header("User-Agent", "Mozilla/5.0")
|
||||
.build();
|
||||
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
JsonNode json = objectMapper.readTree(response.body().string());
|
||||
JsonNode quotes = json.get("quotes");
|
||||
if (quotes != null && quotes.size() > 0) {
|
||||
JsonNode symbolNode = quotes.get(0).get("symbol");
|
||||
return symbolNode != null ? symbolNode.asText() : isin;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error resolving ISIN " + isin + ": " + e.getMessage());
|
||||
}
|
||||
return isin;
|
||||
}
|
||||
|
||||
public StockData getStockPrice(String isin) {
|
||||
String tickerSymbol = getTickerFromIsin(isin);
|
||||
System.out.println("Resolved " + isin + " to " + tickerSymbol);
|
||||
|
||||
try {
|
||||
String quoteUrl = "https://query1.finance.yahoo.com/v8/finance/chart/" + tickerSymbol
|
||||
+ "?interval=1d&range=1mo";
|
||||
Request request = new Request.Builder()
|
||||
.url(quoteUrl)
|
||||
.header("User-Agent", "Mozilla/5.0")
|
||||
.build();
|
||||
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
if (!response.isSuccessful() || response.body() == null) {
|
||||
return new StockData("", 0.0, 0.0, Collections.emptyMap(), Collections.emptyMap(),
|
||||
"Failed to fetch data");
|
||||
}
|
||||
|
||||
JsonNode json = objectMapper.readTree(response.body().string());
|
||||
JsonNode chart = json.get("chart");
|
||||
if (chart == null)
|
||||
return new StockData("", 0.0, 0.0, Collections.emptyMap(), Collections.emptyMap(), "No data found");
|
||||
|
||||
JsonNode resultNode = chart.get("result");
|
||||
if (resultNode == null || resultNode.size() == 0) {
|
||||
return new StockData("", 0.0, 0.0, Collections.emptyMap(), Collections.emptyMap(), "No data found");
|
||||
}
|
||||
|
||||
JsonNode result = resultNode.get(0);
|
||||
JsonNode meta = result.get("meta");
|
||||
|
||||
double currentPrice = meta.has("regularMarketPrice") ? meta.get("regularMarketPrice").asDouble() : 0.0;
|
||||
double previousClose = meta.has("chartPreviousClose") ? meta.get("chartPreviousClose").asDouble()
|
||||
: currentPrice;
|
||||
double changePercent = ((currentPrice - previousClose) / previousClose) * 100;
|
||||
|
||||
// Technicals
|
||||
JsonNode indicators = result.get("indicators");
|
||||
JsonNode quote = indicators != null ? indicators.get("quote") : null;
|
||||
JsonNode closes = (quote != null && quote.size() > 0) ? quote.get(0).get("close") : null;
|
||||
|
||||
Map<String, Object> technicals;
|
||||
if (closes != null && closes.size() > 0) {
|
||||
technicals = calculateTechnicals(closes);
|
||||
} else {
|
||||
technicals = Map.of("sma_20", "N/A", "rsi", "N/A");
|
||||
}
|
||||
|
||||
// Fundamentals
|
||||
Map<String, Object> fundamentals = getFundamentals(tickerSymbol);
|
||||
|
||||
return new StockData(
|
||||
tickerSymbol,
|
||||
currentPrice,
|
||||
changePercent,
|
||||
fundamentals,
|
||||
technicals,
|
||||
null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return new StockData("", 0.0, 0.0, Collections.emptyMap(), Collections.emptyMap(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> getFundamentals(String symbol) {
|
||||
try {
|
||||
String url = "https://query1.finance.yahoo.com/v10/finance/quoteSummary/" + symbol
|
||||
+ "?modules=financialData,defaultKeyStatistics,price";
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.header("User-Agent", "Mozilla/5.0")
|
||||
.build();
|
||||
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
if (!response.isSuccessful() || response.body() == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
JsonNode json = objectMapper.readTree(response.body().string());
|
||||
JsonNode quoteSummary = json.get("quoteSummary");
|
||||
if (quoteSummary == null)
|
||||
return Collections.emptyMap();
|
||||
|
||||
JsonNode resultNode = quoteSummary.get("result");
|
||||
if (resultNode == null || resultNode.size() == 0)
|
||||
return Collections.emptyMap();
|
||||
|
||||
JsonNode result = resultNode.get(0);
|
||||
JsonNode financialData = result.get("financialData");
|
||||
JsonNode keyStats = result.get("defaultKeyStatistics");
|
||||
JsonNode price = result.get("price");
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pe_ratio", safelyGet(keyStats, "trailingPE", "raw"));
|
||||
map.put("market_cap", safelyGet(price, "marketCap", "raw"));
|
||||
map.put("high_52w", safelyGet(keyStats, "fiftyTwoWeekHigh", "raw"));
|
||||
map.put("low_52w", safelyGet(keyStats, "fiftyTwoWeekLow", "raw"));
|
||||
map.put("target_mean_price", safelyGet(financialData, "targetMeanPrice", "raw"));
|
||||
|
||||
String recommendationKey = "N/A";
|
||||
if (financialData != null && financialData.has("recommendationKey")) {
|
||||
recommendationKey = financialData.get("recommendationKey").asText();
|
||||
}
|
||||
map.put("recommendation_key", recommendationKey);
|
||||
|
||||
return map;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error fetching fundamentals: " + e.getMessage());
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
}
|
||||
|
||||
private String safelyGet(JsonNode node, String key, String subKey) {
|
||||
if (node == null || !node.has(key))
|
||||
return "N/A";
|
||||
JsonNode subNode = node.get(key);
|
||||
if (subNode == null || !subNode.has(subKey))
|
||||
return "N/A";
|
||||
return subNode.get(subKey).asText();
|
||||
}
|
||||
|
||||
private Map<String, Object> calculateTechnicals(JsonNode closes) {
|
||||
List<Double> closesList = new ArrayList<>();
|
||||
for (int i = 0; i < closes.size(); i++) {
|
||||
JsonNode close = closes.get(i);
|
||||
if (close != null && !close.isNull()) {
|
||||
closesList.add(close.asDouble());
|
||||
}
|
||||
}
|
||||
|
||||
if (closesList.isEmpty()) {
|
||||
return Map.of("sma_20", "N/A", "rsi", "N/A");
|
||||
}
|
||||
|
||||
// SMA 20
|
||||
String sma20 = "N/A";
|
||||
if (closesList.size() >= 20) {
|
||||
double sum = 0;
|
||||
for (int i = closesList.size() - 20; i < closesList.size(); i++) {
|
||||
sum += closesList.get(i);
|
||||
}
|
||||
sma20 = String.valueOf(sum / 20);
|
||||
}
|
||||
|
||||
// RSI 14
|
||||
String rsi = "N/A";
|
||||
if (closesList.size() >= 15) {
|
||||
rsi = String.valueOf(calculateRSI(closesList, 14));
|
||||
}
|
||||
|
||||
return Map.of("sma_20", sma20, "rsi", rsi);
|
||||
}
|
||||
|
||||
private double calculateRSI(List<Double> prices, int period) {
|
||||
if (prices.size() < period + 1)
|
||||
return 0.0;
|
||||
|
||||
List<Double> changes = new ArrayList<>();
|
||||
for (int i = 1; i < prices.size(); i++) {
|
||||
changes.add(prices.get(i) - prices.get(i - 1));
|
||||
}
|
||||
|
||||
List<Double> gains = new ArrayList<>();
|
||||
List<Double> losses = new ArrayList<>();
|
||||
|
||||
for (Double change : changes) {
|
||||
if (change > 0) {
|
||||
gains.add(change);
|
||||
losses.add(0.0);
|
||||
} else {
|
||||
gains.add(0.0);
|
||||
losses.add(Math.abs(change));
|
||||
}
|
||||
}
|
||||
|
||||
// Initial average
|
||||
double avgGain = 0;
|
||||
double avgLoss = 0;
|
||||
|
||||
// Use simple average for the first period (standard RSI calculation usually
|
||||
// uses simple average for first step then smoothing)
|
||||
// But the Kotlin code used takeLast(period).average() which is a simple moving
|
||||
// average of the LAST period.
|
||||
// I will replicate the Kotlin logic: "val avgGain =
|
||||
// gains.takeLast(period).average()"
|
||||
|
||||
int startIndex = gains.size() - period;
|
||||
if (startIndex < 0)
|
||||
startIndex = 0; // Should not happen due to check above
|
||||
|
||||
double sumGain = 0;
|
||||
double sumLoss = 0;
|
||||
|
||||
for (int i = startIndex; i < gains.size(); i++) {
|
||||
sumGain += gains.get(i);
|
||||
sumLoss += losses.get(i);
|
||||
}
|
||||
|
||||
avgGain = sumGain / period;
|
||||
avgLoss = sumLoss / period;
|
||||
|
||||
if (avgLoss == 0.0)
|
||||
return 100.0;
|
||||
|
||||
double rs = avgGain / avgLoss;
|
||||
return 100 - (100 / (1 + rs));
|
||||
}
|
||||
|
||||
public MarketContextData getMarketContext() {
|
||||
try {
|
||||
String url = "https://query1.finance.yahoo.com/v8/finance/chart/%5EGSPC?interval=1d&range=5d";
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.header("User-Agent", "Mozilla/5.0")
|
||||
.build();
|
||||
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
if (!response.isSuccessful() || response.body() == null)
|
||||
return null;
|
||||
|
||||
JsonNode json = objectMapper.readTree(response.body().string());
|
||||
JsonNode chart = json.get("chart");
|
||||
if (chart == null)
|
||||
return null;
|
||||
JsonNode resultNode = chart.get("result");
|
||||
if (resultNode == null || resultNode.size() == 0)
|
||||
return null;
|
||||
|
||||
JsonNode result = resultNode.get(0);
|
||||
JsonNode indicators = result.get("indicators");
|
||||
JsonNode quote = indicators != null ? indicators.get("quote") : null;
|
||||
JsonNode closes = (quote != null && quote.size() > 0) ? quote.get(0).get("close") : null;
|
||||
|
||||
if (closes != null && closes.size() >= 2) {
|
||||
double current = closes.get(closes.size() - 1).asDouble();
|
||||
double prev = closes.get(closes.size() - 2).asDouble();
|
||||
double change = ((current - prev) / prev) * 100;
|
||||
|
||||
return new MarketContextData("^GSPC", change, current);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error fetching market context: " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Double getHistoricalPrice(String symbol, String dateStr) {
|
||||
try {
|
||||
LocalDate date = LocalDate.parse(dateStr, DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
// Use UTC start of day for periods
|
||||
long period1 = date.minusDays(5).atStartOfDay(java.time.ZoneOffset.UTC).toEpochSecond();
|
||||
long period2 = date.plusDays(5).atStartOfDay(java.time.ZoneOffset.UTC).toEpochSecond();
|
||||
|
||||
String url = "https://query1.finance.yahoo.com/v8/finance/chart/" + symbol +
|
||||
"?interval=1d&period1=" + period1 +
|
||||
"&period2=" + period2;
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.header("User-Agent", "Mozilla/5.0")
|
||||
.build();
|
||||
|
||||
try (Response response = httpClient.newCall(request).execute()) {
|
||||
if (!response.isSuccessful() || response.body() == null)
|
||||
return null;
|
||||
|
||||
JsonNode json = objectMapper.readTree(response.body().string());
|
||||
JsonNode chart = json.get("chart");
|
||||
if (chart == null)
|
||||
return null;
|
||||
JsonNode resultNode = chart.get("result");
|
||||
if (resultNode == null || resultNode.size() == 0)
|
||||
return null;
|
||||
|
||||
JsonNode result = resultNode.get(0);
|
||||
JsonNode timestamps = result.get("timestamp");
|
||||
JsonNode indicators = result.get("indicators");
|
||||
JsonNode quote = indicators != null ? indicators.get("quote") : null;
|
||||
JsonNode closes = (quote != null && quote.size() > 0) ? quote.get(0).get("close") : null;
|
||||
|
||||
if (timestamps != null && closes != null) {
|
||||
for (int i = 0; i < timestamps.size(); i++) {
|
||||
long ts = timestamps.get(i).asLong();
|
||||
// Convert timestamp to LocalDate in UTC to match targetDate logic
|
||||
LocalDate tsDate = java.time.Instant.ofEpochSecond(ts).atZone(java.time.ZoneOffset.UTC).toLocalDate();
|
||||
|
||||
if (tsDate.equals(date)) {
|
||||
JsonNode closeNode = closes.get(i);
|
||||
if (closeNode != null && !closeNode.isNull()) {
|
||||
return closeNode.asDouble();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error fetching historical price: " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
spring:
|
||||
application:
|
||||
name: stock-analyzer
|
||||
data:
|
||||
mongodb:
|
||||
uri: ${MONGO_URI:mongodb://localhost:27017/stock_analyzer}
|
||||
database: stock_analyzer
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
# API Keys (from environment variables)
|
||||
api:
|
||||
openai:
|
||||
key: ${OPENAI_API_KEY:}
|
||||
model: ${OPENAI_MODEL:gpt-4o}
|
||||
anthropic:
|
||||
key: ${ANTHROPIC_API_KEY:}
|
||||
model: ${ANTHROPIC_MODEL:claude-sonnet-4-5}
|
||||
news:
|
||||
key: ${NEWS_API_KEY:}
|
||||
|
||||
# CORS Configuration
|
||||
cors:
|
||||
allowed-origins: ${CORS_ORIGINS:http://localhost:5173,http://localhost:3000,http://localhost,http://127.0.0.1,http://192.168.178.42:3000}
|
||||
|
||||
# Logging
|
||||
logging:
|
||||
level:
|
||||
com.stockanalyzer: INFO
|
||||
org.springframework.data.mongodb: DEBUG
|
||||
Reference in new issue
Block a user