Add profiling to MarketDataServer controllers

This commit is contained in:
2025-04-27 10:55:25 -04:00
parent cebf9f63e6
commit 1c1c0c35f4
9 changed files with 161 additions and 32 deletions

View File

@@ -21,9 +21,10 @@ namespace MarketDataServer.Controllers
[HttpGet]
public IEnumerable<GainLossSummaryItem> GetGainLossByDate(String token,DateTime selectedDate)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLoss](String token, DateTime selectedDate)", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
LocalPriceCache.GetInstance().Refresh();
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
@@ -59,14 +60,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet]
public IEnumerable<GainLossSummaryItem> GetGainLossByDateAndAccount(String token,DateTime selectedDate,String account)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLoss](String token, DateTime selectedDate,String account)", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
LocalPriceCache.GetInstance().Refresh();
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
@@ -103,14 +109,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet]
public IEnumerable<GainLossSummaryItemDetail> GetGainLossWithDetailByDate(String token,DateTime selectedDate)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLossWithDetail](String token, DateTime selectedDate)", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
LocalPriceCache.GetInstance().Refresh();
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
@@ -197,14 +208,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet]
public IEnumerable<GainLossSummaryItemDetail> GetGainLossWithDetailByDateAndAccount(String token, DateTime selectedDate, String account)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetGainLossWithDetail](String token, DateTime selectedDate,String account)", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
LocalPriceCache.GetInstance().Refresh();
PortfolioTrades portfolioTrades = PortfolioDA.GetTrades();
@@ -292,14 +308,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetCompoundGainLoss")]
public GainLossCompoundModelCollection GetCompoundGainLoss(String token, int selectedDays, bool includeDividends)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][GainLossController::GetCompundGainLoss](String token, int days)", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if(!Authorizations.GetInstance().IsAuthorized(token)) return null;
LocalPriceCache.GetInstance().Refresh();
DividendPayments dividendPayments = null;
@@ -323,6 +344,10 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
}
}

View File

@@ -4,6 +4,7 @@ using MarketDataServer.Authorization;
using MarketData;
using LogLevel = MarketData.LogLevel;
using Microsoft.AspNetCore.Mvc;
using MarketData.Utils;
namespace MarketDataServer.Controllers
{
@@ -14,9 +15,10 @@ namespace MarketDataServer.Controllers
[HttpGet(Name = "GetLatestHeadlines")]
public IEnumerable<Headline> GetLatestHeadlines(String token)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][HeadlinesController::GetLatestHeadlines]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
return HeadlinesDA.GetLatestHeadlines();
}
@@ -25,14 +27,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetHeadlineDates")]
public IEnumerable<String> GetHeadlineDates(String token)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][HeadlinesController::GetHeadlineDates]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
List<string> headlineDates = HeadlinesDA.GetHeadlineDates();
if(headlineDates.Count>0)headlineDates=headlineDates.Take(252).ToList();
@@ -43,14 +50,18 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
} }
[HttpGet(Name = "GetHeadlines")]
public IEnumerable<Headline> GetHeadlines(String token,DateTime headlineDate)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][HeadlinesController::GetHeadliness(DateTime headlineDate)]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
return HeadlinesDA.GetHeadlines(headlineDate);
}
@@ -59,6 +70,9 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
} }
}
}

View File

@@ -1,4 +1,5 @@
using MarketData;
using MarketData.Utils;
using MarketDataServer.Authorization;
using Microsoft.AspNetCore.Mvc;
using LogLevel = MarketData.LogLevel;
@@ -12,20 +13,21 @@ namespace MarketDataServer.Controllers
[HttpGet(Name = "GetToken")]
public String GetToken(String user, String password)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][AuthorizationController::Authorize]",DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if(null==user)return null;
user=Authorizations.Xor(user,5);
password=Authorizations.Xor(password,5);
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][Login requested for user '{1}']",DateTime.Now, user));
MDTrace.WriteLine(LogLevel.DEBUG,$"Login requested for user '{user}'");
if(!Authorizations.GetInstance().IsValidUser(user, password))
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][User '{1}' is not authorized]", DateTime.Now,user));
MDTrace.WriteLine(LogLevel.DEBUG,$"User '{user}' is not authorized.");
return null;
}
String accessToken= Authorizations.GetInstance().GetAuthenticationToken();
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][Access token granted for user {1} : {2}]",DateTime.Now ,user, accessToken));
MDTrace.WriteLine(LogLevel.DEBUG,$"Access token granted for user {user} : {accessToken}.");
return accessToken;
}
catch(Exception exception)
@@ -33,6 +35,10 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
}
}

