Merge branch 'pnt_nits' of bitbucket.org:bluetradesys/spark into pnt_nits
This commit is contained in:
commit
3758ac6101
7 files changed
+58
-24
No files matched your search
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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}"
|
||||
>
|
||||
<UserControl.Resources>
|
||||
<sys:Double x:Key="HorizontalPush">4</sys:Double>
|
||||
|
||||
@@ -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<ManualFillRow> rows) {
|
||||
var updates = new List<ManualFill>();
|
||||
|
||||
@@ -158,7 +158,26 @@
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox ItemsSource="{Binding DataContext.accounts, RelativeSource={RelativeSource AncestorType=DataGrid}}" SelectedItem="{Binding account, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Grid>
|
||||
<ComboBox
|
||||
x:Name="mutable_view"
|
||||
ItemsSource="{Binding DataContext.accounts, RelativeSource={RelativeSource AncestorType=DataGrid}}"
|
||||
SelectedItem="{Binding account, UpdateSourceTrigger=PropertyChanged}"
|
||||
Visibility="Visible"
|
||||
/>
|
||||
<TextBlock
|
||||
x:Name="readonly_view"
|
||||
Text="{Binding account}"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="Collapsed"
|
||||
/>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding placeholder_key}" Value="{x:Null}">
|
||||
<Setter TargetName="mutable_view" Property="Visibility" Value="Collapsed"/>
|
||||
<Setter TargetName="readonly_view" Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user