making use of new ManualFillTuple
This commit is contained in:
1 parent
7b9c10f47c
commit
464426537e
1 file changed
+13
-12
@@ -1,3 +1,4 @@
|
||||
using bts;
|
||||
using bts.api;
|
||||
using bts.api.position;
|
||||
using bts.collections;
|
||||
@@ -32,21 +33,21 @@ namespace mbts.spark {
|
||||
class ManualFillsVM : DisposableViewModelBase {
|
||||
readonly IBus _bus;
|
||||
readonly OrdersModel _model;
|
||||
readonly OperableCollection<Row, (SecurityImmutable? s, ManualFillImmutable mf), int> _rows;
|
||||
readonly OperableCollection<Row, ManualFillTuple, int> _rows;
|
||||
|
||||
|
||||
public ManualFillsVM(IBus bus, OrdersModel model) {
|
||||
_bus = bus;
|
||||
_model = model;
|
||||
|
||||
_rows = new OperableCollection<Row, (SecurityImmutable? s, ManualFillImmutable mf), int>(
|
||||
(s_mf, _) => new Row(s_mf),
|
||||
s_mf => s_mf.mf.RecordId,
|
||||
Comparer<(SecurityImmutable? s, ManualFillImmutable mf)>.Create((a,b) => a.mf.RecordId.CompareTo(b.mf.RecordId))
|
||||
_rows = new OperableCollection<Row, ManualFillTuple, int>(
|
||||
(mft, _) => new Row(mft),
|
||||
mft => mft.manual_fill.RecordId,
|
||||
Comparer<ManualFillTuple>.Create((a,b) => a.manual_fill.RecordId.CompareTo(b.manual_fill.RecordId))
|
||||
);
|
||||
|
||||
_dispose = Disposable.Create(
|
||||
model.on_manual_fills_securities.OnDispatcher().Subscribe(_rows.update)
|
||||
model.on_manual_fill_tuples.OnDispatcher().Subscribe(_rows.update)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,16 +60,16 @@ namespace mbts.spark {
|
||||
|
||||
}
|
||||
|
||||
public class Row : IEditableObject {
|
||||
class Row : IEditableObject {
|
||||
Hashtable editable_properties = null;
|
||||
|
||||
public Row((SecurityImmutable? s, ManualFillImmutable mf) data) {
|
||||
security = data.s ?? SecurityDataHelper.Defaults.SecurityImmutable;
|
||||
public Row(ManualFillTuple mft) {
|
||||
security = mft.security ?? SecurityDataHelper.Defaults.SecurityImmutable;
|
||||
//account =
|
||||
//user =
|
||||
side = data.mf.Side;
|
||||
size = data.mf.Quantity;
|
||||
price = data.mf.Price;
|
||||
side = mft.manual_fill.Side;
|
||||
size = mft.manual_fill.Quantity;
|
||||
price = mft.manual_fill.Price;
|
||||
}
|
||||
|
||||
public string display_name => security.ToString();
|
||||
|
||||
Reference in new issue
Block a user