Use SymbolCache

This commit is contained in:
2024-05-24 15:12:29 -04:00
parent 64b5fe93c3
commit e5ebde9117
14 changed files with 40 additions and 14 deletions

View File

@@ -18,6 +18,7 @@ using TradeBlotter.DataAccess;
using TradeBlotter.Command; using TradeBlotter.Command;
using TradeBlotter.Model; using TradeBlotter.Model;
using Microsoft.Research.DynamicDataDisplay.DataSources; using Microsoft.Research.DynamicDataDisplay.DataSources;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -201,7 +202,8 @@ namespace TradeBlotter.ViewModels
} }
private void HandleSelectedWatchList() 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 else
{ {
symbols = WatchListDA.GetWatchList(selectedWatchList); symbols = WatchListDA.GetWatchList(selectedWatchList);

View File

@@ -15,6 +15,7 @@ using MarketData.MarketDataModel;
using TradeBlotter.DataAccess; using TradeBlotter.DataAccess;
using TradeBlotter.Command; using TradeBlotter.Command;
using TradeBlotter.Model; using TradeBlotter.Model;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -107,7 +108,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
} }

View File

@@ -18,6 +18,7 @@ using TradeBlotter.Model;
using Microsoft.Research.DynamicDataDisplay.DataSources; using Microsoft.Research.DynamicDataDisplay.DataSources;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -247,7 +248,8 @@ namespace TradeBlotter.ViewModels
} }
private void HandleSelectedWatchList() 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 else
{ {
symbols = WatchListDA.GetWatchList(selectedWatchList); symbols = WatchListDA.GetWatchList(selectedWatchList);

View File

@@ -15,6 +15,7 @@ using TradeBlotter.Command;
using Microsoft.Research.DynamicDataDisplay.DataSources; using Microsoft.Research.DynamicDataDisplay.DataSources;
using TradeBlotter.Model; using TradeBlotter.Model;
using TradeBlotter.UIUtils; using TradeBlotter.UIUtils;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -162,7 +163,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
} }

View File

@@ -16,6 +16,7 @@ using TradeBlotter.DataAccess;
using TradeBlotter.Model; using TradeBlotter.Model;
using TradeBlotter.Command; using TradeBlotter.Command;
using Microsoft.Research.DynamicDataDisplay.DataSources; using Microsoft.Research.DynamicDataDisplay.DataSources;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -145,7 +146,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
} }

View File

@@ -17,6 +17,7 @@ using TradeBlotter.DataAccess;
using TradeBlotter.Model; using TradeBlotter.Model;
using TradeBlotter.Command; using TradeBlotter.Command;
using Microsoft.Research.DynamicDataDisplay.DataSources; using Microsoft.Research.DynamicDataDisplay.DataSources;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -117,7 +118,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
} }

View File

@@ -416,7 +416,8 @@ namespace TradeBlotter.ViewModels
{ {
semaphorePool[Tasks.SelectedWatchList].WaitOne(); semaphorePool[Tasks.SelectedWatchList].WaitOne();
MDTrace.WriteLine(LogLevel.DEBUG, "OnOptionsViewModelPropertyChanged:SelectedWatchList"); 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
symbols = OptionsDA.GetOptionsSymbolIn(symbols); symbols = OptionsDA.GetOptionsSymbolIn(symbols);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");

View File

@@ -17,6 +17,7 @@ using MarketData.MarketDataModel;
using TradeBlotter.DataAccess; using TradeBlotter.DataAccess;
using TradeBlotter.Command; using TradeBlotter.Command;
using TradeBlotter.Model; using TradeBlotter.Model;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -158,7 +159,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
} }

View File

@@ -16,6 +16,7 @@ using TradeBlotter.DataAccess;
using TradeBlotter.Model; using TradeBlotter.Model;
using TradeBlotter.Command; using TradeBlotter.Command;
using Microsoft.Research.DynamicDataDisplay.DataSources; using Microsoft.Research.DynamicDataDisplay.DataSources;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -120,7 +121,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
} }

View File

@@ -17,6 +17,7 @@ using TradeBlotter.DataAccess;
using TradeBlotter.Command; using TradeBlotter.Command;
using TradeBlotter.Model; using TradeBlotter.Model;
using Microsoft.Research.DynamicDataDisplay.DataSources; using Microsoft.Research.DynamicDataDisplay.DataSources;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -96,7 +97,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
} }

View File

@@ -14,6 +14,7 @@ using MarketData.DataAccess;
using MarketData.MarketDataModel; using MarketData.MarketDataModel;
using MarketData.Utils; using MarketData.Utils;
using TradeBlotter.Model; using TradeBlotter.Model;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -101,7 +102,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
} }

View File

@@ -20,6 +20,7 @@ using TradeBlotter.Command;
using TradeBlotter.Model; using TradeBlotter.Model;
using Microsoft.Research.DynamicDataDisplay.DataSources; using Microsoft.Research.DynamicDataDisplay.DataSources;
using TradeBlotter.UIUtils; using TradeBlotter.UIUtils;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -235,7 +236,8 @@ namespace TradeBlotter.ViewModels
} }
private void HandleSelectedWatchList() 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 else
{ {
symbols = WatchListDA.GetWatchList(selectedWatchList); symbols = WatchListDA.GetWatchList(selectedWatchList);

View File

@@ -16,6 +16,7 @@ using TradeBlotter.DataAccess;
using TradeBlotter.Model; using TradeBlotter.Model;
using TradeBlotter.Command; using TradeBlotter.Command;
using Microsoft.Research.DynamicDataDisplay.DataSources; using Microsoft.Research.DynamicDataDisplay.DataSources;
using TradeBlotter.Cache;
namespace TradeBlotter.ViewModels namespace TradeBlotter.ViewModels
{ {
@@ -114,7 +115,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
} }

View File

@@ -85,7 +85,8 @@ namespace TradeBlotter.ViewModels
} }
else if (eventArgs.PropertyName.Equals("SelectedWatchList")) 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); else symbols = WatchListDA.GetWatchList(selectedWatchList);
base.OnPropertyChanged("Symbols"); base.OnPropertyChanged("Symbols");
selectedSymbolIndex = 0; selectedSymbolIndex = 0;