Ensure new symbols are added to watchlist. Ensure that a missing price does not cause GetModelPerformance to end abruptly.
Some checks failed
Build .NET Project / build (push) Has been cancelled

This commit is contained in:
2026-03-10 12:40:41 -04:00
parent 5d3b18dafa
commit acee222089
6 changed files with 120 additions and 306 deletions

View File

@@ -10,6 +10,29 @@ namespace MarketData.DataAccess
private WatchListDA()
{
}
/// <summary>
/// AddToWatchList - Add list of symbols to specified watch list
/// </summary>
/// <param name="symbols"></param>
/// <param name="watchListName"></param>
/// <returns></returns>
public static bool AddToWatchList(List<string> symbols,String watchListName = "Valuations")
{
if(null == symbols || 0==symbols.Count || String.IsNullOrEmpty(watchListName))return false;
foreach(string symbol in symbols)
{
AddToWatchList(symbol, watchListName);
}
return true;
}
/// <summary>
/// AddToWatchList - This will ignore the insert if the record already exists
/// </summary>
/// <param name="symbol"></param>
/// <param name="watchListName"></param>
/// <returns></returns>
public static bool AddToWatchList(String symbol, String watchListName = "Valuations")
{
MySqlConnection sqlConnection = null;
@@ -23,11 +46,11 @@ namespace MarketData.DataAccess
symbol = symbol.ToUpper();
WatchListItem watchListItem = GetWatchListItem(watchListName);
if (null == watchListItem) return false;
if (IsInWatchList(symbol, watchListName)) return true;
// if (IsInWatchList(symbol, watchListName)) return true;
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("portfolio_data"));
sqlTransaction = sqlConnection.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
StringBuilder sb = new StringBuilder();
sb.Append("insert into watchlist(watch_list_id,symbol)values(");
sb.Append("insert ignore into watchlist(watch_list_id,symbol)values(");
sb.Append(watchListItem.WatchListId).Append(",");
sb.Append(SqlUtils.AddQuotes(symbol));
sb.Append(")");
@@ -50,6 +73,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close();
}
}
public static bool RemoveFromWatchList(String symbol, String watchListName = "Valuations")
{
MySqlConnection sqlConnection = null;
@@ -88,6 +112,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close();
}
}
public static bool IsInWatchList(String symbol, String watchListName = "Valuations")
{
MySqlConnection sqlConnection = null;
@@ -123,6 +148,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close();
}
}
public static List<String> GetWatchList(String watchListName)
{
MySqlConnection sqlConnection = null;
@@ -160,6 +186,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close();
}
}
public static WatchListItem GetWatchListItem(String watchListName)
{
MySqlConnection sqlConnection = null;
@@ -197,6 +224,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close();
}
}
public static List<String> GetWatchLists()
{
MySqlConnection sqlConnection = null;