View File

@@ -1,4 +1,5 @@
using MarketData;
using MarketData.Utils;
using Microsoft.AspNetCore.Mvc;
using LogLevel = MarketData.LogLevel;
@@ -12,14 +13,18 @@ namespace MarketDataServer.Controllers
[HttpGet(Name = "GetPing")]
public bool GetPing()
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PingController::GetPing]", DateTime.Now));
Profiler profiler = new Profiler();
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
return true;
}
[HttpGet(Name = "GetSystemInfo")]
public String GetSystemInfo()
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PingController::GetSystemInfo]", DateTime.Now));
Profiler profiler = new Profiler();
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
return Environment.OSVersion.VersionString;
}
}

View File

@@ -5,6 +5,7 @@ using MarketData.Generator;
using MarketData;
using LogLevel = MarketData.LogLevel;
using Microsoft.AspNetCore.Mvc;
using MarketData.Utils;
namespace MarketDataServer.Controllers
{
@@ -20,9 +21,10 @@ namespace MarketDataServer.Controllers
[HttpGet(Name = "GetOpenPositionsWithDescription")]
public IEnumerable<PositionWithDescription> GetOpenPositionsWithDescription(String token)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PortfolioController::GetOpenPositionsWithDescriptionAsOf]",DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
List<PositionWithDescription> positionsWithDescription=new List<PositionWithDescription>();
PortfolioTrades openTrades=PortfolioDA.GetOpenTrades();
@@ -40,14 +42,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetAccounts")]
public IEnumerable<String> GetAccounts(String token)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PortfolioController::GetAccounts]",DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
return PortfolioDA.GetAccounts();
}
@@ -56,14 +63,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetAccountsWithOpenTrades")]
public IEnumerable<String> GetAccountsWithOpenTrades(String token)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PortfolioController::GetAccountsWithOpenTrades]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
return PortfolioDA.GetAccountsWithOpenTrades();
}
@@ -72,14 +84,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetStopLimit")]
public StopLimit GetStopLimit(String token,String symbol)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PortfolioController::GetStopLimit]",DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if(!Authorizations.GetInstance().IsAuthorized(token)) return null;
StopLimit stopLimit=PortfolioDA.GetStopLimit(symbol);
return stopLimit;
@@ -89,14 +106,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetPortfolioTradesWithParityPrice")]
public PortfolioTradesWithParityPrice GetPortfolioTradesWithParityPrice(String token, String symbol)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PortfolioController::GetPortfolioTradesWithParityPrice]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
Price zeroPrice=null;
DateTime latestPricingDate=PricingDA.GetLatestDate(symbol);
@@ -114,6 +136,10 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
}
}

View File

