refactor(dotnet): normalize factor computation outputs
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user