refactor: Rename MarketViewView.Columns -> MarketViewColumnType
This commit is contained in:
1 parent
07004179a3
commit
1fa17d63a2
8 files changed
+80
-77
No files matched your search
@@ -1,14 +1,12 @@
|
||||
using mbts.ui;
|
||||
using mbts.ui.spark;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
using static mbts.ui.spark.MarketViewView;
|
||||
|
||||
using CellAnimation = mbts.ui.spark.CellAnimation;
|
||||
using Columns = mbts.spark.MarketViewColumnType;
|
||||
|
||||
namespace mbts.spark {
|
||||
internal partial class MarketViewVM : IDisposable {
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
namespace mbts.ui.spark {
|
||||
readonly struct MarketViewCell {
|
||||
public readonly MarketViewVM.Row row;
|
||||
public readonly MarketViewView.Columns column;
|
||||
public readonly MarketViewColumnType column;
|
||||
|
||||
public MarketViewCell(MarketViewVM.Row row, MarketViewView.Columns column) {
|
||||
public MarketViewCell(MarketViewVM.Row row, MarketViewColumnType column) {
|
||||
this.row = row;
|
||||
this.column = column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace mbts.spark {
|
||||
public enum MarketViewColumnType {
|
||||
None,
|
||||
Security,
|
||||
Volume,
|
||||
Last,
|
||||
LastSpd,
|
||||
LastSize,
|
||||
Position,
|
||||
RawDayPosition,
|
||||
WorkingBids,
|
||||
Bid,
|
||||
BidMergedSize,
|
||||
BidDirectSize,
|
||||
BidImpliedSize,
|
||||
Ask,
|
||||
AskMergedSize,
|
||||
AskDirectSize,
|
||||
AskImpliedSize,
|
||||
WorkingAsks,
|
||||
Settlement,
|
||||
DayChange,
|
||||
SessionLow,
|
||||
SessionHigh,
|
||||
SecurityKey,
|
||||
MarketDescription,
|
||||
ClearedAlias,
|
||||
ProductDescription,
|
||||
HubAlias,
|
||||
StripName,
|
||||
MicCode,
|
||||
Theo,
|
||||
Delta,
|
||||
Gamma,
|
||||
Vega,
|
||||
Theta,
|
||||
Rho
|
||||
}
|
||||
}
|
||||
@@ -101,16 +101,16 @@
|
||||
_working_best_ask = new CellProperty<double>(this, nameof(working_best_ask), format_price, double.NaN);
|
||||
//
|
||||
default_command = new DelegateCommand(_show_ladder);
|
||||
bid_price_click = new DelegateCommand(() => _show_order_ticket(MarketViewView.Columns.Bid));
|
||||
bid_merged_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewView.Columns.BidMergedSize));
|
||||
bid_direct_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewView.Columns.BidDirectSize));
|
||||
bid_implied_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewView.Columns.BidImpliedSize));
|
||||
working_bids_click = new DelegateCommand(() => _show_order_book(MarketViewView.Columns.WorkingBids));
|
||||
ask_price_click = new DelegateCommand(() => _show_order_ticket(MarketViewView.Columns.Ask));
|
||||
ask_merged_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewView.Columns.AskMergedSize));
|
||||
ask_direct_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewView.Columns.AskDirectSize));
|
||||
ask_implied_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewView.Columns.AskImpliedSize));
|
||||
working_asks_click = new DelegateCommand(() => _show_order_book(MarketViewView.Columns.WorkingAsks));
|
||||
bid_price_click = new DelegateCommand(() => _show_order_ticket(MarketViewColumnType.Bid));
|
||||
bid_merged_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewColumnType.BidMergedSize));
|
||||
bid_direct_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewColumnType.BidDirectSize));
|
||||
bid_implied_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewColumnType.BidImpliedSize));
|
||||
working_bids_click = new DelegateCommand(() => _show_order_book(MarketViewColumnType.WorkingBids));
|
||||
ask_price_click = new DelegateCommand(() => _show_order_ticket(MarketViewColumnType.Ask));
|
||||
ask_merged_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewColumnType.AskMergedSize));
|
||||
ask_direct_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewColumnType.AskDirectSize));
|
||||
ask_implied_size_click = new DelegateCommand(() => _show_order_ticket(MarketViewColumnType.AskImpliedSize));
|
||||
working_asks_click = new DelegateCommand(() => _show_order_book(MarketViewColumnType.WorkingAsks));
|
||||
_animation.AnimationsChanged += on_animations_changed;
|
||||
_dispose = Disposable.Create(
|
||||
attach_prop_changed_cb(_bid_direct_size, mk_echo_prop_changed_cb<(uint, uint)>(nameof(bid_direct_size_text))),
|
||||
@@ -333,10 +333,10 @@
|
||||
|
||||
void _show_ladder() => _bus.post(SparkTags.ShowLadderTag, security_md);
|
||||
|
||||
void _show_order_book(MarketViewView.Columns col) {
|
||||
void _show_order_book(MarketViewColumnType col) {
|
||||
switch (col) {
|
||||
case MarketViewView.Columns.WorkingBids: _show_order_book(Side.Buy); break;
|
||||
case MarketViewView.Columns.WorkingAsks: _show_order_book(Side.Sell); break;
|
||||
case MarketViewColumnType.WorkingBids: _show_order_book(Side.Buy); break;
|
||||
case MarketViewColumnType.WorkingAsks: _show_order_book(Side.Sell); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,37 +350,37 @@
|
||||
_bus.post(SparkTags.ShowOrderBookTag, ob_settings);
|
||||
}
|
||||
|
||||
void _show_order_ticket(MarketViewView.Columns col) {
|
||||
void _show_order_ticket(MarketViewColumnType col) {
|
||||
var order = _orders_model.factory.order(security);
|
||||
switch (col) {
|
||||
case MarketViewView.Columns.Bid:
|
||||
case MarketViewColumnType.Bid:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side: Side.Sell), bid_price, 0u));
|
||||
break;
|
||||
case MarketViewView.Columns.BidMergedSize:
|
||||
case MarketViewColumnType.BidMergedSize:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side: Side.Sell), bid_price, bid_merged_size));
|
||||
break;
|
||||
case MarketViewView.Columns.BidDirectSize:
|
||||
case MarketViewColumnType.BidDirectSize:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side: Side.Sell), bid_price, bid_direct_size));
|
||||
break;
|
||||
case MarketViewView.Columns.BidImpliedSize:
|
||||
case MarketViewColumnType.BidImpliedSize:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side: Side.Sell), bid_price, bid_implied_size));
|
||||
break;
|
||||
case MarketViewView.Columns.Ask:
|
||||
case MarketViewColumnType.Ask:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side: Side.Buy), ask_price, 0u));
|
||||
break;
|
||||
case MarketViewView.Columns.AskMergedSize:
|
||||
case MarketViewColumnType.AskMergedSize:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side: Side.Buy), ask_price, ask_merged_size));
|
||||
break;
|
||||
case MarketViewView.Columns.AskDirectSize:
|
||||
case MarketViewColumnType.AskDirectSize:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side: Side.Sell), ask_price, ask_direct_size));
|
||||
break;
|
||||
case MarketViewView.Columns.AskImpliedSize:
|
||||
case MarketViewColumnType.AskImpliedSize:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side: Side.Sell), ask_price, ask_implied_size));
|
||||
break;
|
||||
case MarketViewView.Columns.Last:
|
||||
case MarketViewColumnType.Last:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order, last_price, 0u));
|
||||
break;
|
||||
case MarketViewView.Columns.LastSize:
|
||||
case MarketViewColumnType.LastSize:
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order, last_price, last_size));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ using System.Windows.Media;
|
||||
|
||||
using static bts.shell.MarketViewWindowFactory;
|
||||
using static mbts.ui.controls.DIYGrid;
|
||||
using static mbts.ui.spark.MarketViewView;
|
||||
|
||||
using Columns = mbts.spark.MarketViewColumnType;
|
||||
|
||||
namespace mbts.spark {
|
||||
/// <summary>
|
||||
|
||||
@@ -13,6 +13,8 @@ using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
|
||||
using Columns = mbts.spark.MarketViewColumnType;
|
||||
|
||||
namespace mbts.ui.spark {
|
||||
/// <summary>
|
||||
/// Interaction logic for MarketSheetsView.xaml
|
||||
@@ -32,44 +34,6 @@ namespace mbts.ui.spark {
|
||||
_grid);
|
||||
}
|
||||
|
||||
public enum Columns {
|
||||
None,
|
||||
Security,
|
||||
Volume,
|
||||
Last,
|
||||
LastSpd,
|
||||
LastSize,
|
||||
Position,
|
||||
RawDayPosition,
|
||||
WorkingBids,
|
||||
Bid,
|
||||
BidMergedSize,
|
||||
BidDirectSize,
|
||||
BidImpliedSize,
|
||||
Ask,
|
||||
AskMergedSize,
|
||||
AskDirectSize,
|
||||
AskImpliedSize,
|
||||
WorkingAsks,
|
||||
Settlement,
|
||||
DayChange,
|
||||
SessionLow,
|
||||
SessionHigh,
|
||||
SecurityKey,
|
||||
MarketDescription,
|
||||
ClearedAlias,
|
||||
ProductDescription,
|
||||
HubAlias,
|
||||
StripName,
|
||||
MicCode,
|
||||
Theo,
|
||||
Delta,
|
||||
Gamma,
|
||||
Vega,
|
||||
Theta,
|
||||
Rho
|
||||
}
|
||||
|
||||
public static ExecutedRoutedEventHandler
|
||||
CellClickExecuted => CommandImpl.cell_click;
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ namespace mbts.spark {
|
||||
const string _window_type = "MarketView", _window_type_display_name = "Market View";
|
||||
// make font-color immutable for Side, Size, (the font-color rule is hard-coded: MarketData.bid for Buy orders, MarketData.ask for Sells)
|
||||
static readonly IReadOnlyDictionary<string, GridColumnSettingsFeatureFlags> _col_settings_flags = new Dictionary<string, GridColumnSettingsFeatureFlags> {
|
||||
{ MarketViewView.Columns.Bid.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor | GridColumnSettingsFeatureFlags.ImmutableBackgroundColor },
|
||||
{ MarketViewView.Columns.Ask.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor | GridColumnSettingsFeatureFlags.ImmutableBackgroundColor},
|
||||
{ MarketViewView.Columns.WorkingAsks.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
|
||||
{ MarketViewView.Columns.WorkingBids.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor }
|
||||
{ MarketViewColumnType.Bid.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor | GridColumnSettingsFeatureFlags.ImmutableBackgroundColor },
|
||||
{ MarketViewColumnType.Ask.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor | GridColumnSettingsFeatureFlags.ImmutableBackgroundColor},
|
||||
{ MarketViewColumnType.WorkingAsks.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
|
||||
{ MarketViewColumnType.WorkingBids.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor }
|
||||
};
|
||||
|
||||
readonly OrdersModel _orders_model;
|
||||
@@ -132,11 +132,11 @@ namespace mbts.spark {
|
||||
.Table(SecurityMD.key_fn)
|
||||
.Where(t => t.has_changes())
|
||||
.OnDispatcher());
|
||||
var sort_man = new ColumnSortManager(_vm.columns, MarketViewView.Columns.Security.ToString());
|
||||
var sort_man = new ColumnSortManager(_vm.columns, MarketViewColumnType.Security.ToString());
|
||||
_current_sorting_criteria = _state.sorting_criterion.ToList();
|
||||
sort_man.SortingCriteria = _state.sorting_criterion;
|
||||
_vm.load_filters(_state.filters);
|
||||
_vm.comparer = sort_man.BuildComparer<MarketViewView.Columns, MarketViewVM.Row>(MarketViewVM.get_column_comparer);
|
||||
_vm.comparer = sort_man.BuildComparer<MarketViewColumnType, MarketViewVM.Row>(MarketViewVM.get_column_comparer);
|
||||
_view = new MarketViewView { DataContext = _vm };
|
||||
_view._grid.Sorting += on_grid_sorting;
|
||||
_grid_settings_manager = new SimpleGridSettingsManager<MarketViewVM.Row>(_vm.columns, _col_settings_flags, _vm.rows);
|
||||
@@ -251,7 +251,7 @@ namespace mbts.spark {
|
||||
void on_grid_sorting(object sender, ui.controls.DIYGridSortingEventArgs e) {
|
||||
_sorted_selected_security_criteria_backing = null;
|
||||
sort_man.OnColumnClick(e.Column, KeyboardExtensions.IsShiftDown());
|
||||
_vm.comparer = sort_man.BuildComparer<MarketViewView.Columns, MarketViewVM.Row>(MarketViewVM.get_column_comparer);
|
||||
_vm.comparer = sort_man.BuildComparer<MarketViewColumnType, MarketViewVM.Row>(MarketViewVM.get_column_comparer);
|
||||
_current_sorting_criteria = sort_man.SortingCriteria.ToList();
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using static mbts.ui.controls.DIYGrid;
|
||||
using static mbts.ui.spark.MarketViewView;
|
||||
|
||||
using Columns = mbts.spark.MarketViewColumnType;
|
||||
|
||||
namespace bts.shell {
|
||||
class MarketViewWindowFactory : ShellWindowFactory<MarketViewWindowFactory.StartupData> {
|
||||
|
||||
Reference in new issue
Block a user