Fixing SecuritySelectorControl search
This commit is contained in:
1 parent
31075e82c4
commit
2d265724ac
3 files changed
+8
-9
No files matched your search
@@ -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<Security, bool> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -125,7 +125,7 @@ namespace mbts.ui.spark
|
||||
Predicate<string> 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user