refactor(dotnet): normalize factor computation outputs
Validators (Pushes and Pull Requests) / validate-ui-and-storage (push) Successful in 16s
Validators (Pushes and Pull Requests) / validate-core (push) Failing after 1m41s

This commit is contained in:
2026-07-13 01:26:19 +09:00
parent d6a2dca9c8
commit e745cfb0ae
2 changed files with 26 additions and 0 deletions
@@ -42,6 +42,10 @@ public sealed class FactorComputationService
FactorOutputs outputs,
DateTimeOffset? observedAt = null)
{
ticker = RequireValue(ticker, nameof(ticker));
sourceVersion = RequireValue(sourceVersion, nameof(sourceVersion));
ArgumentNullException.ThrowIfNull(outputs);
var when = observedAt ?? DateTimeOffset.UtcNow;
await _history.AppendFactorOutputAsync("momentum_20d", sourceVersion, outputs.Momentum20D, "PASS", sourceVersion, when);
await _history.AppendFactorOutputAsync("momentum_60d", sourceVersion, outputs.Momentum60D, "PASS", sourceVersion, when);
@@ -52,4 +56,14 @@ public sealed class FactorComputationService
await _history.AppendFactorOutputAsync("rs_20d", sourceVersion, outputs.Rs20D, "PASS", sourceVersion, when);
_auditTrail.Append("factor_audit", ticker, new FactorComputationAudit(ticker, 0, 0, "PERSISTED", when, sourceVersion));
}
private static string RequireValue(string value, string parameterName)
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Value is required.", parameterName);
}
return value.Trim();
}
}