diff --git a/src/client/spark/view/Controls/SecuritySelectorControl/SecurityItem.cs b/src/client/spark/view/Controls/SecuritySelectorControl/SecurityItem.cs index 57af36734..3c89b831d 100644 --- a/src/client/spark/view/Controls/SecuritySelectorControl/SecurityItem.cs +++ b/src/client/spark/view/Controls/SecuritySelectorControl/SecurityItem.cs @@ -18,8 +18,8 @@ namespace mbts.ui.spark public Security security { get; private set; } public Venue exchange => security.Exchange; public ContractOneofCase type => security.ContractCase; - public string symbol => _get_symbol(security); - public string display_name => get_display_name(security); + public string symbol => security.ForceSymbol(); + public string display_name => security.ToString(null); public bool is_selected { get => _is_selected; set { @@ -31,12 +31,6 @@ namespace mbts.ui.spark } } public event Action IsSelectedChanged; - - public static string get_display_name(Security s) { return s.ContractCase == ContractOneofCase.Synthetic ? "{0} ({1:q/n:./m:c})".fmt(s.Synthetic.Name, s) : s.ToString("q/n:./m:c"); } - private static string _get_symbol(Security s) { - if (s.ContractCase == ContractOneofCase.Synthetic) return _get_symbol(s.Synthetic.Legs.First().Security); - else return s.Symbol; - } } } } \ No newline at end of file diff --git a/src/client/spark/view/Controls/SecuritySelectorControl/SecuritySelectorControl.xaml.cs b/src/client/spark/view/Controls/SecuritySelectorControl/SecuritySelectorControl.xaml.cs index 8a848021f..20a766221 100644 --- a/src/client/spark/view/Controls/SecuritySelectorControl/SecuritySelectorControl.xaml.cs +++ b/src/client/spark/view/Controls/SecuritySelectorControl/SecuritySelectorControl.xaml.cs @@ -125,7 +125,7 @@ namespace mbts.ui.spark Predicate filter = SearchHelper.get_filter(text); vs.View.Filter = item => filter(((SecurityItem)item).display_name); // deselect SecurityItems that do not pass the filter - target.SelectedSecurities.RemoveAll(s => !filter(SecurityItem.get_display_name(s))); + target.SelectedSecurities.RemoveAll(s => !filter(s.ToString(null))); vs.View.RaiseOnSearch(); } } diff --git a/src/client/spark_api/security/SecurityHelper.cs b/src/client/spark_api/security/SecurityHelper.cs index 0b1693b2f..47004c97c 100644 --- a/src/client/spark_api/security/SecurityHelper.cs +++ b/src/client/spark_api/security/SecurityHelper.cs @@ -61,6 +61,11 @@ namespace bts.api } public static int SignedQuantity(this ContractLeg leg) { return leg.Side == BuySell.Buy ? (int)leg.Quantity : -(int)leg.Quantity; } + + public static string ForceSymbol(this Security security) { + if (security.ContractCase == ContractOneofCase.Synthetic) return ForceSymbol(security.Synthetic.Legs.First().Security); + else return security.Symbol; + } #endregion } }