Initial quant trader service baseline

This commit is contained in:
Codex
2026-06-23 22:09:06 +08:00
commit 7ff786f658
137 changed files with 6664 additions and 0 deletions
@@ -0,0 +1,48 @@
package com.quantai.trader.domain;
import com.quantai.trader.enums.TraderErrorCode;
import java.time.Instant;
import java.util.Map;
public record TraderDataSourceManifest(
String sourceId,
String symbol,
String sourceType,
String exchange,
String granularity,
String sourcePath,
String contentHashSha256,
String schemaHashSha256,
Instant dataFrom,
Instant dataTo,
Instant minEventTime,
Instant maxEventTime,
String timezone,
Long rowCount,
Map<String, Object> missingSummary,
String qualityStatus
) {
public TraderDataSourceManifest {
missingSummary = Maps.immutable(missingSummary);
boolean hasFullHash = contentHashSha256 != null && !contentHashSha256.isBlank();
boolean hasSchemaTrace = schemaHashSha256 != null
&& !schemaHashSha256.isBlank()
&& rowCount != null
&& minEventTime != null
&& maxEventTime != null;
if (sourceId == null || sourceId.isBlank() || sourcePath == null || sourcePath.isBlank()) {
throw new TraderException(TraderErrorCode.TRADER_DATA_SOURCE_MISSING, "data source id and path are required");
}
if (timezone == null || timezone.isBlank()) {
throw new TraderException(TraderErrorCode.TRADER_DATA_SOURCE_MISSING, "data source timezone is required");
}
if (!hasFullHash && !hasSchemaTrace) {
throw new TraderException(
TraderErrorCode.TRADER_DATA_SOURCE_MISSING,
"data source requires content hash or schema/row/time lineage"
);
}
}
}