GainLoss Controller should call GLPriceCache.Refresh()
Some checks failed
Build .NET Project / build (push) Has been cancelled
Some checks failed
Build .NET Project / build (push) Has been cancelled
This commit is contained in:
@@ -35,7 +35,7 @@ namespace MarketDataServer.Controllers
|
|||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||||
LocalPriceCache.GetInstance().Refresh();
|
GLPriceCache.GetInstance().Refresh();
|
||||||
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
||||||
PortfolioTrades tradesOnOrBefore = portfolioTrades.GetTradesOnOrBefore(selectedDate);
|
PortfolioTrades tradesOnOrBefore = portfolioTrades.GetTradesOnOrBefore(selectedDate);
|
||||||
GainLossSummaryItemCollection gainLossSummaryItems = new GainLossSummaryItemCollection(tradesOnOrBefore, selectedDate);
|
GainLossSummaryItemCollection gainLossSummaryItems = new GainLossSummaryItemCollection(tradesOnOrBefore, selectedDate);
|
||||||
@@ -82,7 +82,7 @@ namespace MarketDataServer.Controllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||||
LocalPriceCache.GetInstance().Refresh();
|
GLPriceCache.GetInstance().Refresh();
|
||||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||||
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
||||||
portfolioTrades=new PortfolioTrades(portfolioTrades.Where(x=>x.Account.Equals(account)).ToList());
|
portfolioTrades=new PortfolioTrades(portfolioTrades.Where(x=>x.Account.Equals(account)).ToList());
|
||||||
@@ -138,7 +138,7 @@ namespace MarketDataServer.Controllers
|
|||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||||
LocalPriceCache.GetInstance().Refresh();
|
GLPriceCache.GetInstance().Refresh();
|
||||||
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
||||||
PortfolioTrades tradesOnOrBefore = portfolioTrades.GetTradesOnOrBefore(selectedDate);
|
PortfolioTrades tradesOnOrBefore = portfolioTrades.GetTradesOnOrBefore(selectedDate);
|
||||||
GainLossSummaryItemCollection gainLossSummaryItems = new GainLossSummaryItemCollection(tradesOnOrBefore, selectedDate);
|
GainLossSummaryItemCollection gainLossSummaryItems = new GainLossSummaryItemCollection(tradesOnOrBefore, selectedDate);
|
||||||
@@ -166,7 +166,7 @@ namespace MarketDataServer.Controllers
|
|||||||
gainLossSummaryItemDetail.DividendYield = weightAdjustedDividendYield;
|
gainLossSummaryItemDetail.DividendYield = weightAdjustedDividendYield;
|
||||||
gainLossSummaryItemDetail.AnnualDividend = exposure * 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 p1 = prices.Count>0?prices[0]:default;
|
||||||
Price p2 = prices.Count>1?prices[1]:default;
|
Price p2 = prices.Count>1?prices[1]:default;
|
||||||
PortfolioTrades symbolTrades = new PortfolioTrades(portfolioTrades.Where(x=>x.Symbol.Equals(gainLossSummaryItem.Symbol)).ToList());
|
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");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||||
LocalPriceCache.GetInstance().Refresh();
|
GLPriceCache.GetInstance().Refresh();
|
||||||
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
||||||
portfolioTrades = new PortfolioTrades(portfolioTrades.Where(x => x.Account.Equals(account)).ToList());
|
portfolioTrades = new PortfolioTrades(portfolioTrades.Where(x => x.Account.Equals(account)).ToList());
|
||||||
PortfolioTrades tradesOnOrBefore = portfolioTrades.GetTradesOnOrBefore(selectedDate);
|
PortfolioTrades tradesOnOrBefore = portfolioTrades.GetTradesOnOrBefore(selectedDate);
|
||||||
@@ -263,7 +263,7 @@ namespace MarketDataServer.Controllers
|
|||||||
gainLossSummaryItemDetail.DividendYield=weightAdjustedDividendYield;
|
gainLossSummaryItemDetail.DividendYield=weightAdjustedDividendYield;
|
||||||
gainLossSummaryItemDetail.AnnualDividend=exposure * 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 p1 = prices.Count>0?prices[0]:default;
|
||||||
Price p2 = prices.Count>1?prices[1]:default;
|
Price p2 = prices.Count>1?prices[1]:default;
|
||||||
PortfolioTrades symbolTrades = new PortfolioTrades(portfolioTrades.Where(x=>x.Symbol.Equals(gainLossSummaryItem.Symbol)).ToList());
|
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");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||||
if(!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
if(!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||||
LocalPriceCache.GetInstance().Refresh();
|
GLPriceCache.GetInstance().Refresh();
|
||||||
DividendPayments dividendPayments = null;
|
DividendPayments dividendPayments = null;
|
||||||
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
|
||||||
GainLossGenerator gainLossGenerator=new GainLossGenerator();
|
GainLossGenerator gainLossGenerator=new GainLossGenerator();
|
||||||
|
|||||||
Reference in New Issue
Block a user