@@ -4,6 +4,7 @@ using MarketDataServer.Authorization;
using MarketData;
using LogLevel = MarketData.LogLevel;
using Microsoft.AspNetCore.Mvc;
using MarketData.Utils;
namespace MarketDataServer.Controllers
{
@@ -15,9 +16,10 @@ namespace MarketDataServer.Controllers
[HttpGet(Name = "GetAvailableMarketDates")]
public IEnumerable<DateTime> GetAvailableMarketDates(String token,String market)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PreMarketController::GetAvailableMarketDates]{1}",DateTime.Now,market));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if(!Authorizations.GetInstance().IsAuthorized(token)) return null;
return PremarketDA.GetAvailableMarketDates(market);
}
@@ -26,14 +28,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetAvailableMarkets")]
public IEnumerable<String> GetAvailableMarkets(String token)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PreMarketController::GetAvailableMarkets]",DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if(!Authorizations.GetInstance().IsAuthorized(token)) return null;
return PremarketDA.GetDistinctMarkets();
}
@@ -42,14 +49,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetLatestPremarketData")]
public IEnumerable<PremarketElement> GetLatestPremarketData(String token,String market,DateTime marketDate)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PreMarketController::GetLatestPremarketData]{1},{2}",DateTime.Now,market,marketDate.ToShortDateString()));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if(!Authorizations.GetInstance().IsAuthorized(token)) return null;
return PremarketDA.GetLatestPremarketData(market,marketDate);
}
@@ -58,6 +70,10 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
}
}

View File

@@ -20,9 +20,10 @@ namespace MarketDataServer.Controllers
[HttpGet(Name = "GetPrices")]
public IEnumerable<Price> GetPrices(String token, String symbol, int days)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PriceController::GetPrices]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
return PricingDA.GetPrices(symbol, days);
}
@@ -31,14 +32,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetBollingerBands")]
public BollingerBands GetBollingerBands(String token,String symbol,int dayCount)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PriceController::GetBollingerBands]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
Prices prices=PricingDA.GetPrices(symbol,dayCount);
BollingerBands bollingerBands=BollingerBandGenerator.GenerateBollingerBands(prices);
@@ -49,14 +55,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetLatestPricingDate")]
public DateTime GetLatestPricingDate(String token)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PriceController::GetLatestPricingDate]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return DateTime.MinValue;
DateTime latestPricingDate=PricingDA.GetLatestDate();
return latestPricingDate;
@@ -66,14 +77,19 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return Utility.Epoch;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetCompanyNameForSymbol")]
public String GetCompanyNameForSymbol(String token, String symbol)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PortfolioController::GetCompanyNameForSymbol]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
String companyName=PricingDA.GetNameForSymbol(symbol);
return companyName;
@@ -83,6 +99,10 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
}
}

View File

@@ -4,6 +4,7 @@ using MarketDataServer.Authorization;
using MarketData;
using Microsoft.AspNetCore.Mvc;
using LogLevel = MarketData.LogLevel;
using MarketData.Utils;
namespace MarketDataServer.Controllers
{
@@ -15,9 +16,10 @@ namespace MarketDataServer.Controllers
[HttpGet(Name = "GetDistinctPriceIndices")]
public IEnumerable<String> GetDistinctPriceIndices(String token)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PriceIndexController::GetDistinctPriceIndices]",DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
return ConsumerPriceIndexDA.GetDistinctIndices();
}
@@ -25,15 +27,20 @@ namespace MarketDataServer.Controllers
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
[HttpGet(Name = "GetConsumerPriceIndex")]
public IEnumerable<PriceIndex> GetConsumerPriceIndex(String token,String indexCode)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PriceIndexController::GetOpenPositionsWithDescriptionAsOf]",DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
PriceIndices priceIndices=ConsumerPriceIndexDA.GetConsumerPriceIndex(indexCode);
return priceIndices;
@@ -43,6 +50,10 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
}
}

View File

@@ -1,5 +1,6 @@
using MarketData;
using MarketData.DataAccess;
using MarketData.Utils;
using MarketDataServer.Authorization;
using Microsoft.AspNetCore.Mvc;
using LogLevel = MarketData.LogLevel;
@@ -13,9 +14,10 @@ namespace MarketDataServer.Controllers
[HttpGet(Name = "GetWatchList")]
public IEnumerable<String> GetWatchList(String token,String watchList)
{
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][WatchListController::GetWatchList]", DateTime.Now));
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
return WatchListDA.GetWatchList(watchList);
}
@@ -24,6 +26,10 @@ namespace MarketDataServer.Controllers
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
return null;
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
}
}
}
}