mf_vm: rows should be populated now
This commit is contained in:
1 parent
a7dda587ba
commit
ebc4e202fe
1 file changed
+31
-5
@@ -1,4 +1,6 @@
|
||||
using bts.api;
|
||||
using bts.api.position;
|
||||
using bts.collections;
|
||||
using bts.utils;
|
||||
using mbts.collections;
|
||||
using mbts.persist;
|
||||
@@ -25,11 +27,28 @@ using System.Windows.Media;
|
||||
|
||||
|
||||
namespace mbts.spark {
|
||||
class ManualFillsVM {
|
||||
class ManualFillsVM : DisposableViewModelBase {
|
||||
readonly IBus _bus;
|
||||
readonly OrdersModel _model;
|
||||
readonly OperableCollection<Row, (SecurityImmutable? s, ManualFillImmutable mf), int> _rows;
|
||||
|
||||
public ManualFillsVM() { }
|
||||
|
||||
public ObservableCollection<Row> rows { get; set; }
|
||||
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))
|
||||
);
|
||||
|
||||
_dispose = Disposable.Create(
|
||||
model.on_manual_fills_securities.OnDispatcher().Subscribe(_rows.update)
|
||||
);
|
||||
}
|
||||
|
||||
public ObservableCollection<Row> rows => _rows;
|
||||
|
||||
public ICommand add_fill_cmd { get; }
|
||||
public ICommand modify_fill_cmd { get; }
|
||||
@@ -40,9 +59,16 @@ namespace mbts.spark {
|
||||
|
||||
public class Row : IEditableObject {
|
||||
|
||||
public Row() { }
|
||||
public Row((SecurityImmutable? s, ManualFillImmutable mf) data) {
|
||||
security = data.s ?? SecurityDataHelper.Defaults.SecurityImmutable;
|
||||
//account =
|
||||
//user =
|
||||
side = data.mf.Side;
|
||||
size = data.mf.Quantity;
|
||||
price = data.mf.Price;
|
||||
}
|
||||
|
||||
public string display_name => "a security!";
|
||||
public string display_name => security.ToString();
|
||||
|
||||
public SecurityImmutable security { get; private set; }
|
||||
public string account { get; private set; }
|
||||
|
||||
Reference in new issue
Block a user