diff --git a/.vscode/launch.json b/.vscode/launch.json
index 0cd375b54..fd68a6626 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -75,6 +75,7 @@
"name": "SparkVM Launch",
"type": "cppdbg",
"request": "launch",
+
"program": "/home/bts/spark/build/ninja_debug/server/sparkd",
"args": ["run"],
"stopAtEntry": false,
@@ -96,7 +97,12 @@
"description": "Skip STL",
"text": "skip -gfi /usr/include/c++/7/bits/*.h",
"ignoreFailures": true
- }
+ },
+ {
+ "description": "LD LIBRARY",
+ "text": "set env LD_LIBRARY_PATH=.",
+ "ignoreFailures": false
+ }
],
"pipeTransport": {
"pipeCwd": "${workspaceRoot}",
@@ -208,10 +214,10 @@
"name": "MD Tests",
"type": "cppdbg",
"request": "launch",
- "program": "/home/bts/spark/build/ninja_debug/src/server/sparkd/sparkd",
+ "program": "/home/bts/spark/build/ninja_debug/server/sparkd",
"args": ["test", "[md]"],
"stopAtEntry": false,
- "cwd": "/home/bts/spark/build/ninja_debug/src/server/sparkd/",
+ "cwd": "/home/bts/spark/build/ninja_debug/server/",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4395bfcf..be98723f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,6 +55,8 @@ else ()
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/web ${CMAKE_BINARY_DIR}/server
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/data_files ${CMAKE_BINARY_DIR}/server
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/src/lib/libspark.so ${CMAKE_BINARY_DIR}/server
+ COMMAND ln ARGS -sf ${EXTERNALS_ROOT}/lib/Release/libOnixS.IceImpactMulticastPriceFeedHandlerCpp.so.3.13.0.0 ${CMAKE_BINARY_DIR}/server
+ COMMAND ln ARGS -sf ${EXTERNALS_ROOT}/lib/Release/libACE-5.7.5.so ${CMAKE_BINARY_DIR}/server
COMMAND mkdir ARGS -p ${CMAKE_BINARY_DIR}/server/plugins
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/sdk/examples/order_plugin_example.so ${CMAKE_BINARY_DIR}/server/plugins/
COMMENT "Creating server runtime layout"
diff --git a/doc/user/content/bts_spark/Spreader/index.md b/doc/user/content/bts_spark/Spreader/index.md
index 56ae31714..a69a3731e 100644
--- a/doc/user/content/bts_spark/Spreader/index.md
+++ b/doc/user/content/bts_spark/Spreader/index.md
@@ -5,6 +5,7 @@ sort_by = "weight"
insert_anchor_links = "right"
+++
+{{ youtube(id="RZU9Wj0cETo") }}
diff --git a/doc/user/content/bts_spark/Trading/index.md b/doc/user/content/bts_spark/Trading/index.md
index bdca5dc4b..1edcf1850 100644
--- a/doc/user/content/bts_spark/Trading/index.md
+++ b/doc/user/content/bts_spark/Trading/index.md
@@ -406,6 +406,8 @@ insert_anchor_links = "right"
## Algo Studio
+{{ youtube(id="DHIa5tnifKc") }}
+
- The BTS Algo Studio was built for users to experience algo composability
never seen before in a professional futures trading system.
diff --git a/doc/user/content/release_notes/_index.md b/doc/user/content/release_notes/_index.md
index d8d3199cd..71d637fd7 100644
--- a/doc/user/content/release_notes/_index.md
+++ b/doc/user/content/release_notes/_index.md
@@ -4,6 +4,26 @@ weight = 3
sort_by = "weight"
insert_anchor_links = "right"
+++
+## 1.5.7
+### User Visible Changes
+ - New videos have been added to the manual describing the [Algo Studio](./bts_spark/Trading/index.md#algo-studio) and [Spreader](./bts_spark/Spreader/index.md)
+ - Fixed a bug that occasionally would cause windows to be position outside the visible screen on startup
+ - Fixed a bug in the order book form that would occasionally cause the Recreate Order option to be unavailable
+ - Added a confirmation step to Cancel All, Cancel Buys and Cancel Sells commands
+ - Fixed Aggressor coloring and ladder high/low coloring in the SIM execution gateway
+ - Added initial support for ICE market data
+ - In an effort to streamline the PnL report we've made the following changes:
+ - The PnL report will by default filter for Futures contracts only
+ - If you wish to see Spread contracts again you may change Security Type column filter
+ - The PnL report will now only show rows in which there is a position (net and/or day)
+ - The Exchange, Start PnL, Total Net Pos, and Total Net PnL columns are now hidden by default
+ - These columns can be restored by toggling their visibility within the PnL's Settings form
+ - A new Traded Today column has been added to the PnL
+ - Filtering on this column will allow a user to restrict the report to only show today's position
+### Internal changes
+ - Improved organization of the shell notification architecture
+ - Added logging to help troubleshoot shell exit hang
+
## 1.5.6
### User Visible Changes
- Fixed a bug that could cause limits to be erroneously enforced
diff --git a/doc/user/sass/book.scss b/doc/user/sass/book.scss
index 207cac8b0..af81ecfc1 100644
--- a/doc/user/sass/book.scss
+++ b/doc/user/sass/book.scss
@@ -54,3 +54,8 @@ img {
background: #ccc;
border: 1px solid #aaa;
}
+
+iframe {
+ width:560px;
+ height:315px;
+}
\ No newline at end of file
diff --git a/ops_notes.txt b/ops_notes.txt
index 1975dd799..2f9b5a6d5 100644
--- a/ops_notes.txt
+++ b/ops_notes.txt
@@ -1,3 +1,6 @@
+1.5.7
+- Fixed Aggressor coloring and ladder high/low coloring in SIM
+
1.4.2
- Be sure the system has a bts user before deployment. bts is the superuser, he has all permissions and can see all market data
- After deployment re-permission all existing users for trading, riskadmin, and/or md admin permissions as appropriate
diff --git a/src/client/spark/App.xaml.cs b/src/client/spark/App.xaml.cs
index 196a404c2..d19652c96 100644
--- a/src/client/spark/App.xaml.cs
+++ b/src/client/spark/App.xaml.cs
@@ -66,6 +66,7 @@ namespace mbts.ui.shell
protected override void OnExit(ExitEventArgs e)
{
+ Log.Gen.info("Application.OnExit");
if (_runtime != null) _runtime.Dispose();
utils.BTSNativeMethods.finit_spark_lib();
base.OnExit(e);
diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewRow.cs b/src/client/spark/Modules/Market/MarketView/MarketViewRow.cs
index 5eda77cdf..9f7b69efe 100644
--- a/src/client/spark/Modules/Market/MarketView/MarketViewRow.cs
+++ b/src/client/spark/Modules/Market/MarketView/MarketViewRow.cs
@@ -137,6 +137,12 @@ namespace mbts.spark {
public ICommand ask_implied_size_click { get; }
public ICommand working_asks_click { get; }
public ICommand default_command { get; }
+ public string market_description {get;}
+ public string cleared_alias { get; }
+ public string product_description { get; }
+ public string hub_alias { get; }
+ public string strip_name{ get; }
+ public string mic_code { get; }
public ObservableCollection
row_animations { get; } = new ObservableCollection();
diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewVM.cs b/src/client/spark/Modules/Market/MarketView/MarketViewVM.cs
index c193f506c..65644a29e 100644
--- a/src/client/spark/Modules/Market/MarketView/MarketViewVM.cs
+++ b/src/client/spark/Modules/Market/MarketView/MarketViewVM.cs
@@ -57,6 +57,13 @@ namespace mbts.spark {
add_col(Columns.SessionLow, "Low", r => r.format_price(r.session_low), nameof(Row.session_low), DefaultColumnWidths.Price, session_low_filter, DataGridFilterKnownTemplates.DoubleMinMax, h_alignment: System.Windows.HorizontalAlignment.Right);
add_col(Columns.SessionHigh, "High", r => r.format_price(r.session_high), nameof(Row.session_high), DefaultColumnWidths.Price, session_high_filter, DataGridFilterKnownTemplates.DoubleMinMax, h_alignment: System.Windows.HorizontalAlignment.Right);
add_col(Columns.SecurityKey, "Security Key", r => r.security_key.ToString(), nameof(Row.security_key), DefaultColumnWidths.SecurityKey, security_key_filter, DataGridFilterKnownTemplates.Regex);
+
+ add_col(Columns.MarketDescription, "Market Description", r => r.md.security.HasIce ? r.md.security.Ice.MarketDescription : string.Empty, nameof(Row.market_description), DefaultColumnWidths.SecurityKey, market_description_filter, DataGridFilterKnownTemplates.Regex);
+ add_col(Columns.ClearedAlias, "Cleared Alias", r => r.md.security.HasIce ? r.md.security.Ice.ClearedAlias : string.Empty, nameof(Row.cleared_alias), DefaultColumnWidths.SecurityKey, cleared_alias_filter, DataGridFilterKnownTemplates.Regex);
+ add_col(Columns.ProductDescription, "Product Description", r => r.md.security.HasIce ? r.md.security.Ice.ProductName : string.Empty, nameof(Row.product_description), DefaultColumnWidths.SecurityKey, product_description_filter, DataGridFilterKnownTemplates.Regex);
+ add_col(Columns.HubAlias, "Hub Alias", r => r.md.security.HasIce ? r.md.security.Ice.HubAlias : string.Empty, nameof(Row.hub_alias), DefaultColumnWidths.SecurityKey, hub_alias_filter, DataGridFilterKnownTemplates.Regex);
+ add_col(Columns.StripName, "Strip Name", r => r.md.security.HasIce ? r.md.security.Ice.StripName : string.Empty, nameof(Row.strip_name), DefaultColumnWidths.SecurityKey, strip_name_filter, DataGridFilterKnownTemplates.Regex);
+ add_col(Columns.MicCode, "Mic Code", r => r.md.security.HasIce ? r.md.security.Ice.MicCode : string.Empty, nameof(Row.mic_code), DefaultColumnWidths.SecurityKey, mic_code_filter, DataGridFilterKnownTemplates.Regex);
//
void add_col(Columns col_key, string header, Func get_text, string prop, double width, IDataGridColumnFilter filter, string filter_template, bool is_animatable = false, Color? font_color = null, System.Windows.HorizontalAlignment h_alignment = System.Windows.HorizontalAlignment.Left) =>
columns.Add(new RenderTextColumn(col_key, get_text, filter, filter_template) {
@@ -194,6 +201,14 @@ namespace mbts.spark {
public IDataGridColumnPersistentFilter working_ask_volume_filter { get; } = new IntMinMax(r => r.working_ask_volume, nameof(Row.working_ask_volume));
public IDataGridColumnPersistentFilter volume_filter { get; } = new ULongMinMax(r => r.volume, nameof(Row.volume));
public IDataGridColumnPersistentFilter security_key_filter { get; } = new RegexFilterVM(r => r.security_key.ToString(), nameof(Row.security_key));
+
+ public IDataGridColumnPersistentFilter market_description_filter { get; } = new RegexFilterVM(r => r.security.HasIce ? r.security.Ice.MarketDescription : "", nameof(Row.market_description));
+ public IDataGridColumnPersistentFilter cleared_alias_filter { get; } = new RegexFilterVM(r => r.security.HasIce ? r.security.Ice.ClearedAlias : "", nameof(Row.cleared_alias));
+ public IDataGridColumnPersistentFilter product_description_filter { get; } = new RegexFilterVM(r => r.security.HasIce ? r.security.Ice.ProductName : "", nameof(Row.product_description));
+ public IDataGridColumnPersistentFilter hub_alias_filter { get; } = new RegexFilterVM(r => r.security.HasIce ? r.security.Ice.HubAlias : "", nameof(Row.hub_alias));
+ public IDataGridColumnPersistentFilter strip_name_filter { get; } = new RegexFilterVM(r => r.security.HasIce ? r.security.Ice.StripName : "", nameof(Row.strip_name));
+ public IDataGridColumnPersistentFilter mic_code_filter { get; } = new RegexFilterVM(r => r.security.HasIce ? r.security.Ice.MicCode : "", nameof(Row.mic_code));
+
public FilterStates get_filter_states() {
return new FilterStates {
@@ -216,7 +231,13 @@ namespace mbts.spark {
working_bid_volume = working_bid_volume_filter.get_state(),
working_ask_volume = working_ask_volume_filter.get_state(),
volume = volume_filter.get_state(),
- security_key = security_key_filter.get_state()
+ security_key = security_key_filter.get_state(),
+ market_description = market_description_filter.get_state(),
+ cleared_alias = cleared_alias_filter.get_state(),
+ product_description = product_description_filter.get_state(),
+ hub_alias = hub_alias_filter.get_state(),
+ strip_name = strip_name_filter.get_state(),
+ mic_code = mic_code_filter.get_state(),
};
}
#endregion
diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewView.xaml.cs b/src/client/spark/Modules/Market/MarketView/MarketViewView.xaml.cs
index 5f4107956..edbea884b 100644
--- a/src/client/spark/Modules/Market/MarketView/MarketViewView.xaml.cs
+++ b/src/client/spark/Modules/Market/MarketView/MarketViewView.xaml.cs
@@ -8,7 +8,9 @@ namespace mbts.ui.spark {
/// Interaction logic for MarketSheetsView.xaml
///
partial class MarketViewView : UserControl {
- public enum Columns { Security, Volume, Last, LastSize, Position, WorkingBids, Bid, BidMergedSize, BidDirectSize, BidImpliedSize, Ask, AskMergedSize, AskDirectSize, AskImpliedSize, WorkingAsks, Settlement, DayChange, SessionLow, SessionHigh, SecurityKey }
+ public enum Columns { Security, Volume, Last, LastSize, Position, WorkingBids, Bid, BidMergedSize, BidDirectSize, BidImpliedSize, Ask, AskMergedSize, AskDirectSize, AskImpliedSize, WorkingAsks, Settlement, DayChange, SessionLow, SessionHigh, SecurityKey,
+ MarketDescription, ClearedAlias, ProductDescription, HubAlias, StripName, MicCode
+ }
public MarketViewView() {
InitializeComponent();
diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs b/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs
index 44759c0c5..38931a3eb 100644
--- a/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs
+++ b/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs
@@ -97,6 +97,12 @@ namespace bts.shell {
public static GridColumnSettings session_low => new GridColumnSettings(col_id(Columns.SessionLow), DefaultColumnHeaders.SessionLow, width: DefaultColumnWidths.Price, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings session_high => new GridColumnSettings(col_id(Columns.SessionHigh), DefaultColumnHeaders.SessionHigh, width: DefaultColumnWidths.Price, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, is_visible: false, width: DefaultColumnWidths.SecurityKey);
+ public static GridColumnSettings market_description => new GridColumnSettings(col_id(Columns.MarketDescription), DefaultColumnHeaders.MarketDescription, is_visible: false, width: DefaultColumnWidths.SecurityKey);
+ public static GridColumnSettings cleared_alias => new GridColumnSettings(col_id(Columns.ClearedAlias), DefaultColumnHeaders.ClearedAlias, is_visible: false, width: DefaultColumnWidths.SecurityKey);
+ public static GridColumnSettings product_description => new GridColumnSettings(col_id(Columns.ProductDescription), DefaultColumnHeaders.ProductDescription, is_visible: false, width: DefaultColumnWidths.SecurityKey);
+ public static GridColumnSettings hub_alias => new GridColumnSettings(col_id(Columns.HubAlias), DefaultColumnHeaders.HubAlias, is_visible: false, width: DefaultColumnWidths.SecurityKey);
+ public static GridColumnSettings strip_name => new GridColumnSettings(col_id(Columns.StripName), DefaultColumnHeaders.StripName, is_visible: false, width: DefaultColumnWidths.SecurityKey);
+ public static GridColumnSettings mic_code => new GridColumnSettings(col_id(Columns.MicCode), DefaultColumnHeaders.MicCode, is_visible: false, width: DefaultColumnWidths.SecurityKey);
@@ -128,6 +134,12 @@ namespace bts.shell {
yield return session_low;
yield return session_high;
yield return security_key;
+ yield return market_description;
+ yield return cleared_alias;
+ yield return product_description;
+ yield return hub_alias;
+ yield return strip_name;
+ yield return mic_code;
}
}
@@ -177,6 +189,18 @@ namespace bts.shell {
public UIntMinMaxState ask_direct_size;
[ProtoMember(20)]
public UIntMinMaxState ask_implied_size;
+ [ProtoMember(21)]
+ public string market_description;
+ [ProtoMember(22)]
+ public string cleared_alias;
+ [ProtoMember(23)]
+ public string product_description;
+ [ProtoMember(24)]
+ public string hub_alias;
+ [ProtoMember(25)]
+ public string strip_name;
+ [ProtoMember(26)]
+ public string mic_code;
}
}
}
\ No newline at end of file
diff --git a/src/client/spark/Modules/Trading/OrderBook/OrderBookRowVM.cs b/src/client/spark/Modules/Trading/OrderBook/OrderBookRowVM.cs
index 864cdf9ec..734e6e959 100644
--- a/src/client/spark/Modules/Trading/OrderBook/OrderBookRowVM.cs
+++ b/src/client/spark/Modules/Trading/OrderBook/OrderBookRowVM.cs
@@ -6,11 +6,13 @@ using mbts.ui;
using mbts.ui.controls;
using mbts.ui.shell;
using System;
+using System.Reactive;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
+using System.Reactive.Linq;
namespace mbts.spark {
partial class OrderBookRowVM : DisposableViewModelBase, IEquatable, DIYGrid.IRowVM {
@@ -44,6 +46,19 @@ namespace mbts.spark {
modify_order_price?.TryRaiseCanExecuteChanged();
}
+ //// This takes care of the case where the OB has all rows visible
+ //// and an order is cancelled outside of the OB (say via the ladder).
+ //// Since the OB window Commands only revaluate their CanExecuteChanged
+ //// when the OrderBookVM.selected_order_changes, this emulates the selected
+ //// order changing since the current_row setter invokes the selected_order_changed
+ //// handler
+ public IObservable subscribe_data() {
+ return Observable.FromEvent(
+ cb => () => cb(order_tuple),
+ cb => invalidated += cb,
+ cb => invalidated -= cb);
+ }
+
protected override void Dispose(bool disposing) {
this.invalidated -= OrderBookRowVM_invalidated;
base.Dispose(disposing);
diff --git a/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs b/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs
index ee9c17ecb..525b0716a 100644
--- a/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs
+++ b/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs
@@ -28,7 +28,6 @@ using _GridSettingsManager =
mbts.ui.GridSettingsManager<
mbts.spark.OrderBookRowVM,
bts.api.orderman.OrderSecurity,
- bts.shell.INotificationServiceDataCache,
mbts.OrderRecordTuplePredicate,
bts.shell.OrderBookWindowFactory.OrderBookGridSettings>;
using Columns = mbts.spark.OrderBookGridView.ColumnKeys;
@@ -428,21 +427,25 @@ namespace mbts.spark {
col_settings_flags[c.ToString()] = GridColumnSettingsFeatureFlags.ImmutableFontColor | GridColumnSettingsFeatureFlags.ImmutableFontWeight;
}
return new _GridSettingsManager(
- owner_title, bus, notification_service, model, rows, columns,
+ owner_title, bus, model, rows, columns,
+ () => new OrderRecordTuplePredicate(),
() => {
- var pvm = PredicateBuilderVMWrapper.create(
+ var pvm = PredicateVMWrapper.create(
OrderRecordTuplePredicateVMFactory.get_oneofs(bus, model), rp => rp.predicate_type_case);
pvm.selected_predicate_type = pvm.predicate_types.FirstOrDefault();
return pvm;
},
col_id => {
- var pvm = PredicateBuilderVMWrapper.create(
+ var pvm = PredicateVMWrapper.create(
OrderRecordTuplePredicateVMFactory.get_oneofs(bus, model), rp => rp.predicate_type_case);
pvm.selected_predicate_type = _corresponding_predicate_type(EnumHelper.parse_or_default(col_id));
return pvm;
},
- (gen, anims) => new OrderBookGridSettings(gen, anims.Select(a => new OrderRecordTuplePredicateAnimations(a.predicate_builder, a.cell_animations, a.row_animations, a.sound_notifications))),
- (notification_service == null) ? null : notification_service.data_cache,
+ (gen, anims) => new OrderBookGridSettings(gen, anims.Select(a => new OrderRecordTuplePredicateAnimations(a.predicate_data, a.cell_animations, a.row_animations, a.sound_notifications))),
+ p => p.create_predicate(notification_service.data_cache),
+ p => p.create_notification_predicate(notification_service.data_cache),
+ notification_service == null ? new Func, SoundNotification, IDisposable>((p, sn) => Disposable.empty) : notification_service.link_to_order,
+ notification_service == null ? new Func, IDisposable>(t => Disposable.empty) : notification_service.link_to_order,
col_settings_flags);
}
diff --git a/src/client/spark/Modules/Trading/OrderBook/OrderBookWindow.cs b/src/client/spark/Modules/Trading/OrderBook/OrderBookWindow.cs
index 1fe500cfe..761e9e6d7 100644
--- a/src/client/spark/Modules/Trading/OrderBook/OrderBookWindow.cs
+++ b/src/client/spark/Modules/Trading/OrderBook/OrderBookWindow.cs
@@ -78,17 +78,41 @@ namespace mbts.spark {
var cancel_buy_orders_command = SparkCommands.CancelBuyOrders.complete(
_model.working_orders.Select(os => os.Values.Where(o => o.order.side() == Side.Buy).Select(o => o.order.Key)),
- wbids => wbids.Any()
+ wbids => wbids.Any(),
+ () => {
+ var resp = BTSMessageBox.Show(
+ "Are you sure you want to cancel all working buy orders?",
+ "Cancel Buy Orders",
+ BTSMessageBoxButtons.Yes | BTSMessageBoxButtons.No,
+ MessageBoxImage.Question);
+ return resp == BTSMessageBoxButtons.Yes;
+ }
);
var cancel_sell_orders_command = SparkCommands.CancelSellOrders.complete(
_model.working_orders.Select(os => os.Values.Where(o => o.order.side() == Side.Sell).Select(o => o.order.Key)),
- wasks => wasks.Any()
+ wasks => wasks.Any(),
+ () => {
+ var resp = BTSMessageBox.Show(
+ "Are you sure you want to cancel all working sell orders?",
+ "Cancel Sell Orders",
+ BTSMessageBoxButtons.Yes | BTSMessageBoxButtons.No,
+ MessageBoxImage.Question);
+ return resp == BTSMessageBoxButtons.Yes;
+ }
);
var cancel_all_orders_command = SparkCommands.CancelOrders.complete(
_model.working_orders.Select(os => os.Select(o => o.Key)),
- worders => worders.Any()
+ worders => worders.Any(),
+ () => {
+ var resp = BTSMessageBox.Show(
+ "Are you sure you want to cancel all working orders?",
+ "Cancel All Orders",
+ BTSMessageBoxButtons.Yes | BTSMessageBoxButtons.No,
+ MessageBoxImage.Question);
+ return resp == BTSMessageBoxButtons.Yes;
+ }
);
var cancel_selected_orders_command = SparkCommands.CancelSelectedOrders.complete(
diff --git a/src/client/spark/Modules/Trading/PAndLWindowFactory.cs b/src/client/spark/Modules/Trading/PAndLWindowFactory.cs
index 27eba0300..486e261a9 100644
--- a/src/client/spark/Modules/Trading/PAndLWindowFactory.cs
+++ b/src/client/spark/Modules/Trading/PAndLWindowFactory.cs
@@ -84,17 +84,17 @@ namespace bts.shell {
static class DefaultColumns {
public static GridColumnSettings account => new GridColumnSettings(col_id(Columns.Account), DefaultColumnHeaders.Account, width: DefaultColumnWidths.Account);
- public static GridColumnSettings exchange => new GridColumnSettings(col_id(Columns.Exchange), DefaultColumnHeaders.Exchange, width: DefaultColumnWidths.Exchange);
+ public static GridColumnSettings exchange => new GridColumnSettings(col_id(Columns.Exchange), DefaultColumnHeaders.Exchange, false, width: DefaultColumnWidths.Exchange);
public static GridColumnSettings symbol => new GridColumnSettings(col_id(Columns.Symbol), DefaultColumnHeaders.Symbol, width: DefaultColumnWidths.Symbol);
public static GridColumnSettings security => new GridColumnSettings(col_id(Columns.Security), DefaultColumnHeaders.Security, width: DefaultColumnWidths.Security);
public static GridColumnSettings security_type => new GridColumnSettings(col_id(Columns.SecurityType), DefaultColumnHeaders.SecurityType, width: DefaultColumnWidths.SecurityType);
public static GridColumnSettings start_net_position => new GridColumnSettings(col_id(Columns.StartNetPos), DefaultColumnHeaders.StartNetPos, width: DefaultColumnWidths.Start_Net_Pos, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
- public static GridColumnSettings start_pnl => new GridColumnSettings(col_id(Columns.StartPNL), DefaultColumnHeaders.StartPnL, width: DefaultColumnWidths.PnL_Generic, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
+ public static GridColumnSettings start_pnl => new GridColumnSettings(col_id(Columns.StartPNL), DefaultColumnHeaders.StartPnL, false, width: DefaultColumnWidths.PnL_Generic, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings day_long_pnl => new GridColumnSettings(col_id(Columns.DayLong), DefaultColumnHeaders.DayLong, width: DefaultColumnWidths.PnL_Generic, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings day_short_pnl => new GridColumnSettings(col_id(Columns.DayShort), DefaultColumnHeaders.DayShort, width: DefaultColumnWidths.PnL_Generic, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings day_pnl => new GridColumnSettings(col_id(Columns.DayPNL), DefaultColumnHeaders.DayPnL, width: DefaultColumnWidths.PnL_Generic, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
- public static GridColumnSettings total_net_pos => new GridColumnSettings(col_id(Columns.TotalNetPos), DefaultColumnHeaders.TotalNetPos, width: DefaultColumnWidths.Total_Net_Pos, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
- public static GridColumnSettings total_pnl => new GridColumnSettings(col_id(Columns.TotalPNL), DefaultColumnHeaders.TotalPnL, width: DefaultColumnWidths.PnL_Generic, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
+ public static GridColumnSettings total_net_pos => new GridColumnSettings(col_id(Columns.TotalNetPos), DefaultColumnHeaders.TotalNetPos, false, width: DefaultColumnWidths.Total_Net_Pos, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
+ public static GridColumnSettings total_pnl => new GridColumnSettings(col_id(Columns.TotalPNL), DefaultColumnHeaders.TotalPnL, false, width: DefaultColumnWidths.PnL_Generic, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings pnl_price => new GridColumnSettings(col_id(Columns.PNLPrice), DefaultColumnHeaders.PnLPrice, width: DefaultColumnWidths.PnL_Generic, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static IEnumerable default_sorting_criterion {
@@ -158,6 +158,8 @@ namespace bts.shell {
// ProtoMember 13 cannot be used further
[ProtoMember(14)]
public SecurityType[] security_types;
+ [ProtoMember(15)]
+ public bool[] has_day_trades;
}
}
diff --git a/src/client/spark/Notifications/INotificationService.cs b/src/client/spark/Notifications/INotificationService.cs
index 7f5decc95..a95ac2048 100644
--- a/src/client/spark/Notifications/INotificationService.cs
+++ b/src/client/spark/Notifications/INotificationService.cs
@@ -12,7 +12,6 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Reactive.Linq;
-using OrderTuple = System.ValueTuple;
namespace bts.shell {
interface INotificationService {
@@ -20,40 +19,14 @@ namespace bts.shell {
INotificationServiceDataCache data_cache { get; }
IDisposable link_to_activity(IPredicate predicate, SoundNotification sound);
IDisposable link_to_activity(INotificationPredicate toast_notification_predicate);
- IDisposable link_to_order(IPredicate predicate, SoundNotification sound);
- IDisposable link_to_order(INotificationPredicate toast_notification_predicate);
- }
-
- static class NotificationServiceExtensions {
- /// TODO: remove this extension and force callers to use the appropriate 'link' method in (it is smelly, and is NOT ACTUALLY STRONGLY TYPED)
- public static IDisposable link(this INotificationService notification_service, IPredicate predicate, SoundNotification sound) {
- if (predicate is IPredicate orp)
- return notification_service.link_to_order(orp, sound);
- if (predicate is IPredicate osp) {
- // Note: watch out for implicit types as generic type arguments (although OrderSecurity can be implicitly cast to OrderTuple, IPredicate CANNOT be implicitly cast to IPredicate)
- return notification_service.link_to_order(PredicateBuilder.create(ot => osp.trigger(new OrderSecurity(ot.Item1, ot.Item2))), sound);
- }
- if (predicate is IPredicate ap)
- return notification_service.link_to_activity(ap, sound);
- Log.Ui.error($"Unable to activate sound-trigger (unrecognized predicate type '{typeof(T)}').");
- return Disposable.empty;
- }
-
- /// TODO: remove this extension and force callers to use the appropriate 'link' method in (it is smelly, and is NOT ACTUALLY STRONGLY TYPED)
- public static IDisposable link(this INotificationService notification_service, INotificationPredicate toast_notification_predicate) {
- if (toast_notification_predicate is INotificationPredicate orp)
- return notification_service.link_to_order(orp);
- if (toast_notification_predicate is INotificationPredicate ap)
- return notification_service.link_to_activity(ap);
- Log.Ui.error($"Unable to activate toast-notification-trigger (unrecognized predicate type '{typeof(T)}').");
- return Disposable.empty;
- }
+ IDisposable link_to_order(IPredicate predicate, SoundNotification sound);
+ IDisposable link_to_order(INotificationPredicate toast_notification_predicate);
}
[Export(typeof(INotificationService))]
partial class NotificationService : INotificationService, IDisposable {
readonly NotificationProcessor _activity_notifications;
- readonly NotificationProcessor _order_notifications;
+ readonly NotificationProcessor _order_notifications;
readonly DataCache _data_cache = new DataCache();
IDisposable _dispose;
@@ -62,7 +35,7 @@ namespace bts.shell {
public NotificationService(IBus bus, INotifier notifier, OrdersModel orders_model) {
this.notifier = notifier;
_activity_notifications = new NotificationProcessor(notifier);
- _order_notifications = new NotificationProcessor(notifier);
+ _order_notifications = new NotificationProcessor(notifier);
_dispose = Disposable.Create(
bus.subscribe(SparkTags.LogActivity).Subscribe(_on_activity),
orders_model.on_orders.Subscribe(_on_orders)
@@ -75,8 +48,8 @@ namespace bts.shell {
public IDisposable link_to_activity(IPredicate predicate, SoundNotification sound) => _activity_notifications.link(predicate, sound);
public IDisposable link_to_activity(INotificationPredicate toast_notification_predicate) => _activity_notifications.link(toast_notification_predicate);
- public IDisposable link_to_order(IPredicate predicate, SoundNotification sound) => _order_notifications.link(predicate, sound);
- public IDisposable link_to_order(INotificationPredicate toast_notification_predicate) => _order_notifications.link(toast_notification_predicate);
+ public IDisposable link_to_order(IPredicate predicate, SoundNotification sound) => _order_notifications.link(predicate, sound);
+ public IDisposable link_to_order(INotificationPredicate toast_notification_predicate) => _order_notifications.link(toast_notification_predicate);
public void Dispose() => Disposable.dispose(ref _dispose);
void _on_activity(Activity activity) =>
diff --git a/src/client/spark/Predicates/Data/DiscreteValues/DiscreteStringPredicate.cs b/src/client/spark/Predicates/Data/DiscreteValues/DiscreteStringPredicate.cs
index afba058c3..34e077f30 100644
--- a/src/client/spark/Predicates/Data/DiscreteValues/DiscreteStringPredicate.cs
+++ b/src/client/spark/Predicates/Data/DiscreteValues/DiscreteStringPredicate.cs
@@ -4,7 +4,7 @@ using System;
namespace mbts {
[ProtoContract]
- class DiscreteStringPredicate : IDiscreteValuesPredicateBuilder, IEquatable {
+ class DiscreteStringPredicate : IDiscreteValuesPredicateData, IEquatable {
[ProtoMember(1)]
string[] _values;
[ProtoMember(2)]
diff --git a/src/client/spark/Predicates/Data/DiscreteValues/DiscreteUIntPredicate.cs b/src/client/spark/Predicates/Data/DiscreteValues/DiscreteUIntPredicate.cs
index 97514e6c7..af8ef653b 100644
--- a/src/client/spark/Predicates/Data/DiscreteValues/DiscreteUIntPredicate.cs
+++ b/src/client/spark/Predicates/Data/DiscreteValues/DiscreteUIntPredicate.cs
@@ -4,7 +4,7 @@ using System;
namespace mbts {
[ProtoContract]
- class DiscreteUIntPredicate : IDiscreteValuesPredicateBuilder, IEquatable {
+ class DiscreteUIntPredicate : IDiscreteValuesPredicateData, IEquatable {
[ProtoMember(1)]
uint[] _values;
[ProtoMember(2)]
@@ -16,7 +16,7 @@ namespace mbts {
public uint[] not_in_set { get => _get_set(true); set => _set(true, value); }
public DiscreteValuesOneofCase predicate_type_case => DiscreteValuesPredicateUtils.get_predicate_type_case(_values, _negated);
- public IPredicate create(object obj) => DiscreteValuesPredicateUtils.create(this);
+ public IPredicate create() => DiscreteValuesPredicateUtils.create(this);
public bool Equals(DiscreteUIntPredicate other) => DiscreteValuesPredicateUtils.equals(this, other);
public override bool Equals(object obj) => Equals(obj as DiscreteUIntPredicate);
diff --git a/src/client/spark/Predicates/Data/DiscreteValues/DiscreteValuesPredicate.cs b/src/client/spark/Predicates/Data/DiscreteValues/DiscreteValuesPredicate.cs
index f885c60e9..478eda180 100644
--- a/src/client/spark/Predicates/Data/DiscreteValues/DiscreteValuesPredicate.cs
+++ b/src/client/spark/Predicates/Data/DiscreteValues/DiscreteValuesPredicate.cs
@@ -8,14 +8,14 @@ using System.Collections.Generic;
using System.Linq;
namespace mbts {
- interface IDiscreteValuesPredicateBuilder : IPredicateBuilder {
+ interface IDiscreteValuesPredicateData {
TSingle is_value { get; set; }
TSingle not_value { get; set; }
TMulti in_set { get; set; }
TMulti not_in_set { get; set; }
DiscreteValuesOneofCase predicate_type_case { get; }
}
- interface IDiscreteValuesPredicateBuilder : IDiscreteValuesPredicateBuilder { }
+ interface IDiscreteValuesPredicateData : IDiscreteValuesPredicateData { }
public enum DiscreteValuesOneofCase {
None,
@@ -32,8 +32,8 @@ namespace mbts {
namespace mbts.ui.settings {
static class DiscreteValuesPredicateUtils {
- public static bool equals(IDiscreteValuesPredicateBuilder a, IDiscreteValuesPredicateBuilder b) => a.safe_equals(b, _equals);
- static bool _equals(IDiscreteValuesPredicateBuilder a, IDiscreteValuesPredicateBuilder b) {
+ public static bool equals(IDiscreteValuesPredicateData a, IDiscreteValuesPredicateData b) => a.safe_equals(b, _equals);
+ static bool _equals(IDiscreteValuesPredicateData a, IDiscreteValuesPredicateData b) {
var dvoc = a.predicate_type_case;
if (dvoc != b.predicate_type_case)
return false;
@@ -47,8 +47,8 @@ namespace mbts.ui.settings {
}
}
- public static bool equals(IDiscreteValuesPredicateBuilder a, IDiscreteValuesPredicateBuilder b) => a.safe_equals(b, _equals);
- public static bool _equals(IDiscreteValuesPredicateBuilder a, IDiscreteValuesPredicateBuilder b) {
+ public static bool equals(IDiscreteValuesPredicateData a, IDiscreteValuesPredicateData b) => a.safe_equals(b, _equals);
+ public static bool _equals(IDiscreteValuesPredicateData a, IDiscreteValuesPredicateData b) {
var dvoc = a.predicate_type_case;
if (dvoc != b.predicate_type_case)
return false;
@@ -62,7 +62,7 @@ namespace mbts.ui.settings {
}
}
- public static int hash(IDiscreteValuesPredicateBuilder a) {
+ public static int hash(IDiscreteValuesPredicateData a) {
switch (a.predicate_type_case) {
case DiscreteValuesOneofCase.IsValue: return a.is_value.GetHashCode() % MathUtils.Primes.P_17191;
case DiscreteValuesOneofCase.NotValue: return a.not_value.GetHashCode() % MathUtils.Primes.P_83987;
@@ -72,7 +72,7 @@ namespace mbts.ui.settings {
}
}
- public static int hash(IDiscreteValuesPredicateBuilder a) {
+ public static int hash(IDiscreteValuesPredicateData a) {
switch (a.predicate_type_case) {
case DiscreteValuesOneofCase.IsValue: return a.is_value.GetHashCode() % MathUtils.Primes.P_17191;
case DiscreteValuesOneofCase.NotValue: return a.not_value.GetHashCode() % MathUtils.Primes.P_83987;
@@ -88,7 +88,7 @@ namespace mbts.ui.settings {
(negated ? DiscreteValuesOneofCase.NotValue : DiscreteValuesOneofCase.IsValue) :
(negated ? DiscreteValuesOneofCase.NotInSet : DiscreteValuesOneofCase.IsInSet);
- public static DiscreteValuesOneofCase get_predicate_type_case(IDiscreteValuesPredicateBuilder predicate_builder) {
+ public static DiscreteValuesOneofCase get_predicate_type_case(IDiscreteValuesPredicateData predicate_builder) {
if (predicate_builder.is_value != null) return DiscreteValuesOneofCase.IsValue;
if (predicate_builder.not_value != null) return DiscreteValuesOneofCase.NotValue;
if (predicate_builder.in_set != null) return DiscreteValuesOneofCase.IsInSet;
@@ -96,7 +96,7 @@ namespace mbts.ui.settings {
return DiscreteValuesOneofCase.None;
}
- public static IPredicate create(IDiscreteValuesPredicateBuilder predicate_builder) {
+ public static IPredicate create(IDiscreteValuesPredicateData predicate_builder) {
switch (predicate_builder.predicate_type_case) {
case DiscreteValuesOneofCase.IsValue: return PredicateBuilder.equals(predicate_builder.is_value);
case DiscreteValuesOneofCase.NotValue: return PredicateBuilder.not_equals(predicate_builder.not_value);
@@ -106,7 +106,7 @@ namespace mbts.ui.settings {
}
}
- public static IPredicate create(IDiscreteValuesPredicateBuilder predicate_builder) where T : struct {
+ public static IPredicate create(IDiscreteValuesPredicateData predicate_builder) where T : struct {
switch (predicate_builder.predicate_type_case) {
case DiscreteValuesOneofCase.IsValue: return PredicateBuilder.equals(predicate_builder.is_value.Value);
case DiscreteValuesOneofCase.NotValue: return PredicateBuilder.not_equals(predicate_builder.not_value.Value);
@@ -118,13 +118,13 @@ namespace mbts.ui.settings {
}
static class DiscreteValuesPredicateVMFactory {
public static Dictionary> get_oneofs_value_type(IEnumerable items)
- where T : struct where TPredicate : IDiscreteValuesPredicateBuilder =>
+ where T : struct where TPredicate : IDiscreteValuesPredicateData =>
//
get_oneofs(identity_view_value_collection(items), val => val.Value, val => val, vals => vals ?? Enumerable.Empty(), vals => vals?.ToArray() ?? new T[0], get_identity_view);
public static Dictionary> get_oneofs(
IObservableCollection> items, Func from_single, Func to_single, Func> from_multi, Func, TMulti> to_multi, Func get_view)
- where TPredicate : IDiscreteValuesPredicateBuilder {
+ where TPredicate : IDiscreteValuesPredicateData {
//
return new Dictionary> {
{ DiscreteValuesOneofCase.IsValue, PropertyWrapperVMUtils.create_selector_vm(
@@ -153,14 +153,14 @@ namespace mbts.ui.settings {
public static Dictionary> get_oneofs(
IEnumerable items, Func key, Func from_single, Func to_single, Func> from_multi, Func, TMulti> to_multi)
where TKey : struct, IEquatable
- where TPredicate : IDiscreteValuesPredicateBuilder =>
+ where TPredicate : IDiscreteValuesPredicateData =>
//
get_oneofs(RXCollection.from_enumerable(items.Select>(v => new ViewValueTuple(v, v))), key, from_single, to_single, from_multi, to_multi);
public static Dictionary> get_oneofs(
IObservableCollection> items, Func key, Func from_single, Func to_single, Func> from_multi, Func, TMulti> to_multi)
where TKey : struct, IEquatable
- where TPredicate : IDiscreteValuesPredicateBuilder {
+ where TPredicate : IDiscreteValuesPredicateData {
//
return new Dictionary> {
{ DiscreteValuesOneofCase.IsValue, PropertyWrapperVMUtils.create_keyed_selector_vm, TKey>(
diff --git a/src/client/spark/Predicates/Data/DiscreteValues/ExchangePredicate.cs b/src/client/spark/Predicates/Data/DiscreteValues/ExchangePredicate.cs
index b8d43d093..61d07f88f 100644
--- a/src/client/spark/Predicates/Data/DiscreteValues/ExchangePredicate.cs
+++ b/src/client/spark/Predicates/Data/DiscreteValues/ExchangePredicate.cs
@@ -5,7 +5,7 @@ using System;
namespace mbts {
[ProtoContract]
- class ExchangePredicate : IDiscreteValuesPredicateBuilder, IEquatable {
+ class ExchangePredicate : IDiscreteValuesPredicateData, IEquatable {
[ProtoMember(1)]
Venue[] _values;
[ProtoMember(2)]
@@ -17,7 +17,7 @@ namespace mbts {
public Venue[] not_in_set { get => _get_set(true); set => _set(true, value); }
public DiscreteValuesOneofCase predicate_type_case => DiscreteValuesPredicateUtils.get_predicate_type_case(_values, _negated);
- public IPredicate create(object obj) => DiscreteValuesPredicateUtils.create(this);
+ public IPredicate create() => DiscreteValuesPredicateUtils.create(this);
public bool Equals(ExchangePredicate other) => DiscreteValuesPredicateUtils.equals(this, other);
public override bool Equals(object obj) => Equals(obj as ExchangePredicate);
diff --git a/src/client/spark/Predicates/Data/DiscreteValues/OrderStatusPredicate.cs b/src/client/spark/Predicates/Data/DiscreteValues/OrderStatusPredicate.cs
index 8f30fb79f..441b0f557 100644
--- a/src/client/spark/Predicates/Data/DiscreteValues/OrderStatusPredicate.cs
+++ b/src/client/spark/Predicates/Data/DiscreteValues/OrderStatusPredicate.cs
@@ -5,7 +5,7 @@ using System;
namespace mbts {
[ProtoContract]
- class OrderStatusPredicate : IDiscreteValuesPredicateBuilder, IEquatable {
+ class OrderStatusPredicate : IDiscreteValuesPredicateData, IEquatable {
[ProtoMember(1)]
OrderStatus[] _values;
[ProtoMember(2)]
@@ -17,7 +17,7 @@ namespace mbts {
public OrderStatus[] not_in_set { get => _get_set(true); set => _set(true, value); }
public DiscreteValuesOneofCase predicate_type_case => DiscreteValuesPredicateUtils.get_predicate_type_case(_values, _negated);
- public IPredicate create(object obj) => DiscreteValuesPredicateUtils.create(this);
+ public IPredicate create() => DiscreteValuesPredicateUtils.create(this);
public bool Equals(OrderStatusPredicate other) => DiscreteValuesPredicateUtils.equals(this, other);
public override bool Equals(object obj) => Equals(obj as OrderStatusPredicate);
diff --git a/src/client/spark/Predicates/Data/DiscreteValues/OrderSubTypePredicate.cs b/src/client/spark/Predicates/Data/DiscreteValues/OrderSubTypePredicate.cs
index c27537fde..8a8e10f48 100644
--- a/src/client/spark/Predicates/Data/DiscreteValues/OrderSubTypePredicate.cs
+++ b/src/client/spark/Predicates/Data/DiscreteValues/OrderSubTypePredicate.cs
@@ -5,7 +5,7 @@ using System;
namespace mbts {
[ProtoContract]
- class OrderSubTypePredicate : IDiscreteValuesPredicateBuilder, IEquatable {
+ class OrderSubTypePredicate : IDiscreteValuesPredicateData, IEquatable {
[ProtoMember(1)]
OrderSubType[] _values;
[ProtoMember(2)]
@@ -17,7 +17,7 @@ namespace mbts {
public OrderSubType[] not_in_set { get => _get_set(true); set => _set(true, value); }
public DiscreteValuesOneofCase predicate_type_case => DiscreteValuesPredicateUtils.get_predicate_type_case(_values, _negated);
- public IPredicate create(object obj) => DiscreteValuesPredicateUtils.create(this);
+ public IPredicate create() => DiscreteValuesPredicateUtils.create(this);
public bool Equals(OrderSubTypePredicate other) => DiscreteValuesPredicateUtils.equals(this, other);
public override bool Equals(object obj) => Equals(obj as OrderSubTypePredicate);
diff --git a/src/client/spark/Predicates/Data/DiscreteValues/OrderTypePredicate.cs b/src/client/spark/Predicates/Data/DiscreteValues/OrderTypePredicate.cs
index 9b88ab3a7..719e39fa8 100644
--- a/src/client/spark/Predicates/Data/DiscreteValues/OrderTypePredicate.cs
+++ b/src/client/spark/Predicates/Data/DiscreteValues/OrderTypePredicate.cs
@@ -5,7 +5,7 @@ using OrderType = bts.api.orderman.CustomOrderDefinition.CustomOneofCase;
namespace mbts {
[ProtoContract]
- class OrderTypePredicate : IDiscreteValuesPredicateBuilder, IEquatable {
+ class OrderTypePredicate : IDiscreteValuesPredicateData, IEquatable {
[ProtoMember(1)]
OrderType[] _values;
[ProtoMember(2)]
@@ -17,7 +17,7 @@ namespace mbts {
public OrderType[] not_in_set { get => _get_set(true); set => _set(true, value); }
public DiscreteValuesOneofCase predicate_type_case => DiscreteValuesPredicateUtils.get_predicate_type_case(_values, _negated);
- public IPredicate create(object obj) => DiscreteValuesPredicateUtils.create(this);
+ public IPredicate create() => DiscreteValuesPredicateUtils.create(this);
public bool Equals(OrderTypePredicate other) => DiscreteValuesPredicateUtils.equals(this, other);
public override bool Equals(object obj) => Equals(obj as OrderTypePredicate);
diff --git a/src/client/spark/Predicates/Data/DiscreteValues/TimeInForcePredicate.cs b/src/client/spark/Predicates/Data/DiscreteValues/TimeInForcePredicate.cs
index e56b96d7d..98e5c84e4 100644
--- a/src/client/spark/Predicates/Data/DiscreteValues/TimeInForcePredicate.cs
+++ b/src/client/spark/Predicates/Data/DiscreteValues/TimeInForcePredicate.cs
@@ -5,7 +5,7 @@ using System;
namespace mbts {
[ProtoContract]
- class TimeInForcePredicate : IDiscreteValuesPredicateBuilder, IEquatable {
+ class TimeInForcePredicate : IDiscreteValuesPredicateData, IEquatable {
[ProtoMember(1)]
TimeInForce[] _values;
[ProtoMember(2)]
@@ -17,7 +17,7 @@ namespace mbts {
public TimeInForce[] not_in_set { get => _get_set(true); set => _set(true, value); }
public DiscreteValuesOneofCase predicate_type_case => DiscreteValuesPredicateUtils.get_predicate_type_case(_values, _negate);
- public IPredicate create(object obj) => DiscreteValuesPredicateUtils.create(this);
+ public IPredicate create() => DiscreteValuesPredicateUtils.create(this);
public bool Equals(TimeInForcePredicate other) => DiscreteValuesPredicateUtils.equals(this, other);
public override bool Equals(object obj) => Equals(obj as TimeInForcePredicate);
diff --git a/src/client/spark/Predicates/Data/Events/OrderCanceledEventPredicate.cs b/src/client/spark/Predicates/Data/Events/OrderCanceledEventPredicate.cs
index 9ed71bb6e..ea9172dd1 100644
--- a/src/client/spark/Predicates/Data/Events/OrderCanceledEventPredicate.cs
+++ b/src/client/spark/Predicates/Data/Events/OrderCanceledEventPredicate.cs
@@ -4,7 +4,6 @@ using bts.shell;
using bts.utils;
using mbts.spark;
using mbts.ui.settings;
-using mbts.utils;
using ProtoBuf;
using System;
using System.Collections.Generic;
@@ -14,7 +13,7 @@ namespace mbts {
static class OrderCanceledEventPredicateVMFactory {
public static Dictionary> get_oneofs(IBus bus) =>
new Dictionary> {
- { OrderCanceledEventPredicate.PredicateTypeOneofCase.AnyOrder, PredicateBuilderVMWrapper.create(p => p.security = null) },
+ { OrderCanceledEventPredicate.PredicateTypeOneofCase.AnyOrder, PredicateVMWrapper.create(p => p.security = null) },
{ OrderCanceledEventPredicate.PredicateTypeOneofCase.SecurityOrder, SecurityCriteriaVMFactory.create(bus, o => o.security?.is_value ?? new SecurityCriteria(),
(p, s) => {
if (p.security == null)
@@ -26,7 +25,7 @@ namespace mbts {
}
[ProtoContract]
- class OrderCanceledEventPredicate : IPredicateBuilder, IEquatable {
+ class OrderCanceledEventPredicate : IEquatable {
public enum PredicateTypeOneofCase {
[Description("(any order)")]
AnyOrder,
@@ -52,7 +51,7 @@ namespace mbts {
OrderEventPredicateHelper.create_status_transition_predicate(OrderStatus.Canceled, security, data_cache);
public INotificationPredicate create_toast(INotificationServiceDataCache data_cache) =>
- new MyToaster(security?.create(data_cache), data_cache);
+ new MyToaster(security?.create(), data_cache);
public bool Equals(OrderCanceledEventPredicate other) => other != null && other.security.safe_equals(other.security);
public override bool Equals(object obj) => Equals(obj as OrderCanceledEventPredicate);
diff --git a/src/client/spark/Predicates/Data/Events/OrderCompletedEventPredicate.cs b/src/client/spark/Predicates/Data/Events/OrderCompletedEventPredicate.cs
index f6942d908..a543fecb4 100644
--- a/src/client/spark/Predicates/Data/Events/OrderCompletedEventPredicate.cs
+++ b/src/client/spark/Predicates/Data/Events/OrderCompletedEventPredicate.cs
@@ -4,7 +4,6 @@ using bts.shell;
using bts.utils;
using mbts.spark;
using mbts.ui.settings;
-using mbts.utils;
using ProtoBuf;
using System;
using System.Collections.Generic;
@@ -14,7 +13,7 @@ namespace mbts {
static class OrderCompletedEventPredicateVMFactory {
public static Dictionary> get_oneofs(IBus bus) =>
new Dictionary> {
- { OrderCompletedEventPredicate.PredicateTypeOneofCase.AnyOrder, PredicateBuilderVMWrapper.create(p => p.security = null) },
+ { OrderCompletedEventPredicate.PredicateTypeOneofCase.AnyOrder, PredicateVMWrapper.create(p => p.security = null) },
{ OrderCompletedEventPredicate.PredicateTypeOneofCase.SecurityOrder, SecurityCriteriaVMFactory.create(bus, o => o.security?.is_value ?? new SecurityCriteria(),
(p, s) => {
if (p.security == null)
@@ -26,7 +25,7 @@ namespace mbts {
}
[ProtoContract]
- class OrderCompletedEventPredicate : IPredicateBuilder, IEquatable {
+ class OrderCompletedEventPredicate : IEquatable {
public enum PredicateTypeOneofCase {
[Description("(any order)")]
AnyOrder,
@@ -52,7 +51,7 @@ namespace mbts {
OrderEventPredicateHelper.create_status_transition_predicate(OrderStatus.Completed, security, data_cache);
public INotificationPredicate create_toast(INotificationServiceDataCache data_cache) =>
- new MyToaster(security?.create(data_cache), data_cache);
+ new MyToaster(security?.create(), data_cache);
public bool Equals(OrderCompletedEventPredicate other) => other != null && other.security.safe_equals(other.security);
public override bool Equals(object obj) => Equals(obj as OrderCompletedEventPredicate);
diff --git a/src/client/spark/Predicates/Data/Events/OrderEventPredicateHelper.cs b/src/client/spark/Predicates/Data/Events/OrderEventPredicateHelper.cs
index f9e27e62f..e13a5a908 100644
--- a/src/client/spark/Predicates/Data/Events/OrderEventPredicateHelper.cs
+++ b/src/client/spark/Predicates/Data/Events/OrderEventPredicateHelper.cs
@@ -2,8 +2,6 @@
using bts.api.orderman;
using bts.shell;
using bts.utils;
-using mbts.spark;
-using mbts.utils;
using System;
namespace mbts {
@@ -39,7 +37,7 @@ namespace mbts {
}
public static IPredicate create_status_transition_predicate(OrderStatus status, SecurityPredicate security_predicate, INotificationServiceDataCache data_cache) =>
- new OrderStatusTransitionPredicate(status, security_predicate?.create(data_cache), data_cache);
+ new OrderStatusTransitionPredicate(status, security_predicate?.create(), data_cache);
class OrderStatusTransitionPredicate : IPredicate, IEquatable {
readonly IPredicate _security_predicate;
diff --git a/src/client/spark/Predicates/Data/Events/OrderFilledEventPredicate.cs b/src/client/spark/Predicates/Data/Events/OrderFilledEventPredicate.cs
index 80767eec6..f8ca8f2ab 100644
--- a/src/client/spark/Predicates/Data/Events/OrderFilledEventPredicate.cs
+++ b/src/client/spark/Predicates/Data/Events/OrderFilledEventPredicate.cs
@@ -11,7 +11,7 @@ namespace mbts {
static class OrderFilledEventPredicateVMFactory {
public static Dictionary> get_oneofs(IBus bus) =>
new Dictionary> {
- { OrderFilledEventPredicate.PredicateTypeOneofCase.AnyOrder, PredicateBuilderVMWrapper.create(p => p.security = null) },
+ { OrderFilledEventPredicate.PredicateTypeOneofCase.AnyOrder, PredicateVMWrapper.create(p => p.security = null) },
{ OrderFilledEventPredicate.PredicateTypeOneofCase.SecurityOrder, SecurityCriteriaVMFactory.create(bus, o => o.security?.is_value ?? new SecurityCriteria(),
(p, s) => {
if (p.security == null) {
@@ -24,7 +24,7 @@ namespace mbts {
}
[ProtoContract]
- class OrderFilledEventPredicate : IPredicateBuilder, IEquatable {
+ class OrderFilledEventPredicate : IEquatable {
public enum PredicateTypeOneofCase {
[PredicateCase("(any order)")]
AnyOrder,
@@ -59,7 +59,7 @@ namespace mbts {
public override int GetHashCode() => security == null ? 0 : security.GetHashCode();
FillTriggerModel _create_model(INotificationServiceDataCache nsdc) =>
- new FillTriggerModel(nsdc, security?.create(nsdc));
+ new FillTriggerModel(nsdc, security?.create());
class FillTriggerModel {
readonly IPredicate _security_predicate;
diff --git a/src/client/spark/Predicates/Data/OrderRecordTuplePredicate.cs b/src/client/spark/Predicates/Data/OrderRecordTuplePredicate.cs
index b9a793e55..c137f7d0b 100644
--- a/src/client/spark/Predicates/Data/OrderRecordTuplePredicate.cs
+++ b/src/client/spark/Predicates/Data/OrderRecordTuplePredicate.cs
@@ -56,12 +56,12 @@ namespace mbts {
Func key,
Dictionary> oneofs) where TChildPredicateOneof : struct where TChildPredicate : new() =>
//
- PredicateBuilderVMWrapper.wrap_child_oneof(get, set, key, oneofs);
+ PredicateVMWrapper.wrap_child_oneof(get, set, key, oneofs);
}
}
[ProtoContract]
- class OrderRecordTuplePredicate : INotificationPredicateBuilder, IEquatable {
+ class OrderRecordTuplePredicate : IEquatable {
SecurityPredicate _security;
SidePredicate _side;
DoublePredicate _price, _last_price, _avg_price;
@@ -213,40 +213,37 @@ namespace mbts {
public IPredicate create_predicate(INotificationServiceDataCache data_cache) {
switch (predicate_type_case) {
- case PTOC.Security: return wrap(_security, r => r.security ?? SecurityDataHelper.Defaults.SecurityImmutable);
- case PTOC.Time: return wrap(_time_created, r => r.order.created());
- case PTOC.LastChange: return wrap(_last_change, r => r.order.last_change());
- case PTOC.User: return wrap(_user, r => r.order.user_id());
- case PTOC.Account: return wrap(_account, r => r.order.account_id());
- case PTOC.Exchange: return wrap(_exchange, r => r.security.exchange_or_default());
- case PTOC.TimeInForce: return wrap(_time_in_force, r => r.order.time_in_force());
- case PTOC.OrderType: return wrap(_order_type, r => r.order.order_type());
- case PTOC.SubType: return wrap(_order_sub_type, r => r.order.sub_type());
- case PTOC.Side: return wrap(_side, r => r.order.side());
- case PTOC.Size: return wrap(_quantity, r => r.order.quantity());
- case PTOC.Price: return wrap(_price, r => r.order.price());
- case PTOC.Filled: return wrap(_filled_quantity, r => r.order.filled());
- case PTOC.AvgFilled: return wrap(_avg_price, r => r.order.avg_price());
- case PTOC.LastPrice: return wrap(_last_price, r => r.order.last_price());
- case PTOC.Status: return wrap(_order_status, r => r.order.status());
- case PTOC.LastMessage: return wrap(_last_message, r => r.order.last_msg());
- case PTOC.SecurityKey: return wrap(_security_key, r => r.order.security_key());
- case PTOC.OrderKey: return wrap(_order_key, r => r.order.Key);
- case PTOC.ParentKey: return wrap(_parent_key, r => r.order.ParentKey);
+ case PTOC.Security: return wrap(_security.create(), r => r.security ?? SecurityDataHelper.Defaults.SecurityImmutable);
+ case PTOC.Time: return wrap(_time_created.create(), r => r.order.created());
+ case PTOC.LastChange: return wrap(_last_change.create(), r => r.order.last_change());
+ case PTOC.User: return wrap(_user.create(), r => r.order.user_id());
+ case PTOC.Account: return wrap(_account.create(), r => r.order.account_id());
+ case PTOC.Exchange: return wrap(_exchange.create(), r => r.security.exchange_or_default());
+ case PTOC.TimeInForce: return wrap(_time_in_force.create(), r => r.order.time_in_force());
+ case PTOC.OrderType: return wrap(_order_type.create(), r => r.order.order_type());
+ case PTOC.SubType: return wrap(_order_sub_type.create(), r => r.order.sub_type());
+ case PTOC.Side: return wrap(_side.create(), r => r.order.side());
+ case PTOC.Size: return wrap(_quantity.create(), r => r.order.quantity());
+ case PTOC.Price: return wrap(_price.create(), r => r.order.price());
+ case PTOC.Filled: return wrap(_filled_quantity.create(), r => r.order.filled());
+ case PTOC.AvgFilled: return wrap(_avg_price.create(), r => r.order.avg_price());
+ case PTOC.LastPrice: return wrap(_last_price.create(), r => r.order.last_price());
+ case PTOC.Status: return wrap(_order_status.create(), r => r.order.status());
+ case PTOC.LastMessage: return wrap(_last_message.create(), r => r.order.last_msg());
+ case PTOC.SecurityKey: return wrap(_security_key.create(), r => r.order.security_key());
+ case PTOC.OrderKey: return wrap(_order_key.create(), r => r.order.Key);
+ case PTOC.ParentKey: return wrap(_parent_key.create(), r => r.order.ParentKey);
case PTOC.FilledEvent: return _filled_event.create_predicate(data_cache);
case PTOC.CompletedEvent: return _completed_event.create_predicate(data_cache);
case PTOC.CanceledEvent: return _canceled_event.create(data_cache);
- case PTOC.AttachedTargetOrderKey: return wrap(_attached_target_order_key, r => r.order.attached_target_order_key());
+ case PTOC.AttachedTargetOrderKey: return wrap(_attached_target_order_key.create(), r => r.order.attached_target_order_key());
default: return null;
}
//
- IPredicate wrap(IPredicateBuilder trigger, Func select) =>
- trigger.create(data_cache).wrap(select);
+ IPredicate wrap(IPredicate trigger, Func select) =>
+ trigger.wrap