diff --git a/src/client/spark/Modules/Trading/ManualFills/ManualFillRow.cs b/src/client/spark/Modules/Trading/ManualFills/ManualFillRow.cs index 94dff1244..d75f9c384 100644 --- a/src/client/spark/Modules/Trading/ManualFills/ManualFillRow.cs +++ b/src/client/spark/Modules/Trading/ManualFills/ManualFillRow.cs @@ -91,19 +91,7 @@ namespace bts.shell.manual_fills { public EditableItemState editable_item_state => _editable_item_state.Value; public ManualFillData data => _data ?? - (_data = new ManualFillData(key, - new ManualFillTuple( - new ManualFillImmutable(new ManualFill { - RecordId = record_id, - AccountId = account?.id ?? 0, - UserId = user?.id ?? 0, - Price = price, - Side = side, - Quantity = size, - SecurityKey = security?.Id ?? 0 - }), - security, account, user)) - ).Value; + (_data = new ManualFillData(key, new ManualFillTuple(new ManualFillImmutable(to_man_fill()), security, account, user))).Value; public void revert() => _committed_snapshot.Dispose(); @@ -119,13 +107,14 @@ namespace bts.shell.manual_fills { }); public ManualFill to_man_fill() => - new ManualFill { - RecordId = record_id, - AccountId = account?.id ?? 0, - UserId = user?.id ?? 0, - Price = price, - Side = side, - Quantity = size, + new ManualFill { + RecordId = record_id, + AccountId = account?.id ?? 0, + AccountName = account?.name ?? string.Empty, + UserId = user?.id ?? 0, + Price = price, + Side = side, + Quantity = size, SecurityKey = security?.Id ?? 0 }; diff --git a/src/client/spark/Modules/Trading/ManualFills/ManualFillRowEditor.xaml b/src/client/spark/Modules/Trading/ManualFills/ManualFillRowEditor.xaml index b0f1886f4..18da3c039 100644 --- a/src/client/spark/Modules/Trading/ManualFills/ManualFillRowEditor.xaml +++ b/src/client/spark/Modules/Trading/ManualFills/ManualFillRowEditor.xaml @@ -7,6 +7,7 @@ xmlns:c="clr-namespace:mbts.ui.controls" xmlns:usp="clr-namespace:mbts.ui.spark" xmlns:sys="clr-namespace:System;assembly=mscorlib" + FocusVisualStyle="{x:Null}" > 4 diff --git a/src/client/spark/Modules/Trading/ManualFills/ManualFillsVM.cs b/src/client/spark/Modules/Trading/ManualFills/ManualFillsVM.cs index 37648a0bb..babfa266e 100644 --- a/src/client/spark/Modules/Trading/ManualFills/ManualFillsVM.cs +++ b/src/client/spark/Modules/Trading/ManualFills/ManualFillsVM.cs @@ -127,8 +127,9 @@ namespace bts.shell.manual_fills { }), null, accounts.FirstOrDefault(), users.FirstOrDefault()))); void _add_fill(ManualFillRow new_row) => - _placeholder_rows.Add((new_row ?? (new_row = row_factory())).placeholder_key.HasValue ? - new_row : throw new InvalidOperationException("New row is already persisted.")); + _placeholder_rows.InsertSorted((new_row ?? (new_row = row_factory())).placeholder_key.HasValue ? + new_row : throw new InvalidOperationException("New row is already persisted."), + _row_key_comparer); async Task _commit_async(IEnumerable rows) { var updates = new List(); diff --git a/src/client/spark/Modules/Trading/ManualFills/ManualFillsView.xaml b/src/client/spark/Modules/Trading/ManualFills/ManualFillsView.xaml index a227fcd1c..22f954abb 100644 --- a/src/client/spark/Modules/Trading/ManualFills/ManualFillsView.xaml +++ b/src/client/spark/Modules/Trading/ManualFills/ManualFillsView.xaml @@ -158,7 +158,26 @@ - + + + + + + + + + + diff --git a/src/client/spark/Modules/Trading/ManualFills/ManualFillsView.xaml.cs b/src/client/spark/Modules/Trading/ManualFills/ManualFillsView.xaml.cs index 5f982e912..78fb5b10b 100644 --- a/src/client/spark/Modules/Trading/ManualFills/ManualFillsView.xaml.cs +++ b/src/client/spark/Modules/Trading/ManualFills/ManualFillsView.xaml.cs @@ -53,6 +53,7 @@ namespace mbts.ui.spark { row_editor.Resources[ManualFillRowEditor.AccountsKey] = vm.accounts; row_editor.Resources[ManualFillRowEditor.UsersKey] = vm.users; row_editor.Resources[ManualFillRowEditor.SidesKey] = vm.sides; + FocusManager.SetIsFocusScope(row_editor, true); var sec_hook = vm.as_demuxer().subscribe(nameof(ManualFillsVM.security_map)).OnDispatcher().Subscribe(v => row_editor.Resources[ManualFillRowEditor.SecuritiesKey] = v); // popup adorner var popup_adorner = new PopupAdorner( @@ -76,6 +77,7 @@ namespace mbts.ui.spark { }; popup_adorner.attach(); popup_adorner.IsOpen = true; + row_editor.Focus(); _transaction = new CompositeDisposable(sec_hook) { destroy_popup }; // local methods void commit_executed(object sender, ExecutedRoutedEventArgs e) { diff --git a/src/lib/api/services/PositionService.proto b/src/lib/api/services/PositionService.proto index 9265c2da6..fa14b930c 100644 --- a/src/lib/api/services/PositionService.proto +++ b/src/lib/api/services/PositionService.proto @@ -23,6 +23,7 @@ message ManualFill { int32 record_id = 1 [(bts.api.key)=true]; uint32 security_key = 2; uint32 account_id = 3; + string account_name = 8; uint32 user_id = 4; api.Side side = 5; uint32 quantity = 6; diff --git a/testing/manual/positions_and_fills/PAndL.txt b/testing/manual/positions_and_fills/PAndL.txt index b2e20e56e..14b66888f 100644 --- a/testing/manual/positions_and_fills/PAndL.txt +++ b/testing/manual/positions_and_fills/PAndL.txt @@ -63,7 +63,7 @@ Check the Totals Footer PnL: 0 Force the SOD process to aggregate the fills Configure your sod time to be after your last fill and before now. - Note that SODTime is currently expressed in UTC, so you'll have to make the appropriate conversion. + Note that SODTime is relative to the server's local time, which in the case of DEV will likely be UTC, so you'll need to supply the appropriate UTC time. Here is a sample config: @@ -116,6 +116,27 @@ Sell a 1 lot as the current bid in ACC A Total Net Pos 2 Total PnL 75 PnL Price 14.0125 (displayed as 14.015) + +Buy a lot at the current bid in ACCA via Trading -> Manual Fills + Click the '+' menu icon from the toolbar along the left side of the window to bring up the Add New popup + Click on the blank security button to launch the security picker + Specify accoutn as ACC A + Specify side as Buy + Specify qty as 1 + Specify price at xxx + + (I haven't actually tested the below since at the time of writing the manual fills are not yet published by the position server, but I believe this is what it should be) + + ACC A: + Start Net Pos -1 + Start PnL -37.5 + Day Long 1 + Day Short 1 + Day PnL 0 + Total Net Pos -1 + Total PnL -12.5 + PnL Price 14.0125 (displayed as 14.015) + Test sorting and filtering