GainLoss Controller should call GLPriceCache.Refresh()
Some checks failed
Build .NET Project / build (push) Has been cancelled

This commit is contained in:
2026-02-27 11:31:51 -05:00
parent 6b632f5c4f
commit d2547e355c

View File

@@ -35,7 +35,7 @@ namespace MarketDataServer.Controllers
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
LocalPriceCache.GetInstance().Refresh();
GLPriceCache.GetInstance().Refresh();
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
PortfolioTrades tradesOnOrBefore = portfolioTrades.GetTradesOnOrBefore(selectedDate);
GainLossSummaryItemCollection gainLossSummaryItems = new GainLossSummaryItemCollection(tradesOnOrBefore, selectedDate);
@@ -82,7 +82,7 @@ namespace MarketDataServer.Controllers
try
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
LocalPriceCache.GetInstance().Refresh();
GLPriceCache.GetInstance().Refresh();
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
portfolioTrades=new PortfolioTrades(portfolioTrades.Where(x=>x.Account.Equals(account)).ToList());
@@ -138,7 +138,7 @@ namespace MarketDataServer.Controllers
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
LocalPriceCache.GetInstance().Refresh();
GLPriceCache.GetInstance().Refresh();
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
PortfolioTrades tradesOnOrBefore = portfolioTrades.GetTradesOnOrBefore(selectedDate);
GainLossSummaryItemCollection gainLossSummaryItems = new GainLossSummaryItemCollection(tradesOnOrBefore, selectedDate);
@@ -166,7 +166,7 @@ namespace MarketDataServer.Controllers
gainLossSummaryItemDetail.DividendYield = weightAdjustedDividendYield;
gainLossSummaryItemDetail.AnnualDividend = exposure * weightAdjustedDividendYield;
}
Prices prices = LocalPriceCache.GetInstance().GetPrices(gainLossSummaryItem.Symbol, currentDate, 3); // cache should be refreshed after GainLossSummaryItemCollection
Prices prices = GLPriceCache.GetInstance().GetPrices(gainLossSummaryItem.Symbol, currentDate, 3); // cache should be refreshed after GainLossSummaryItemCollection
Price p1 = prices.Count>0?prices[0]:default;
Price p2 = prices.Count>1?prices[1]:default;
PortfolioTrades symbolTrades = new PortfolioTrades(portfolioTrades.Where(x=>x.Symbol.Equals(gainLossSummaryItem.Symbol)).ToList());
@@ -234,7 +234,7 @@ namespace MarketDataServer.Controllers
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
LocalPriceCache.GetInstance().Refresh();
GLPriceCache.GetInstance().Refresh();
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
portfolioTrades = new PortfolioTrades(portfolioTrades.Where(x => x.Account.Equals(account)).ToList());
PortfolioTrades tradesOnOrBefore = portfolioTrades.GetTradesOnOrBefore(selectedDate);
@@ -263,7 +263,7 @@ namespace MarketDataServer.Controllers
gainLossSummaryItemDetail.DividendYield=weightAdjustedDividendYield;
gainLossSummaryItemDetail.AnnualDividend=exposure * weightAdjustedDividendYield;
}
Prices prices = LocalPriceCache.GetInstance().GetPrices(gainLossSummaryItem.Symbol, currentDate, 3); // cache should be refreshed after GainLossSummaryItemCollection
Prices prices = GLPriceCache.GetInstance().GetPrices(gainLossSummaryItem.Symbol, currentDate, 3); // cache should be refreshed after GainLossSummaryItemCollection
Price p1 = prices.Count>0?prices[0]:default;
Price p2 = prices.Count>1?prices[1]:default;
PortfolioTrades symbolTrades = new PortfolioTrades(portfolioTrades.Where(x=>x.Symbol.Equals(gainLossSummaryItem.Symbol)).ToList());
@@ -331,7 +331,7 @@ namespace MarketDataServer.Controllers
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if(!Authorizations.GetInstance().IsAuthorized(token)) return null;
LocalPriceCache.GetInstance().Refresh();
GLPriceCache.GetInstance().Refresh();
DividendPayments dividendPayments = null;
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
GainLossGenerator gainLossGenerator=new GainLossGenerator();