diff --git a/doc/user/docs/release_notes.md b/doc/user/docs/release_notes.md index 57228870c..be23e6659 100644 --- a/doc/user/docs/release_notes.md +++ b/doc/user/docs/release_notes.md @@ -3,7 +3,8 @@ ### Software Development Kit (SDK) Improvements - Added authentication to API calls - +### Bug Fixes + - The Market View form now honors filters when new securities are added ## 1.4.2 diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewRow.cs b/src/client/spark/Modules/Market/MarketView/MarketViewRow.cs index 8c604dca4..4dce5ec3a 100644 --- a/src/client/spark/Modules/Market/MarketView/MarketViewRow.cs +++ b/src/client/spark/Modules/Market/MarketView/MarketViewRow.cs @@ -35,7 +35,7 @@ namespace mbts.spark { readonly CellProperty _working_bids_text, _working_asks_text; readonly MyOrderSummarizer _order_summarizer = new MyOrderSummarizer(); readonly MDDisplayHelper.SizeFormatter _size_formatter = MDDisplayHelper.get_formatter(MarketSizeDisplay.get_default()); - uint _bid_direct_size, _bid_merged_size, _ask_direct_size, _ask_merged_size; + Property _bid_direct_size, _bid_merged_size, _ask_direct_size, _ask_merged_size; string _bid_merged_size_text, _ask_merged_size_text; ulong _bbo_ref, _last_ref; @@ -45,28 +45,33 @@ namespace mbts.spark { _security_text = smd.security.ToString(); _security_key_text = security_key.ToString(); string format_price(double price) => security.ContractSpec.format(price); - _position = new CellProperty(0); + _position = new CellProperty(this, nameof(position), 0); _bid_price = backing(nameof(bid_price), double.NaN); _ask_price = backing(nameof(ask_price), double.NaN); _last_price = backing(nameof(last_price), double.NaN); - _last_size = new CellProperty(0); + _last_size = new CellProperty(this, nameof(last_size), 0); _day_change = backing(nameof(day_change), double.NaN); _session_low = backing(nameof(session_low), double.NaN); _session_high = backing(nameof(session_high), double.NaN); _settlement = backing(nameof(settlement), double.NaN); - _volume = new CellProperty(0); - _inside_bids = new CellProperty(); - _inside_asks = new CellProperty(); - _working_bid_volume = new CellProperty(); - _working_ask_volume = new CellProperty(); + _volume = new CellProperty(this, nameof(volume), 0); + _inside_bids = new CellProperty(this, nameof(inside_bids)); + _inside_asks = new CellProperty(this, nameof(inside_asks)); + _working_bid_volume = new CellProperty(this, nameof(working_bid_volume)); + _working_ask_volume = new CellProperty(this, nameof(working_ask_volume)); + // + _bid_direct_size = backing(nameof(bid_direct_size), default(uint)); + _bid_merged_size = backing(nameof(bid_merged_size), default(uint)); + _ask_direct_size = backing(nameof(ask_direct_size), default(uint)); + _ask_merged_size = backing(nameof(ask_merged_size), default(uint)); // _working_orders = new ObservableFilterCollection(_orders, o => o.is_active()); _working_bids = new ObservableFilterCollection(_working_orders, o => o.Def.Side == Side.Buy); _working_asks = new ObservableFilterCollection(_working_orders, o => o.Def.Side == Side.Sell); - _working_best_bid = new CellProperty(format_price, double.NaN); - _working_best_ask = new CellProperty(format_price, double.NaN); - _working_bids_text = new CellProperty(string.Empty); - _working_asks_text = new CellProperty(string.Empty); + _working_best_bid = new CellProperty(this, nameof(working_best_bid), format_price, double.NaN); + _working_best_ask = new CellProperty(this, nameof(working_best_ask), format_price, double.NaN); + _working_bids_text = new CellProperty(this, nameof(working_bids_text), string.Empty); + _working_asks_text = new CellProperty(this, nameof(working_asks_text), string.Empty); // default_command = new DelegateCommand(_show_ladder); bid_price_click = new DelegateCommand(() => _show_order_ticket(MarketViewView.Columns.Bid)); @@ -100,15 +105,15 @@ namespace mbts.spark { public double last_price => _last_price.Value; public uint last_size => _last_size.value; public double bid_price => _bid_price.Value; - public uint bid_direct_size => _bid_direct_size; - public uint bid_implied_size => _bid_merged_size - _bid_direct_size; - public uint bid_merged_size => _bid_merged_size; - public string bid_merged_size_text => _bid_merged_size_text ?? (_bid_merged_size_text = _size_formatter(_bid_merged_size, bid_implied_size)); + public uint bid_direct_size => _bid_direct_size.Value; + public uint bid_implied_size => _bid_merged_size.Value - _bid_direct_size.Value; + public uint bid_merged_size => _bid_merged_size.Value; + public string bid_merged_size_text => _bid_merged_size_text ?? (_bid_merged_size_text = _size_formatter(_bid_merged_size.Value, bid_implied_size)); public double ask_price => _ask_price.Value; - public uint ask_direct_size => _ask_direct_size; - public uint ask_implied_size => _ask_merged_size - _ask_direct_size; - public uint ask_merged_size => _ask_merged_size; - public string ask_merged_size_text => _ask_merged_size_text ?? (_ask_merged_size_text = _size_formatter(_ask_merged_size, ask_implied_size)); + public uint ask_direct_size => _ask_direct_size.Value; + public uint ask_implied_size => _ask_merged_size.Value - _ask_direct_size.Value; + public uint ask_merged_size => _ask_merged_size.Value; + public string ask_merged_size_text => _ask_merged_size_text ?? (_ask_merged_size_text = _size_formatter(_ask_merged_size.Value, ask_implied_size)); public ulong volume => _volume.value; public double settlement => _settlement.Value; public double day_change => _day_change.Value; @@ -144,9 +149,9 @@ namespace mbts.spark { bool dirty = false; if (md.md.get_bbo(ref _bbo_ref, out NativePriceSize b, out NativePriceSize a)) { _bid_price.set(b.price); - refresh_size(ref b, ref _bid_direct_size, ref _bid_merged_size, ref _bid_merged_size_text, nameof(bid_merged_size_text)); + refresh_size(ref b, _bid_direct_size, _bid_merged_size, ref _bid_merged_size_text, nameof(bid_merged_size_text)); _ask_price.set(a.price); - refresh_size(ref a, ref _ask_direct_size, ref _ask_merged_size, ref _ask_merged_size_text, nameof(ask_merged_size_text)); + refresh_size(ref a, _ask_direct_size, _ask_merged_size, ref _ask_merged_size_text, nameof(ask_merged_size_text)); _inside_bids.on_next_distinct(_bid_price.Value >= _working_best_bid.value, ref dirty); _inside_asks.on_next_distinct(_ask_price.Value <= _working_best_ask.value, ref dirty); } @@ -162,10 +167,10 @@ namespace mbts.spark { if (dirty) invalidated?.Invoke(); - void refresh_size(ref NativePriceSize nps, ref uint direct, ref uint merged, ref string text, string text_prop) { - if (nps.size != merged || nps.direct_size != direct) { - merged = nps.size; - direct = nps.direct_size; + void refresh_size(ref NativePriceSize nps, Property direct, Property merged, ref string text, string text_prop) { + if (nps.size != merged.Value || nps.direct_size != direct.Value) { + merged.set(nps.size); + direct.set(nps.direct_size); text = null; dirty = true; RaisePropertyChanged(text_prop); @@ -266,7 +271,15 @@ namespace mbts.spark { _working_best_ask.on_next_distinct(_order_summarizer.best_working_ask, ref dirty); _inside_bids.on_next_distinct(_order_summarizer.best_working_bid >= bid_price, ref dirty); _inside_asks.on_next_distinct(_order_summarizer.best_working_ask <= ask_price, ref dirty); - RaisePropertyChanged(nameof(working_bids_text), nameof(working_asks_text)); + + RaisePropertyChanged( + // Implied might not be ever set, so it probably does not RaisePropertyChanged either + // This might be part of the filter funk? + //nameof(bid_implied_size), + //nameof(ask_implied_size), + nameof(working_bids_text), + nameof(working_asks_text) + ); } #endregion diff --git a/src/client/spark/view/Controls/DIYGrid/CellProperty.cs b/src/client/spark/view/Controls/DIYGrid/CellProperty.cs index 758d0474d..754ee552d 100644 --- a/src/client/spark/view/Controls/DIYGrid/CellProperty.cs +++ b/src/client/spark/view/Controls/DIYGrid/CellProperty.cs @@ -1,16 +1,21 @@ -using System; +using mbts.ui.shell; +using System; using System.Reactive.Linq; using System.Reactive.Subjects; namespace mbts.spark { class CellProperty : ISubject { readonly Func _format; + readonly IRaiseNotifyPropertyChanged _owner; + readonly string _prop_name; string _text; - public CellProperty(T initial_value = default) - : this(t => t.ToString(), initial_value) { } + public CellProperty(IRaiseNotifyPropertyChanged owner, string prop_name, T initial_value = default) + : this(owner, prop_name, t => t.ToString(), initial_value) { } - public CellProperty(Func format, T initial_value = default) { + public CellProperty(IRaiseNotifyPropertyChanged owner, string prop_name, Func format, T initial_value = default) { + _owner = owner; + _prop_name = prop_name; _format = format; value = initial_value; } @@ -24,6 +29,7 @@ namespace mbts.spark { if (!value.Equals(this.value)) { OnNext(value); dirty = true; + _owner.raise_notify_property_changed(_prop_name); } } diff --git a/src/client/spark/view/Spark/PAndL/PnLSummaryRow.cs b/src/client/spark/view/Spark/PAndL/PnLSummaryRow.cs index c571fbd3b..0b276cc26 100644 --- a/src/client/spark/view/Spark/PAndL/PnLSummaryRow.cs +++ b/src/client/spark/view/Spark/PAndL/PnLSummaryRow.cs @@ -15,7 +15,7 @@ namespace mbts.spark { class PnLSummaryRow : ViewModelBase, IEquatable, DIYGrid.IRowVM { static readonly SignedDataStore _brushes; readonly PnLDoubleBrushCell _start_pnl, _day_pnl, _total_pnl; - readonly PnLPriceCell _pnl_price, _weighted_average_buy, _weighted_average_sell; + readonly CellProperty _pnl_price, _weighted_average_buy, _weighted_average_sell; (string account, Venue? exchange, string symbol, SecurityImmutable? security, SecurityMD? sec_md, SecurityType? sec_type) key; IEnumerable _fills; double _driver; @@ -38,9 +38,9 @@ namespace mbts.spark { day_short_quantity = day_sell_quant; total_net_position = net_pos; start_net_position = sod_pos; - _pnl_price = new PnLPriceCell(this, nameof(pnl_price)); - _weighted_average_buy = new PnLPriceCell(this, nameof(weighted_average_buy), wavg_buy); - _weighted_average_sell = new PnLPriceCell(this, nameof(weighted_average_sell), wavg_sell); + _pnl_price = new CellProperty(this, nameof(pnl_price), price => this.security.spec_or_default().format(price), 0); + _weighted_average_buy = new CellProperty(this, nameof(weighted_average_buy), price => this.security.spec_or_default().format(price), wavg_buy); + _weighted_average_sell = new CellProperty(this, nameof(weighted_average_sell), price => this.security.spec_or_default().format(price), wavg_sell); _fills = fills; // set the initial pnl and pnl_price when there has been a @@ -193,19 +193,13 @@ namespace mbts.spark { class PnLDoubleBrushCell : CellProperty { Brush _background; - public PnLDoubleBrushCell(PnLSummaryRow owner, string prop) : base(d => double.IsNaN(d) ? string.Empty : d.ToString("N2"), double.NaN) => + public PnLDoubleBrushCell(PnLSummaryRow owner, string prop) : base(owner, prop, d => double.IsNaN(d) ? string.Empty : d.ToString("N2"), double.NaN) => _value_set += _ => { _background = null; - owner.RaisePropertyChanged(prop); }; public Brush background => _background ?? (_background = _brushes.get(value)); } - class PnLPriceCell : CellProperty { - public PnLPriceCell(PnLSummaryRow owner, string prop, double init = 0) - : base(price => owner.security.spec_or_default().format(price), init) => - _value_set += _ => owner.RaisePropertyChanged(prop); - } } } \ No newline at end of file diff --git a/src/lib/api/service_compiler/templates/cpp/client.pb.cc b/src/lib/api/service_compiler/templates/cpp/client.pb.cc index 105646be3..629c29178 100644 --- a/src/lib/api/service_compiler/templates/cpp/client.pb.cc +++ b/src/lib/api/service_compiler/templates/cpp/client.pb.cc @@ -18,7 +18,7 @@ using namespace rxcpp::operators; {{#if server_streaming}} rxcpp::observable<{{cap name}}Update> {{../name}}::subscribe_{{name}}(std::string const&qualifier) { return - _pchannel->subscribe<{{output_type_cpp}}>({{@index}}, "{{name}}/", qualifier) + _pchannel->subscribe<{{output_type_cpp}}>({{@index}}, "{{name}}", qualifier) | (bts::api::reconstitute,const {{key_type.cpptype}}, {{../name}}>()); } rxcpp::observable<{{cap name}}Update> {{../name}}::subscribe_{{name}}() {