using System.Collections.Generic; using System.Threading.Tasks; using QuantEngine.Core.Domain; using QuantEngine.Core.Interfaces; namespace QuantEngine.Application.Services { public class FormulaService { private readonly IPostgresqlHistoryStore _historyStore; public FormulaService(IPostgresqlHistoryStore historyStore) { _historyStore = historyStore; } public TimingDecisionResult ComputeTimingDecision(Dictionary ctx) => FormulaEngine.ComputeTimingDecision(ctx); public SellDecisionResult ComputeSellDecision(Dictionary ctx) => FormulaEngine.ComputeSellDecision(ctx); public FinalDecisionResult ComputeFinalDecision(Dictionary ctx) => FormulaEngine.ComputeFinalDecision(ctx); public CashShortfallResult ComputeCashShortfallHarness( Dictionary asResult, double totalAsset, Dictionary cashFloorInfo, double mrsScore) => FormulaEngine.ComputeCashShortfallHarness(asResult, totalAsset, cashFloorInfo, mrsScore); public CashRecoveryPlanResult ComputeCashRecoveryOptimizer( List> sellCandidates, double cashShortfallMinKrw) => FormulaEngine.ComputeCashRecoveryOptimizer(sellCandidates, cashShortfallMinKrw); public Task AppendFormulaRunAsync(string formulaName, Dictionary payload) => _historyStore.AppendAsync($"formula_{formulaName}_history", payload); } }