From e5ebde9117cd3d2b36ffd5d89d1d56fb2daa3d7b Mon Sep 17 00:00:00 2001 From: Sean Date: Fri, 24 May 2024 15:12:29 -0400 Subject: [PATCH] Use SymbolCache --- ViewModels/DCFValuationViewModel.cs | 4 +++- ViewModels/DividendHistoryViewModel.cs | 4 +++- ViewModels/HeadlinesViewModel.cs | 4 +++- ViewModels/HistoricalViewModel.cs | 4 +++- ViewModels/MACDViewModel.cs | 4 +++- ViewModels/MovingAverageViewModel.cs | 4 +++- ViewModels/OptionsViewModel.cs | 3 ++- ViewModels/PricingViewModel.cs | 4 +++- ViewModels/RSIViewModel.cs | 4 +++- ViewModels/ResistanceAndSupportViewModel.cs | 4 +++- ViewModels/SECFilingViewModel.cs | 4 +++- ViewModels/StickerPriceViewModel.cs | 4 +++- ViewModels/StochasticsViewModel.cs | 4 +++- ViewModels/TradeModelViewModel.cs | 3 ++- 14 files changed, 40 insertions(+), 14 deletions(-) diff --git a/ViewModels/DCFValuationViewModel.cs b/ViewModels/DCFValuationViewModel.cs index 857ae28..2861275 100644 --- a/ViewModels/DCFValuationViewModel.cs +++ b/ViewModels/DCFValuationViewModel.cs @@ -18,6 +18,7 @@ using TradeBlotter.DataAccess; using TradeBlotter.Command; using TradeBlotter.Model; using Microsoft.Research.DynamicDataDisplay.DataSources; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -201,7 +202,8 @@ namespace TradeBlotter.ViewModels } private void HandleSelectedWatchList() { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else { symbols = WatchListDA.GetWatchList(selectedWatchList); diff --git a/ViewModels/DividendHistoryViewModel.cs b/ViewModels/DividendHistoryViewModel.cs index 3159631..67e4c73 100644 --- a/ViewModels/DividendHistoryViewModel.cs +++ b/ViewModels/DividendHistoryViewModel.cs @@ -15,6 +15,7 @@ using MarketData.MarketDataModel; using TradeBlotter.DataAccess; using TradeBlotter.Command; using TradeBlotter.Model; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -107,7 +108,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); } diff --git a/ViewModels/HeadlinesViewModel.cs b/ViewModels/HeadlinesViewModel.cs index 0f07588..8b1a5f0 100644 --- a/ViewModels/HeadlinesViewModel.cs +++ b/ViewModels/HeadlinesViewModel.cs @@ -18,6 +18,7 @@ using TradeBlotter.Model; using Microsoft.Research.DynamicDataDisplay.DataSources; using System.Threading; using System.Windows; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -247,7 +248,8 @@ namespace TradeBlotter.ViewModels } private void HandleSelectedWatchList() { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else { symbols = WatchListDA.GetWatchList(selectedWatchList); diff --git a/ViewModels/HistoricalViewModel.cs b/ViewModels/HistoricalViewModel.cs index a9c5682..0581b0c 100644 --- a/ViewModels/HistoricalViewModel.cs +++ b/ViewModels/HistoricalViewModel.cs @@ -15,6 +15,7 @@ using TradeBlotter.Command; using Microsoft.Research.DynamicDataDisplay.DataSources; using TradeBlotter.Model; using TradeBlotter.UIUtils; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -162,7 +163,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); } diff --git a/ViewModels/MACDViewModel.cs b/ViewModels/MACDViewModel.cs index d6c3ab2..49351c7 100644 --- a/ViewModels/MACDViewModel.cs +++ b/ViewModels/MACDViewModel.cs @@ -16,6 +16,7 @@ using TradeBlotter.DataAccess; using TradeBlotter.Model; using TradeBlotter.Command; using Microsoft.Research.DynamicDataDisplay.DataSources; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -145,7 +146,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); } diff --git a/ViewModels/MovingAverageViewModel.cs b/ViewModels/MovingAverageViewModel.cs index 669483f..14a2be6 100644 --- a/ViewModels/MovingAverageViewModel.cs +++ b/ViewModels/MovingAverageViewModel.cs @@ -17,6 +17,7 @@ using TradeBlotter.DataAccess; using TradeBlotter.Model; using TradeBlotter.Command; using Microsoft.Research.DynamicDataDisplay.DataSources; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -117,7 +118,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); } diff --git a/ViewModels/OptionsViewModel.cs b/ViewModels/OptionsViewModel.cs index 40a6eeb..ae79f6f 100644 --- a/ViewModels/OptionsViewModel.cs +++ b/ViewModels/OptionsViewModel.cs @@ -416,7 +416,8 @@ namespace TradeBlotter.ViewModels { semaphorePool[Tasks.SelectedWatchList].WaitOne(); MDTrace.WriteLine(LogLevel.DEBUG, "OnOptionsViewModelPropertyChanged:SelectedWatchList"); - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); symbols = OptionsDA.GetOptionsSymbolIn(symbols); base.OnPropertyChanged("Symbols"); diff --git a/ViewModels/PricingViewModel.cs b/ViewModels/PricingViewModel.cs index d5871ba..194c5d3 100644 --- a/ViewModels/PricingViewModel.cs +++ b/ViewModels/PricingViewModel.cs @@ -17,6 +17,7 @@ using MarketData.MarketDataModel; using TradeBlotter.DataAccess; using TradeBlotter.Command; using TradeBlotter.Model; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -158,7 +159,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); } diff --git a/ViewModels/RSIViewModel.cs b/ViewModels/RSIViewModel.cs index d1331a4..9841fa5 100644 --- a/ViewModels/RSIViewModel.cs +++ b/ViewModels/RSIViewModel.cs @@ -16,6 +16,7 @@ using TradeBlotter.DataAccess; using TradeBlotter.Model; using TradeBlotter.Command; using Microsoft.Research.DynamicDataDisplay.DataSources; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -120,7 +121,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); } diff --git a/ViewModels/ResistanceAndSupportViewModel.cs b/ViewModels/ResistanceAndSupportViewModel.cs index 7d7dc85..5e04330 100644 --- a/ViewModels/ResistanceAndSupportViewModel.cs +++ b/ViewModels/ResistanceAndSupportViewModel.cs @@ -17,6 +17,7 @@ using TradeBlotter.DataAccess; using TradeBlotter.Command; using TradeBlotter.Model; using Microsoft.Research.DynamicDataDisplay.DataSources; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -96,7 +97,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); } diff --git a/ViewModels/SECFilingViewModel.cs b/ViewModels/SECFilingViewModel.cs index d4898a9..2fc3f89 100644 --- a/ViewModels/SECFilingViewModel.cs +++ b/ViewModels/SECFilingViewModel.cs @@ -14,6 +14,7 @@ using MarketData.DataAccess; using MarketData.MarketDataModel; using MarketData.Utils; using TradeBlotter.Model; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -101,7 +102,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); } diff --git a/ViewModels/StickerPriceViewModel.cs b/ViewModels/StickerPriceViewModel.cs index 92f8acf..c7db52c 100644 --- a/ViewModels/StickerPriceViewModel.cs +++ b/ViewModels/StickerPriceViewModel.cs @@ -20,6 +20,7 @@ using TradeBlotter.Command; using TradeBlotter.Model; using Microsoft.Research.DynamicDataDisplay.DataSources; using TradeBlotter.UIUtils; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -235,7 +236,8 @@ namespace TradeBlotter.ViewModels } private void HandleSelectedWatchList() { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else { symbols = WatchListDA.GetWatchList(selectedWatchList); diff --git a/ViewModels/StochasticsViewModel.cs b/ViewModels/StochasticsViewModel.cs index bd5dccd..1c6cb8f 100644 --- a/ViewModels/StochasticsViewModel.cs +++ b/ViewModels/StochasticsViewModel.cs @@ -16,6 +16,7 @@ using TradeBlotter.DataAccess; using TradeBlotter.Model; using TradeBlotter.Command; using Microsoft.Research.DynamicDataDisplay.DataSources; +using TradeBlotter.Cache; namespace TradeBlotter.ViewModels { @@ -114,7 +115,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); } diff --git a/ViewModels/TradeModelViewModel.cs b/ViewModels/TradeModelViewModel.cs index ceda6c8..417b734 100644 --- a/ViewModels/TradeModelViewModel.cs +++ b/ViewModels/TradeModelViewModel.cs @@ -85,7 +85,8 @@ namespace TradeBlotter.ViewModels } else if (eventArgs.PropertyName.Equals("SelectedWatchList")) { - if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); +// if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = PricingDA.GetSymbols(); + if (selectedWatchList.Equals(Constants.CONST_ALL)) symbols = SymbolCache.GetInstance().GetSymbols(); else symbols = WatchListDA.GetWatchList(selectedWatchList); base.OnPropertyChanged("Symbols"); selectedSymbolIndex = 0;