refactor: Ensure VolSurfaceWindowSettings lists non-null
This commit is contained in:
1 parent
c6b374a934
commit
0ac028c546
3 files changed
+5
-8
No files matched your search
@@ -19,10 +19,10 @@ namespace mbts.spark {
|
||||
public ui.controls.graph.BTSGraphAxis vol_curve_y_axis { get; set; }
|
||||
|
||||
[ProtoMember(4)]
|
||||
public List<VolSurfaceExpiration> vol_curve_visible_series { get; set; }
|
||||
public List<VolSurfaceExpiration> vol_curve_visible_series { get; } = new();
|
||||
|
||||
[ProtoMember(5)]
|
||||
public List<VolSurfaceExpiration> hidden_exps { get; set; }
|
||||
public List<VolSurfaceExpiration> hidden_exps { get; } = new();
|
||||
|
||||
[ProtoMember(6)]
|
||||
public bool show_mkt_implied_vol { get; set; }
|
||||
|
||||
@@ -61,7 +61,6 @@ namespace mbts.spark {
|
||||
}
|
||||
|
||||
startup_data.vol_curve_y_axis.label_formatter = vol => vol.ToString("P0");
|
||||
startup_data.vol_curve_visible_series ??= new List<VolSurfaceExpiration>();
|
||||
startup_data.vol_curve_graph_settings ??= VolSurfaceGraphSettings.get_default();
|
||||
//_show_mkt_implied_vol = startup_data.show_mkt_implied_vol;
|
||||
_settings = startup_data.vol_curve_graph_settings;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace mbts.spark {
|
||||
namespace mbts.spark {
|
||||
using bts;
|
||||
using bts.api;
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
}
|
||||
|
||||
_model.publish_grid_settings(_grid_settings);
|
||||
var initial_visible_rows = startup_data.hidden_exps ?? new List<VolSurfaceExpiration>();
|
||||
var initial_grid_selected_rows = startup_data.vol_curve_visible_series ?? new List<VolSurfaceExpiration>();
|
||||
vol_curve_vm = new VolSurfaceGraphVM(
|
||||
_model, demux, startup_data, (show_ivol, exp) => _model.publish_new_grid_selection(_request_id, exp, show_ivol));
|
||||
vol_terms_vm = new VolTermsGraphVM(_model, demux);
|
||||
@@ -152,12 +150,12 @@
|
||||
public VolSurfaceWindowSettings get_startup_data() {
|
||||
var rv = new VolSurfaceWindowSettings {
|
||||
id = _vs_id,
|
||||
vol_curve_visible_series = vol_curve_vm.get_visible_series().ToList(),
|
||||
show_mkt_implied_vol = vol_curve_vm.show_implied_vol,
|
||||
hidden_exps = grid.get_hidden_expirations(),
|
||||
vol_curve_graph_settings = vol_curve_vm.get_settings(),
|
||||
macro_grid_settings = _grid_settings
|
||||
};
|
||||
rv.vol_curve_visible_series.AddRange(vol_curve_vm.get_visible_series());
|
||||
rv.hidden_exps.AddRange(grid.get_hidden_expirations());
|
||||
(rv.vol_curve_x_axis, rv.vol_curve_y_axis) = vol_curve_vm.get_graph_axes();
|
||||
return rv;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user