WebServer controller changes along with JSON settings

This commit is contained in:
2025-04-07 15:41:19 -04:00
parent f39d50af89
commit a7627e3f22
8 changed files with 40 additions and 96 deletions

View File

@@ -69,7 +69,7 @@ namespace MarketData.Cache
DateTime maxDate=symbolPrices.MaxDate; // get the latest date in the cache
if(maxDbDates.ContainsKey(symbol) && !maxDbDates[symbol].Date.Equals(maxDate.Date)) // if the cache date and the database date are not equal then reload the cache
{
MDTrace.WriteLine(LogLevel.DEBUG,$"[LocalPriceCache] Cache date and Database date for {symbol} are not equal, reloading cache. Cache Date:{maxDate.ToShortDateString()} Database Date:{maxDbDates[symbol].Date.ToShortDateString()}");
// MDTrace.WriteLine(LogLevel.DEBUG,$"[LocalPriceCache] Cache date and Database date for {symbol} are not equal, reloading cache. Cache Date:{maxDate.ToShortDateString()} Database Date:{maxDbDates[symbol].Date.ToShortDateString()}");
Prices prices=PricingDA.GetPrices(symbol,symbolPrices.MinDate); // reload the prices for this symbol using the current minDate in the cache as a lower boundary
if(null==prices)continue; // if we can't load any prices for symbol then just continue
priceCache.Remove(symbol); // remove the pricing entries in the price cache for the symbol
@@ -77,7 +77,7 @@ namespace MarketData.Cache
}
else
{
MDTrace.WriteLine(LogLevel.DEBUG,$"[LocalPriceCache] Fetching latest price from database for {symbol} on {maxDate.ToShortDateString()}");
// MDTrace.WriteLine(LogLevel.DEBUG,$"[LocalPriceCache] Fetching latest price from database for {symbol} on {maxDate.ToShortDateString()}");
Price price=PricingDA.GetPrice(symbol,maxDate); // the max date from the cache equals the max date from the database so just reload the latest price from the database
if(null==price)continue; // if no latest price then just continue
symbolPrices.Remove(maxDate); // remove the current price associated with the max date

View File

@@ -146,6 +146,7 @@ namespace MarketData.DataAccess
try
{
if(null == symbols || 0==symbols.Count)return hasStopLimit;
StringBuilder sb=new StringBuilder();
if(null==symbols) return null;
sqlConnection=SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("portfolio_data"));

View File

@@ -296,6 +296,7 @@ namespace MarketData.DataAccess
try
{
if(null ==symbols || 0==symbols.Count)return latestDates;
StringBuilder sb = new StringBuilder();
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
sb.Append(" select symbol, max(date) as date ");