fix: Populate exps list used to generate cols in combo futs grid
Bugs (fixed): * Future positions aren't showing in combo report
This commit is contained in:
1 parent
92dacc5c3c
commit
9447cb67d2
1 file changed
+10
-7
@@ -1,26 +1,30 @@
|
||||
namespace mbts.analytics {
|
||||
using bts.api;
|
||||
using bts.collections;
|
||||
using bts.utils;
|
||||
|
||||
using mbts.ui.controls;
|
||||
using mbts.ui.shell;
|
||||
using mbts.ui.utility;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
class ComboFuturesGrid : DisposableViewModelBase {
|
||||
readonly ObservableCollection<VolSurfaceExpiration> _raw_expirations = new();
|
||||
readonly ObservableSortedCollection<VolSurfaceExpiration> _sorted_expirations = new();
|
||||
/// As <see cref="_expirations"/> is mirrored by <see cref="columns"/>, it must:
|
||||
/// 1) always be sorted
|
||||
/// 2) never contain duplicates (even when synchronizing with a new list of exps),
|
||||
/// since each column corresponds to a single visual element, and visual elements
|
||||
/// cannot exist twice in a visual tree (or in different visual trees, for that matter)
|
||||
readonly ObservableCollection<VolSurfaceExpiration> _expirations = new();
|
||||
readonly ComboReportFutureRow _row = new();
|
||||
|
||||
ComboViewFormat _view_format;
|
||||
|
||||
public ComboFuturesGrid() {
|
||||
_sorted_expirations.AddRange(_raw_expirations);
|
||||
_dispose = Disposable.Create(
|
||||
ObservableAutoWrapper.connect(
|
||||
_sorted_expirations, _sorted_expirations, columns, _column_factory));
|
||||
_expirations, _expirations, columns, _column_factory));
|
||||
}
|
||||
|
||||
public ObservableCollection<BoundColumn> columns { get; } = new();
|
||||
@@ -40,7 +44,7 @@ namespace mbts.analytics {
|
||||
.Select(vse => vse.expiration)
|
||||
.Distinct()
|
||||
.Select(exp_date => new VolSurfaceExpiration(string.Empty, exp_date));
|
||||
_raw_expirations.sync_with_setwise(data.future_expirations.Concat(exp_agg_cols));
|
||||
CollectionHelper.sync_with_never_duplicate(_expirations, exp_agg_cols.Ordered());
|
||||
_row.update(data.get_future_exp_date_map());
|
||||
}
|
||||
|
||||
@@ -55,5 +59,4 @@ namespace mbts.analytics {
|
||||
return new ComboReportSymbolColumn(vse, Security.ContractOneofCase.Future, _view_format);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user