diff --git a/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml b/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml
index 4811e3bc3..3a07c4665 100644
--- a/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml
+++ b/src/client/spark/Modules/Spreader/ExecutionStrategyEditor.xaml
@@ -318,7 +318,7 @@
Command="{Binding RemoveLegCommand, RelativeSource={RelativeSource AncestorType=usp:ExecutionStrategyEditor}}"
CommandParameter="{Binding}" Style="{StaticResource RoundCloseButton}"
/>
-
+
diff --git a/src/client/spark/view/Converters/SecurityConverters/SecurityDisplayTextConverter.cs b/src/client/spark/view/Converters/SecurityConverters/SecurityDisplayTextConverter.cs
index 7d0567b5c..7a33b1e68 100644
--- a/src/client/spark/view/Converters/SecurityConverters/SecurityDisplayTextConverter.cs
+++ b/src/client/spark/view/Converters/SecurityConverters/SecurityDisplayTextConverter.cs
@@ -1,34 +1,16 @@
-using mbts.ui.utility;
+using bts.api;
using System;
using System.Globalization;
using System.Windows.Data;
-namespace mbts.ui.converters
-{
+namespace mbts.ui.converters {
[ValueConversion(typeof(SecurityTuple), typeof(string))]
- public class SecurityDisplayTextConverter : IValueConverter
- {
- public bool ShowExchange { get; set; }
- public bool ShowType { get; set; }
-
- public string TextForNull { get; set; }
- public string TextForEmpty { get; set; }
-
+ public class SecurityDisplayTextConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
- var sec = value as SecurityTuple;
- if (sec == null) return TextForNull;
- else if (sec.is_empty()) return TextForEmpty;
- else {
- if (ShowExchange) {
- if (ShowType) return "[{0} {1}] {2}".fmt(SecurityDisplay.format_security_type(sec.security_type), sec.security_exchange, sec.security_name);
- else return "[{0}] {1}".fmt(sec.security_exchange, sec.security_name);
- } else if (ShowType) return "[{0}] {1}".fmt(SecurityDisplay.format_security_type(sec.security_type), sec.security_name);
- else return sec.security_name;
- }
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
- throw new NotImplementedException();
+ if (value is Security s)
+ return SecurityFormatter.format(s);
+ return value?.ToString() ?? "Unknown";
}
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}
}
\ No newline at end of file
diff --git a/src/client/spark/view/Resources/Converters.xaml b/src/client/spark/view/Resources/Converters.xaml
index 315767a6b..949644618 100644
--- a/src/client/spark/view/Resources/Converters.xaml
+++ b/src/client/spark/view/Resources/Converters.xaml
@@ -3,7 +3,6 @@
xmlns:uc="clr-namespace:mbts.ui"
xmlns:u="clr-namespace:mbts.ui"
xmlns:cv="clr-namespace:mbts.ui.converters"
- xmlns:usp="clr-namespace:mbts.ui.spark"
xmlns:uspcv="clr-namespace:mbts.ui.spark.converters"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
@@ -23,7 +22,7 @@
-
+
diff --git a/src/client/spark_api/security/SecurityFormatter.cs b/src/client/spark_api/security/SecurityFormatter.cs
index c4f66556f..c0d8b88cb 100644
--- a/src/client/spark_api/security/SecurityFormatter.cs
+++ b/src/client/spark_api/security/SecurityFormatter.cs
@@ -21,6 +21,9 @@ namespace bts.api {
static class SecurityFormatter {
static readonly ConcurrentDictionary _formatted_names_cache = new ConcurrentDictionary();
+ public static string format(Security security) =>
+ _formatted_names_cache.GetOrAdd(security.Id, _format(security));
+
public static string format(SecurityImmutable security) =>
_formatted_names_cache.GetOrAdd(security.Id, _ => _format(security));