Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d7290db63 | ||
|
|
0d0cf11157 | ||
|
|
7b833087e5 | ||
|
|
12f1e026d0 | ||
|
|
762ce06f7c | ||
|
|
9052051872 | ||
|
|
ab5b4e17ad | ||
|
|
4295165427 | ||
|
|
9a1199a058 | ||
|
|
62f1911f35 | ||
|
|
d75c8af729 | ||
|
|
da95ece9fc | ||
|
|
deca2bedb5 | ||
|
|
de64bd843c | ||
|
|
79a8a29bac | ||
|
|
6aaed0e76e | ||
|
|
8072eece66 | ||
|
|
043d826442 | ||
|
|
3bf9fa08e5 | ||
|
|
79a7b8504e | ||
|
|
ffd2dd22c2 | ||
|
|
469e4636e3 |
No files matched your search
@@ -4,6 +4,20 @@ weight = 3
|
||||
sort_by = "weight"
|
||||
insert_anchor_links = "right"
|
||||
+++
|
||||
## 2.9.2
|
||||
### Bug Fixes
|
||||
- Fixed an issue with the exchange simulator that could lead to crossed markets
|
||||
|
||||
## 2.9.1
|
||||
### Bug Fixes
|
||||
- Fixed an issue with trade sound alerts, where in some cases the use of a "In Between" condition could lead to a UI failure.
|
||||
- Fixed an issue with the display of the new raw position column in the market view window.
|
||||
- Fixed the popup label that describes the raw position information in the ladder
|
||||
### Internal Changes
|
||||
- Avoided shipping production configuration defaults that lead to trying to download a position file for the development sftp server.
|
||||
### Api
|
||||
- C# API sample now uses synchronous calls.
|
||||
|
||||
## 2.9.0
|
||||
### User Visible Changes
|
||||
- Improved Workspace management User Interface
|
||||
|
||||
@@ -5,14 +5,12 @@ using bts.spark;
|
||||
using mbts;
|
||||
using mbts.spark;
|
||||
using mbts.ui;
|
||||
using mbts.ui.shell;
|
||||
using mbts.ui.spark;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Reactive.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using LadderSettings = mbts.spark.LadderSettings;
|
||||
|
||||
namespace bts.shell {
|
||||
@@ -32,23 +30,16 @@ namespace bts.shell {
|
||||
_error_reporter = error_reporter;
|
||||
_dispose = Disposable.Create(
|
||||
model.on_orders.OnDispatcher().Subscribe(o => _orders = o),
|
||||
bus.subscribe(SparkTags.SecuritiesTag).OnDispatcher().Subscribe(m => _md_map = m),
|
||||
bus.subscribe(SparkTags.SecuritiesTag).OnDispatcher().Subscribe(m =>_md_map = m),
|
||||
bus.subscribe(SparkTags.ShowOrderTicketFromSecurityTag).OnDispatcher().Subscribe(_show_order_ticket),
|
||||
bus.subscribe(SparkTags.ShowOrderTicketTag).OnDispatcher().Subscribe(_show_order_ticket),
|
||||
bus.subscribe(SparkTags.ShowModifyOrderTag).OnDispatcher().Subscribe(_show_modify_order),
|
||||
bus.subscribe(SparkTags.ShowOrderTicketAtPositionTag).OnDispatcher().Subscribe(_show_order_ticket_at_position)
|
||||
bus.subscribe(SparkTags.ShowModifyOrderTag).OnDispatcher().Subscribe(_show_modify_order)
|
||||
);
|
||||
}
|
||||
|
||||
public void Dispose() =>
|
||||
Disposable.dispose(ref _dispose);
|
||||
|
||||
void _show_order_window_at_position(Window window, Point window_start_position) {
|
||||
foreach (var kv in AlgoStudioModelUtils.get_dynamic_resources(_model.algo_model.ui_configuration))
|
||||
window.Resources[kv.Key] = kv.Value;
|
||||
window.ShowAtPosition(window_start_position, true);
|
||||
}
|
||||
|
||||
void _show_order_window(Window window) {
|
||||
foreach (var kv in AlgoStudioModelUtils.get_dynamic_resources(_model.algo_model.ui_configuration))
|
||||
window.Resources[kv.Key] = kv.Value;
|
||||
@@ -69,14 +60,6 @@ namespace bts.shell {
|
||||
});
|
||||
}
|
||||
|
||||
void _show_order_ticket_at_position((OrderDefinitionImmutable def, double price, uint size, Point window_start_position) ops) {
|
||||
if (_md_map.TryGetValue(ops.def.SecurityKey, out SecurityMD smd))
|
||||
_show_order_window_at_position(new OrderTicket {
|
||||
DataContext = new NewOrderTicketVM(_model, smd, ops.def, ops.price, ops.size,
|
||||
Observable.Return(LadderSettings.Default.calculator_buttons), true, ops.def.Side)
|
||||
}, ops.window_start_position);
|
||||
}
|
||||
|
||||
void _show_modify_order(uint order_key) {
|
||||
if (_orders.state.TryGetValue(order_key, out var ori) && ori.sec.HasValue
|
||||
&& (ori.order.HasDef && ori.order.Def.HasCustomDef && !(ori.order.Def.CustomDef.HasStop || ori.order.Def.CustomDef.HasStopLimit))) {
|
||||
|
||||
@@ -19,9 +19,9 @@ namespace bts.shell
|
||||
class MarketShellModule : IShellModule
|
||||
{
|
||||
[ImportingConstructor]
|
||||
public MarketShellModule(IBus bus, IWindowManager wm, MDConsumer consumer, UserSettingsHub settings_hub, OrdersModel orders_model, [Import(LoginContainer.Exports.UserName)]string user_name) {
|
||||
public MarketShellModule(IBus bus, MDConsumer consumer, UserSettingsHub settings_hub, OrdersModel orders_model, [Import(LoginContainer.Exports.UserName)]string user_name) {
|
||||
_tsf = new TimeAndSalesWindowFactory(this, bus, consumer, settings_hub);
|
||||
_mvf = new MarketViewWindowFactory(this, bus, wm, settings_hub, orders_model);
|
||||
_mvf = new MarketViewWindowFactory(this, bus, settings_hub, orders_model);
|
||||
}
|
||||
|
||||
TimeAndSalesWindowFactory _tsf;
|
||||
|
||||
@@ -15,7 +15,6 @@ using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
using System.Windows.Input;
|
||||
using static mbts.ui.controls.DIYGrid;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class MarketViewVM {
|
||||
@@ -36,15 +35,13 @@ namespace mbts.spark {
|
||||
readonly CellProperty<string> _working_bids_text, _working_asks_text;
|
||||
readonly MyOrderSummarizer _order_summarizer = new MyOrderSummarizer();
|
||||
readonly MDDisplayHelper.SizeFormatter _size_formatter = MDDisplayHelper.get_formatter(MarketSizeDisplay.get_default());
|
||||
readonly MarketViewVM _owner;
|
||||
Property<uint> _bid_direct_size, _bid_merged_size, _ask_direct_size, _ask_merged_size;
|
||||
double _raw_day_position;
|
||||
string _bid_merged_size_text, _ask_merged_size_text;
|
||||
ulong _bbo_ref, _last_ref;
|
||||
|
||||
public Row(IBus bus, SecurityMD smd, OrdersModel orders_model, MarketViewVM owner) : base(smd) {
|
||||
public Row(IBus bus, SecurityMD smd, OrdersModel orders_model) : base(smd) {
|
||||
_bus = bus;
|
||||
_owner = owner;
|
||||
_orders_model = orders_model;
|
||||
_security_text = smd.security.ToString();
|
||||
_security_key_text = security_key.ToString();
|
||||
@@ -78,22 +75,25 @@ namespace mbts.spark {
|
||||
_working_asks_text = new CellProperty<string>(this, nameof(working_asks_text), string.Empty);
|
||||
//
|
||||
default_command = new DelegateCommand(_show_ladder);
|
||||
bid_price_click = new DelegateCommand<(Side side, HyperlinkCell hlc)>((args) => _show_order_ticket(MarketViewView.Columns.Bid, args), (args) => args.side != Side.Undefined && args.hlc != null);
|
||||
bid_merged_size_click = new DelegateCommand<(Side side, HyperlinkCell hlc)>((args) => _show_order_ticket(MarketViewView.Columns.BidMergedSize, args), (args) => args.side != Side.Undefined && args.hlc != null);
|
||||
bid_direct_size_click = new DelegateCommand<(Side side, HyperlinkCell hlc)>((args) => _show_order_ticket(MarketViewView.Columns.BidDirectSize, args), (args) => args.side != Side.Undefined && args.hlc != null);
|
||||
bid_implied_size_click = new DelegateCommand<(Side side, HyperlinkCell hlc)>((args) => _show_order_ticket(MarketViewView.Columns.BidImpliedSize, args), (args) => args.side != Side.Undefined && args.hlc != null);
|
||||
working_bids_click = new DelegateCommand(() => _show_order_book(MarketViewView.Columns.WorkingBids), () => working_bids_text != string.Empty);
|
||||
ask_price_click = new DelegateCommand<(Side side, HyperlinkCell hlc)>((args) => _show_order_ticket(MarketViewView.Columns.Ask, args), (args) => args.side != Side.Undefined && args.hlc != null);
|
||||
ask_merged_size_click = new DelegateCommand<(Side side, HyperlinkCell hlc)>((args) => _show_order_ticket(MarketViewView.Columns.AskMergedSize, args), (args) => args.side != Side.Undefined && args.hlc != null);
|
||||
ask_direct_size_click = new DelegateCommand<(Side side, HyperlinkCell hlc)>((args) => _show_order_ticket(MarketViewView.Columns.AskDirectSize, args), (args) => args.side != Side.Undefined && args.hlc != null);
|
||||
ask_implied_size_click = new DelegateCommand<(Side side, HyperlinkCell hlc)>((args) => _show_order_ticket(MarketViewView.Columns.AskImpliedSize, args), (args) => args.side != Side.Undefined && args.hlc != null);
|
||||
working_asks_click = new DelegateCommand(() => _show_order_book(MarketViewView.Columns.WorkingAsks), () => working_asks_text != string.Empty);
|
||||
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));
|
||||
_animation.AnimationsChanged += on_animations_changed;
|
||||
void on_animations_changed() => RaisePropertyChanged(nameof(animations));
|
||||
_dispose = Disposable.Create(
|
||||
_orders_model.on_security_root_orders(security.Id).OnDispatcher().Subscribe(_on_orders),
|
||||
_position.OnDispatcher().Subscribe(v => _animation.animate_position(v.newval > v.oldval)),
|
||||
_orders_model.on_security_positions(security.Id).OnDispatcher().Subscribe(t => Set(ref _raw_day_position, t.state.Values.Sum(p => p.Item2.raw_day_pos()), nameof(raw_day_position))),
|
||||
_orders_model.on_security_positions(security.Id).OnDispatcher().Subscribe(t => {
|
||||
if (Set(ref _raw_day_position, t.state.Values.Sum(p => p.Item2.raw_day_pos()), nameof(raw_day_position)))
|
||||
raise_invalidated();
|
||||
}),
|
||||
_inside_bids.OnDispatcher().Subscribe(v => _animation.animate_working_bids_inside(v.newval)),
|
||||
_inside_asks.OnDispatcher().Subscribe(v => _animation.animate_working_asks_inside(v.newval)),
|
||||
_day_change.OnDispatcher().Subscribe(v => _animation.animate_day_change(v.newval > v.oldval)),
|
||||
@@ -220,39 +220,38 @@ namespace mbts.spark {
|
||||
_bus.post(SparkTags.ShowOrderBookTag, ob_settings);
|
||||
}
|
||||
|
||||
void _show_order_ticket(MarketViewView.Columns col, (Side side, HyperlinkCell hlc) args) {
|
||||
void _show_order_ticket(MarketViewView.Columns col) {
|
||||
var order = _orders_model.factory.order(security);
|
||||
|
||||
switch (col) {
|
||||
case MarketViewView.Columns.Bid:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, bid_price, 0u, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side:Side.Sell), bid_price, 0u));
|
||||
break;
|
||||
case MarketViewView.Columns.BidMergedSize:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, bid_price, bid_merged_size, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side:Side.Sell), bid_price, bid_merged_size));
|
||||
break;
|
||||
case MarketViewView.Columns.BidDirectSize:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, bid_price, bid_direct_size, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side:Side.Sell), bid_price, bid_direct_size));
|
||||
break;
|
||||
case MarketViewView.Columns.BidImpliedSize:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, bid_price, bid_implied_size, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side:Side.Sell), bid_price, bid_implied_size));
|
||||
break;
|
||||
case MarketViewView.Columns.Ask:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, ask_price, 0u, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side:Side.Buy), ask_price, 0u));
|
||||
break;
|
||||
case MarketViewView.Columns.AskMergedSize:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, ask_price, ask_merged_size, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side:Side.Buy), ask_price, ask_merged_size));
|
||||
break;
|
||||
case MarketViewView.Columns.AskDirectSize:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, ask_price, ask_direct_size, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side:Side.Sell), ask_price, ask_direct_size));
|
||||
break;
|
||||
case MarketViewView.Columns.AskImpliedSize:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, ask_price, ask_implied_size, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order.with(side:Side.Sell), ask_price, ask_implied_size));
|
||||
break;
|
||||
case MarketViewView.Columns.Last:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, last_price, 0u, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order, last_price, 0u));
|
||||
break;
|
||||
case MarketViewView.Columns.LastSize:
|
||||
_owner._raise_open_order_ticket_at_position((order.with(side: args.side), security, last_price, last_size, args.hlc));
|
||||
_bus.post(SparkTags.ShowOrderTicketTag, (order, last_price, last_size));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using bts.api;
|
||||
using bts.api.orderman;
|
||||
using bts.collections;
|
||||
using bts.utils;
|
||||
using mbts.persist;
|
||||
@@ -23,9 +22,6 @@ namespace mbts.spark {
|
||||
readonly OrdersModel _orders_model;
|
||||
IWindowSettingsManager<GridSettings> _settings_manager;
|
||||
|
||||
public event Action<(OrderDefinitionImmutable order_def, SecurityImmutable security, double price, uint size, HyperlinkCell hlc)> open_order_ticket_at_position;
|
||||
internal void _raise_open_order_ticket_at_position((OrderDefinitionImmutable order_def, SecurityImmutable security, double price, uint size, HyperlinkCell hlc) args) => open_order_ticket_at_position?.Invoke(args);
|
||||
|
||||
public MarketViewVM(IBus bus, OrdersModel orders_model, IObservable<StartupData> state, IWindowSettingsManager<GridSettings> settings_manager )
|
||||
: this(bus, orders_model, state, state.SelectManyInSeries(s => s.security_criteria.subscribe_md(bus)), settings_manager) { }
|
||||
|
||||
@@ -45,17 +41,17 @@ namespace mbts.spark {
|
||||
add_col(Columns.Last, "Last", r => r.format_price(r.last_price), nameof(Row.last_price), DefaultColumnWidths.Price, last_price_filter, DataGridFilterKnownTemplates.DoubleMinMax);
|
||||
add_col(Columns.LastSize, merged_size_col_header, r => r.last_size.ToString(), nameof(Row.last_size), DefaultColumnWidths.Size, last_size_filter, DataGridFilterKnownTemplates.UIntMinMax, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_col(Columns.Position, "Pos", r => r.position.ToString(), nameof(Row.position), DefaultColumnWidths.Size, position_filter, DataGridFilterKnownTemplates.IntMinMax, true, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_working_orders_col(Columns.WorkingBids, working_col_header, nameof(Row.working_bids_text), nameof(Row.working_best_bid), nameof(Row.working_bids_click), working_bid_volume_filter, BTSColors.MarketData.bid, Side.Buy, System.Windows.HorizontalAlignment.Right);
|
||||
add_col(Columns.RawDayPosition, "Raw Day Pos", r => SparkUtils.fmt_position(r.raw_day_position), nameof(Row.raw_day_position), DefaultColumnWidths.Size, raw_day_position_filter, DataGridFilterKnownTemplates.DoubleMinMax, true, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_working_orders_col(Columns.WorkingBids, working_col_header, nameof(Row.working_bids_text), nameof(Row.working_best_bid), nameof(Row.working_bids_click), working_bid_volume_filter, BTSColors.MarketData.bid, System.Windows.HorizontalAlignment.Right);
|
||||
add_col(Columns.BidImpliedSize, implied_size_col_header, r => r.bid_implied_size.ToString(), nameof(Row.bid_implied_size), DefaultColumnWidths.ImpliedDirectMergedSize, bid_implied_size_filter, DataGridFilterKnownTemplates.UIntMinMax, font_color: BTSColors.MarketData.bid, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_col(Columns.BidDirectSize, direct_size_col_header, r => r.bid_direct_size.ToString(), nameof(Row.bid_direct_size), DefaultColumnWidths.ImpliedDirectMergedSize, bid_direct_size_filter, DataGridFilterKnownTemplates.UIntMinMax, font_color: BTSColors.MarketData.bid, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_merged_size_col(Columns.BidMergedSize, merged_size_col_header, nameof(Row.bid_merged_size), nameof(Row.bid_merged_size_text), nameof(Row.bid_merged_size_click), bid_merged_size_filter, BTSColors.MarketData.bid, Side.Buy, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_price_col(Columns.Bid, "Bid", nameof(Row.bid_price), nameof(Row.bid_price_click), bid_price_filter, BTSColors.header_text, BTSColors.MarketData.bid, Side.Buy, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_price_col(Columns.Ask, "Ask", nameof(Row.ask_price), nameof(Row.ask_price_click), ask_price_filter, BTSColors.header_text, BTSColors.MarketData.ask, Side.Sell, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_merged_size_col(Columns.AskMergedSize, merged_size_col_header, nameof(Row.ask_merged_size), nameof(Row.ask_merged_size_text), nameof(Row.ask_merged_size_click), ask_merged_size_filter, BTSColors.MarketData.ask, Side.Sell, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_merged_size_col(Columns.BidMergedSize, merged_size_col_header, nameof(Row.bid_merged_size), nameof(Row.bid_merged_size_text), nameof(Row.bid_merged_size_click), bid_merged_size_filter, BTSColors.MarketData.bid, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_price_col(Columns.Bid, "Bid", nameof(Row.bid_price), nameof(Row.bid_price_click), bid_price_filter, BTSColors.header_text, BTSColors.MarketData.bid, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_price_col(Columns.Ask, "Ask", nameof(Row.ask_price), nameof(Row.ask_price_click), ask_price_filter, BTSColors.header_text, BTSColors.MarketData.ask, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_merged_size_col(Columns.AskMergedSize, merged_size_col_header, nameof(Row.ask_merged_size), nameof(Row.ask_merged_size_text), nameof(Row.ask_merged_size_click), ask_merged_size_filter, BTSColors.MarketData.ask, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_col(Columns.AskDirectSize, direct_size_col_header, r => r.ask_direct_size.ToString(), nameof(Row.ask_direct_size), DefaultColumnWidths.ImpliedDirectMergedSize, ask_direct_size_filter, DataGridFilterKnownTemplates.UIntMinMax, font_color: BTSColors.MarketData.ask, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_col(Columns.AskImpliedSize, implied_size_col_header, r => r.ask_implied_size.ToString(), nameof(Row.ask_implied_size), DefaultColumnWidths.ImpliedDirectMergedSize, ask_implied_size_filter, DataGridFilterKnownTemplates.UIntMinMax, font_color: BTSColors.MarketData.ask, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_working_orders_col(Columns.WorkingAsks, working_col_header, nameof(Row.working_asks_text), nameof(Row.working_best_ask), nameof(Row.working_asks_click), working_ask_volume_filter, BTSColors.MarketData.ask, Side.Sell, System.Windows.HorizontalAlignment.Right);
|
||||
add_hl_working_orders_col(Columns.WorkingAsks, working_col_header, nameof(Row.working_asks_text), nameof(Row.working_best_ask), nameof(Row.working_asks_click), working_ask_volume_filter, BTSColors.MarketData.ask, System.Windows.HorizontalAlignment.Right);
|
||||
add_col(Columns.Settlement, "Settlement", r => r.format_price(r.settlement), nameof(Row.settlement), DefaultColumnWidths.Settlement, settlement_filter, DataGridFilterKnownTemplates.DoubleMinMax, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_col(Columns.DayChange, "Change", r => r.format_price(r.day_change), nameof(Row.day_change), DefaultColumnWidths.Price, day_change_filter, DataGridFilterKnownTemplates.DoubleMinMax, true, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
add_col(Columns.SessionLow, "Low", r => r.format_price(r.session_low), nameof(Row.session_low), DefaultColumnWidths.Price, session_low_filter, DataGridFilterKnownTemplates.DoubleMinMax, h_alignment: System.Windows.HorizontalAlignment.Right);
|
||||
@@ -81,20 +77,20 @@ namespace mbts.spark {
|
||||
horizontal_alignment = h_alignment
|
||||
});
|
||||
|
||||
void add_hl_price_col(Columns col_key, string header, string prop, string command_prop, IDataGridColumnFilter filter, Color foreground, Color? background, Side market_side, System.Windows.HorizontalAlignment h_alignment) =>
|
||||
add_hl_col(col_key, header, price_binding(prop), prop, command_prop, filter, DataGridFilterKnownTemplates.DoubleMinMax, DefaultColumnWidths.MViewPrice, foreground, background, market_side, h_alignment);
|
||||
void add_hl_price_col(Columns col_key, string header, string prop, string command_prop, IDataGridColumnFilter filter, Color foreground, Color? background, System.Windows.HorizontalAlignment h_alignment) =>
|
||||
add_hl_col(col_key, header, price_binding(prop), prop, command_prop, filter, DataGridFilterKnownTemplates.DoubleMinMax, DefaultColumnWidths.MViewPrice, foreground, background, h_alignment);
|
||||
|
||||
void add_hl_merged_size_col(Columns col_key, string header, string sort_prop, string text_prop, string command_prop, IDataGridColumnFilter filter, Color foreground, Side market_side, System.Windows.HorizontalAlignment h_alignment) =>
|
||||
add_hl_col(col_key, header, new Binding(text_prop), sort_prop, command_prop, filter, DataGridFilterKnownTemplates.UIntMinMax, DefaultColumnWidths.ImpliedDirectMergedSize, foreground, null, market_side, h_alignment);
|
||||
void add_hl_merged_size_col(Columns col_key, string header, string sort_prop, string text_prop, string command_prop, IDataGridColumnFilter filter, Color foreground, System.Windows.HorizontalAlignment h_alignment) =>
|
||||
add_hl_col(col_key, header, new Binding(text_prop), sort_prop, command_prop, filter, DataGridFilterKnownTemplates.UIntMinMax, DefaultColumnWidths.ImpliedDirectMergedSize, foreground, null, h_alignment);
|
||||
|
||||
void add_hl_working_orders_col(Columns col_key, string header, string text_prop, string sort_prop, string command_prop, IDataGridColumnFilter filter, Color foreground, Side market_side, System.Windows.HorizontalAlignment h_alignment) =>
|
||||
add_hl_col(col_key, header, new Binding(text_prop), sort_prop, command_prop, filter, DataGridFilterKnownTemplates.IntMinMax, working_orders_col_width, foreground, null, market_side, h_alignment);
|
||||
void add_hl_working_orders_col(Columns col_key, string header, string text_prop, string sort_prop, string command_prop, IDataGridColumnFilter filter, Color foreground, System.Windows.HorizontalAlignment h_alignment) =>
|
||||
add_hl_col(col_key, header, new Binding(text_prop), sort_prop, command_prop, filter, DataGridFilterKnownTemplates.IntMinMax, working_orders_col_width, foreground, null, h_alignment);
|
||||
|
||||
void add_hl_col(
|
||||
Columns col_key, string header, BindingBase binding, string prop, string command_prop,
|
||||
IDataGridColumnFilter filter, string filter_template, double width, Color foreground, Color? background, Side market_side, System.Windows.HorizontalAlignment h_alignment = System.Windows.HorizontalAlignment.Left) =>
|
||||
columns.Add(new MarketViewHyperlinkElementColumn(
|
||||
col_key, binding, new Binding(command_prop), filter, filter_template, market_side) {
|
||||
IDataGridColumnFilter filter, string filter_template, double width, Color foreground, Color? background, System.Windows.HorizontalAlignment h_alignment = System.Windows.HorizontalAlignment.Left) =>
|
||||
columns.Add(new HyperlinkElementColumn<Row, Columns>(
|
||||
col_key, binding, new Binding(command_prop), filter, filter_template) {
|
||||
// it's necessary to have this id populated for grid settings
|
||||
id = bts.shell.MarketViewWindowFactory.col_id(col_key),
|
||||
Header = header,
|
||||
@@ -275,7 +271,7 @@ namespace mbts.spark {
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override Row row_factory(SecurityMD smd) => new Row(_bus, smd, _orders_model, this);
|
||||
protected override Row row_factory(SecurityMD smd) => new Row(_bus, smd, _orders_model);
|
||||
protected override void on_row_removed(Row row) => row.Dispose();
|
||||
protected override IEnumerable<SortingCriteria> get_default_sorting() { yield return new SortingCriteria(nameof(Row.security), true); }
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace mbts.spark {
|
||||
readonly OrdersModel _orders_model;
|
||||
readonly AllowOnce _init_guard = new AllowOnce("MarketView");
|
||||
readonly IWindowSettingsManager<GridSettings> _settings_manager;
|
||||
readonly IWindowManager _wm;
|
||||
MarketViewVM _vm;
|
||||
MarketViewView _view;
|
||||
MarketViewWindowFactory.StartupData _state;
|
||||
@@ -34,12 +33,11 @@ namespace mbts.spark {
|
||||
_selected_security_criteria_backing,
|
||||
_sorted_selected_security_criteria_backing;
|
||||
|
||||
public MarketViewWindow(MarketViewWindowFactory factory, IBus bus, OrdersModel orders_model, MarketViewWindowFactory.StartupData state, IWindowSettingsManager<GridSettings> settings_manager, IWindowManager wm)
|
||||
public MarketViewWindow(MarketViewWindowFactory factory, IBus bus, OrdersModel orders_model, MarketViewWindowFactory.StartupData state, IWindowSettingsManager<GridSettings> settings_manager)
|
||||
: base("Market View", bus, factory, SparkCommands.ShowMarketView.icon) {
|
||||
_orders_model = orders_model;
|
||||
_state = state;
|
||||
_settings_manager = settings_manager;
|
||||
_wm = wm;
|
||||
Icon.Freeze();
|
||||
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().market_view ? "MarketView" : null;
|
||||
}
|
||||
@@ -106,20 +104,6 @@ namespace mbts.spark {
|
||||
var state_src = Observable.FromEvent<Action<MarketViewWindowFactory.StartupData>, MarketViewWindowFactory.StartupData>(cb => _state_changed += cb, cb => _state_changed -= cb).StartWith(_state);
|
||||
_vm = new MarketViewVM(_bus, _orders_model, state_src, _settings_manager);
|
||||
_view = new MarketViewView { DataContext = _vm };
|
||||
|
||||
var tab_height = Application.Current.TryFindResource("TabHeight") as Double? ?? 30;
|
||||
_vm.open_order_ticket_at_position += (args) => {
|
||||
if (_view.try_find_ancestor_of_type<System.Windows.Controls.Grid>(out var grid) && grid.Name == "_grid") {
|
||||
var pos = Application.Current.Dispatcher.Invoke(() => _wm.GetPosition(this));
|
||||
var coords = args.hlc.TranslatePoint(new Point(0, 0), grid);
|
||||
/* X = (Floating Window left pos) + (Floating Window BorderThickness) + (window_border left border) */
|
||||
coords.X += pos.left + 1 + 7;
|
||||
/* Y = (Floating Window top pos) + (Floating Window BorderThickness) + (window_border top border) + tab height + row_height */
|
||||
coords.Y += pos.top + 1 + 1 + tab_height + args.hlc.ActualHeight;
|
||||
|
||||
_bus.post(SparkTags.ShowOrderTicketAtPositionTag, (args.order_def, args.price, args.size, coords));
|
||||
}
|
||||
};
|
||||
_view._grid.Sorting += on_grid_sorting;
|
||||
/// The 'CanExecute' plumbing for the cmds below is designed to avoid potentially costly .ToList() operations on the selected_rows/securities.
|
||||
/// Some of the cmds post ITags with data that is, or has, a SecurityCriteria member; the SecurityCriteria constructor creates a new List of the specified securities.
|
||||
|
||||
@@ -21,12 +21,10 @@ namespace bts.shell {
|
||||
readonly IBus _bus;
|
||||
readonly OrdersModel _orders_model;
|
||||
readonly UserSettingsHub _settings_hub;
|
||||
readonly IWindowManager _wm;
|
||||
|
||||
|
||||
public MarketViewWindowFactory(MarketShellModule module, IBus bus, IWindowManager wm, UserSettingsHub settings_hub, OrdersModel orders_model) : base(module, "MarketView") {
|
||||
public MarketViewWindowFactory(MarketShellModule module, IBus bus, UserSettingsHub settings_hub, OrdersModel orders_model) : base(module, "MarketView") {
|
||||
_bus = bus;
|
||||
_wm = wm;
|
||||
_orders_model = orders_model;
|
||||
_settings_hub = settings_hub;
|
||||
_dispose = bus.subscribe(SparkTags.ShowMarketViewTag).OnDispatcher().Subscribe(_show);
|
||||
@@ -41,7 +39,7 @@ namespace bts.shell {
|
||||
_bus.post(SparkTags.ShowWindow, _create(StartupData.Default(criteria)));
|
||||
|
||||
IShellWindow _create(StartupData state) =>
|
||||
new MarketViewWindow(this, _bus, _orders_model, state, _settings_hub.create_mview_settings_manager(state.grid), _wm);
|
||||
new MarketViewWindow(this, _bus, _orders_model, state, _settings_hub.create_mview_settings_manager(state.grid));
|
||||
|
||||
[ProtoContract]
|
||||
public class StartupData {
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace mbts.spark {
|
||||
//
|
||||
//_window_height = backing(nameof(window_height), settings_manager.subscribe_current().OnDispatcher().Select(s => s.zoom_factor), (scale) => scale * 600);
|
||||
//_window_width = backing(nameof(window_width), settings_manager.subscribe_current().OnDispatcher().Select(s => s.zoom_factor), (scale) => scale * 420);
|
||||
position_click_command = new DelegateCommand(() => size_calculator.value = DoubleHelper.safe_convert_to_uint(Math.Abs(_show_day_position ? day_position : position)));
|
||||
position_click_command = new DelegateCommand(() => size_calculator.value = DoubleHelper.safe_convert_to_uint(Math.Abs(_show_day_position ? day_position : (_show_raw_day_position ? _raw_day_position : position))));
|
||||
send_order_command = new AsyncCommand<(double price, Side? side, MouseButton button)>(send_order_async);
|
||||
cancel_command = new AsyncCommand<LadderModel.CancelType>(_model.cancel_orders, true);
|
||||
show_book_command = new DelegateCommand(_show_book);
|
||||
|
||||
@@ -487,6 +487,7 @@
|
||||
<MultiBinding Converter="{x:Static spark:LadderView.PositionToolTipConverter}">
|
||||
<Binding Path="order_properties_vm.selected_account"/>
|
||||
<Binding Path="show_day_position"/>
|
||||
<Binding Path="show_raw_day_position"/>
|
||||
<Binding Path="show_account_position"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
|
||||
@@ -18,32 +18,60 @@ namespace mbts.spark {
|
||||
MaxZoomFactor = 1.5;
|
||||
|
||||
public static IMultiValueConverter PositionToolTipConverter =
|
||||
ValueConverter.create<AccountTuple?, bool, bool, string>((account, show_day_pos, show_total_pos) => {
|
||||
const string day_pos_text = "day", total_pos_text = "total";
|
||||
ValueConverter.create<AccountTuple?, bool, bool, bool, string>((account, show_day_pos, show_raw_day_pos, show_total_pos) => {
|
||||
const string day_pos_text = "day", raw_day_pos_text = "raw day", total_pos_text = "total";
|
||||
if (!account.HasValue)
|
||||
return string.Empty;
|
||||
var sb = new StringBuilderEx(account.Value.name);
|
||||
string primary_pos;
|
||||
if (show_day_pos) {
|
||||
primary_pos = day_pos_text;
|
||||
if (show_total_pos) {
|
||||
sb.Add(" '", primary_pos, " ");
|
||||
sb.Add("(", total_pos_text, ")' ");
|
||||
} else {
|
||||
sb.Add(" ", primary_pos, " ");
|
||||
}
|
||||
} else if (show_total_pos) {
|
||||
primary_pos = total_pos_text;
|
||||
sb.Add(" ", primary_pos, " ");
|
||||
/// Note: 'day,' and 'raw day,' are interchangeable wrt the string format, 'total' however is treated differently.
|
||||
/// Different Formats:
|
||||
// No parts are visible:
|
||||
// null
|
||||
//
|
||||
// 1 part 'foo' is visible:
|
||||
// "<account> foo position
|
||||
// click to copy to size"
|
||||
//
|
||||
// 2 parts 'day' and 'raw day' are visible:
|
||||
// "<account> 'day / raw day' position
|
||||
// click to copy day to size"
|
||||
//
|
||||
// 2 parts 'day' and 'total' are visible:
|
||||
// "<account> 'day (total)' position
|
||||
// click to copy day to size"
|
||||
//
|
||||
|
||||
string primary_pos = null;
|
||||
// part count is incremented in the 'add_part' method
|
||||
int part_count = 0;
|
||||
var sb = new StringBuilderEx();
|
||||
|
||||
if (show_day_pos) add_part(day_pos_text, " / ");
|
||||
if (show_raw_day_pos) add_part(raw_day_pos_text, " / ");
|
||||
if (show_total_pos) add_part(total_pos_text, " (", ")");
|
||||
//
|
||||
if (part_count > 1) {
|
||||
// This is a complex expression (showing more than 1 value) - wrap it in single quotes.
|
||||
// Explicitly state which value will be copied to the size input.
|
||||
sb.Insert(0, "'");
|
||||
sb.Add("'");
|
||||
sb.Add(" position\n(click to copy ", primary_pos, " to size)");
|
||||
} else {
|
||||
// unexpected code path (the button for which this tooltip is destined should be invisible in this case), but no need to throw an exception.
|
||||
return string.Empty;
|
||||
// Only showing 1 value, no need for single quotes,
|
||||
// nor an explicit statement that indicates which value will be copied to the size input.
|
||||
sb.Add(" position\n(click to copy to size)");
|
||||
}
|
||||
sb.Add("position\n(click to copy ");
|
||||
if (show_day_pos && show_total_pos)
|
||||
sb.Add(primary_pos, " position ");
|
||||
sb.Add("to size)");
|
||||
return sb.ToString();
|
||||
|
||||
void add_part(string part_name, string separator = null, string separator_suffix = null) {
|
||||
if (part_count++ > 0) {
|
||||
sb.Add(separator);
|
||||
sb.Add(part_name);
|
||||
sb.Add(separator_suffix);
|
||||
} else {
|
||||
primary_pos = part_name;
|
||||
sb.Add($"{account.Value.name} {part_name}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
internal LadderView(LadderVM vm) {
|
||||
|
||||
@@ -31,16 +31,9 @@ namespace mbts.spark {
|
||||
|
||||
class NewOrderTicketVM : DisposableViewModelBase, IRequestViewClose {
|
||||
readonly Property<SecurityImmutable> _security;
|
||||
readonly bool _is_broker_mode;
|
||||
|
||||
readonly Property<bool> _buy_is_visible;
|
||||
// need this one too b/c the determination is made off of _is_broker_mode as well
|
||||
readonly Property<bool> _sell_is_visible;
|
||||
readonly Property<Side> _broker_mode_side;
|
||||
|
||||
|
||||
public NewOrderTicketVM(OrdersModel model, SecurityMD security_md, OrderDefinitionImmutable def, double price, uint size, IObservable<int[]> calculator_buttons, bool is_broker_mode = false, Side broker_mode_side = Side.Undefined)
|
||||
: this(model, Observable.Return(security_md), Observable.Return(new InlineOrderTicketProperties(model, def, price, size)), calculator_buttons, is_broker_mode, broker_mode_side) { }
|
||||
public NewOrderTicketVM(OrdersModel model, SecurityMD security_md, OrderDefinitionImmutable def, double price, uint size, IObservable<int[]> calculator_buttons)
|
||||
: this(model, Observable.Return(security_md), Observable.Return(new InlineOrderTicketProperties(model, def, price, size)), calculator_buttons) { }
|
||||
|
||||
public NewOrderTicketVM(
|
||||
OrdersModel model,
|
||||
@@ -52,15 +45,9 @@ namespace mbts.spark {
|
||||
OrdersModel model,
|
||||
IObservable<SecurityMD> security_md_source,
|
||||
IObservable<InlineOrderTicketProperties> props_source,
|
||||
IObservable<int[]> calculator_buttons,
|
||||
bool is_broker_mode = false,
|
||||
Side init_broker_mode_side = Side.Undefined
|
||||
IObservable<int[]> calculator_buttons
|
||||
) {
|
||||
_security = backing(nameof(security), security_md_source.Select(smd => smd.security), SecurityDataHelper.Defaults.SecurityImmutable);
|
||||
_is_broker_mode = is_broker_mode;
|
||||
_broker_mode_side = backing(nameof(broker_mode_side), () => init_broker_mode_side);
|
||||
_buy_is_visible = backing(nameof(buy_is_visible), () => !is_broker_mode || (is_broker_mode && broker_mode_side == Side.Buy), nameof(broker_mode_side));
|
||||
_sell_is_visible = backing(nameof(sell_is_visible), () => !is_broker_mode || (is_broker_mode && broker_mode_side == Side.Sell), nameof(broker_mode_side));
|
||||
properties_vm = new OrderPropertiesEditorVM(model, security_md_source, props_source.Select(p => p.order_props));
|
||||
bbo = new BBOVM();
|
||||
send_order = new DelegateCommand<Side>(side => {
|
||||
@@ -71,17 +58,6 @@ namespace mbts.spark {
|
||||
}
|
||||
});
|
||||
set_price_command = new DelegateCommand<double>(set_price);
|
||||
set_price_and_side_command = new DelegateCommand<Tuple<double, Side>>((pair) => {
|
||||
(price, broker_mode_side) = pair;
|
||||
RaisePropertyChanged(nameof(price));
|
||||
});
|
||||
set_size_and_price_and_side_command = new DelegateCommand<Tuple<uint, double, Side>>((triplet) =>
|
||||
{
|
||||
size_calculator.set_value_command?.Execute(triplet.Item1);
|
||||
price = triplet.Item2;
|
||||
RaisePropertyChanged(nameof(price));
|
||||
broker_mode_side = triplet.Item3;
|
||||
});
|
||||
_dispose = Disposable.Create(
|
||||
bbo,
|
||||
security_md_source.OnDispatcher().Subscribe(smd => bbo.security_md = smd),
|
||||
@@ -110,12 +86,6 @@ namespace mbts.spark {
|
||||
public BBOVM bbo { get; }
|
||||
public ICommand send_order { get; }
|
||||
public ICommand set_price_command { get; }
|
||||
public ICommand set_price_and_side_command { get; }
|
||||
public ICommand set_size_and_price_and_side_command { get; }
|
||||
public bool buy_is_visible { get => _buy_is_visible.Value; private set => _buy_is_visible.Value = value; }
|
||||
public bool sell_is_visible { get => _sell_is_visible.Value; private set => _sell_is_visible.Value = value; }
|
||||
public bool is_broker_mode => _is_broker_mode;
|
||||
public Side broker_mode_side { get => _broker_mode_side.Value; private set => _broker_mode_side.Value = value; }
|
||||
|
||||
bool _validate_price() {
|
||||
if (DoubleHelper.IsNaNOrInfinity(price)) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<UserControl x:Class="mbts.ui.spark.OrderModificationControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:msys="clr-namespace:bts.api;assembly=spark_api"
|
||||
xmlns:u="clr-namespace:mbts.ui"
|
||||
xmlns:c="clr-namespace:mbts.ui.controls"
|
||||
xmlns:cv="clr-namespace:mbts.ui.converters"
|
||||
@@ -87,14 +86,7 @@
|
||||
CommitOnEnter="True"
|
||||
Focusable="False"
|
||||
Value="{Binding size_calculator.value}"
|
||||
>
|
||||
<c:TickUpDownNullableUInt.Resources>
|
||||
<Style TargetType="{x:Type TextBox}">
|
||||
<Setter Property="u:TextBoxBehavior.FocusOnLoaded" Value="True"/>
|
||||
<Setter Property="u:TextBoxBehavior.IncrementDecrementOnMouseClick" Value="True" />
|
||||
</Style>
|
||||
</c:TickUpDownNullableUInt.Resources>
|
||||
</c:TickUpDownNullableUInt>
|
||||
/>
|
||||
</Grid>
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -102,29 +94,17 @@
|
||||
<ColumnDefinition Width="{Binding Source={StaticResource HorizontalSpacing}}"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Command="{Binding set_price_and_side_command}" Tag="{u:Enum Buy, Type=msys:Side}" Foreground="{u:BTSColor MarketData.bid}" FontWeight="Bold">
|
||||
<Button Command="{Binding set_price_command}" CommandParameter="{Binding bbo.bid}" Foreground="{u:BTSColor MarketData.bid}" FontWeight="Bold">
|
||||
<MultiBinding Converter="{StaticResource TickDisplayConverter}">
|
||||
<Binding Path="bbo.bid"/>
|
||||
<Binding Path="security.ContractSpec"/>
|
||||
</MultiBinding>
|
||||
<Button.CommandParameter>
|
||||
<MultiBinding Converter="{StaticResource TupleConverter}">
|
||||
<Binding Path="bbo.bid"/>
|
||||
<Binding Path="Tag" RelativeSource="{RelativeSource Self}"/>
|
||||
</MultiBinding>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
<Button Grid.Column="2" Command="{Binding set_price_and_side_command}" Tag="{u:Enum Sell, Type=msys:Side}" Foreground="{u:BTSColor MarketData.ask}" FontWeight="Bold">
|
||||
<Button Grid.Column="2" Command="{Binding set_price_command}" CommandParameter="{Binding bbo.ask}" Foreground="{u:BTSColor MarketData.ask}" FontWeight="Bold">
|
||||
<MultiBinding Converter="{StaticResource TickDisplayConverter}">
|
||||
<Binding Path="bbo.ask"/>
|
||||
<Binding Path="security.ContractSpec"/>
|
||||
</MultiBinding>
|
||||
<Button.CommandParameter>
|
||||
<MultiBinding Converter="{StaticResource TupleConverter}">
|
||||
<Binding Path="bbo.ask"/>
|
||||
<Binding Path="Tag" RelativeSource="{RelativeSource Self}"/>
|
||||
</MultiBinding>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid Grid.Row="2" Grid.Column="2">
|
||||
@@ -134,36 +114,15 @@
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Content="{Binding bbo.bid_size}" Command="{Binding set_size_and_price_and_side_command}"
|
||||
Foreground="{u:BTSColor MarketData.bid}">
|
||||
<Button.CommandParameter>
|
||||
<MultiBinding Converter="{StaticResource TupleConverter}">
|
||||
<Binding Path="bbo.bid_size"/>
|
||||
<Binding Path="bbo.bid"/>
|
||||
<Binding>
|
||||
<Binding.Source>
|
||||
<msys:Side>Buy</msys:Side>
|
||||
</Binding.Source>
|
||||
</Binding>
|
||||
</MultiBinding>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
Content="{Binding bbo.bid_size}" Command="{Binding size_calculator.set_value_command}"
|
||||
CommandParameter="{Binding bbo.bid_size}" Foreground="{u:BTSColor MarketData.bid}"
|
||||
/>
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Content="{Binding bbo.ask_size}" Command="{Binding set_size_and_price_and_side_command}"
|
||||
Foreground="{u:BTSColor MarketData.ask}">
|
||||
<Button.CommandParameter>
|
||||
<MultiBinding Converter="{StaticResource TupleConverter}">
|
||||
<Binding Path="bbo.ask_size"/>
|
||||
<Binding Path="bbo.ask"/>
|
||||
<Binding>
|
||||
<Binding.Source>
|
||||
<msys:Side>Sell</msys:Side>
|
||||
</Binding.Source>
|
||||
</Binding>
|
||||
</MultiBinding>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
Content="{Binding bbo.ask_size}" Command="{Binding size_calculator.set_value_command}"
|
||||
CommandParameter="{Binding bbo.ask_size}"
|
||||
Foreground="{u:BTSColor MarketData.ask}"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="4" Grid.RowSpan="3">
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
u:WindowStyle.SizeToContent="WidthAndHeight"
|
||||
u:WindowStyle.TitleContent="{Binding bbo, Mode=OneWay}"
|
||||
Style="{StaticResource BTSWindowTitleTemplate}"
|
||||
Title="Order Ticket">
|
||||
Style="{StaticResource BTSWindowTitleTemplate}">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -24,12 +23,9 @@
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
<Setter Property="Visibility" Value="{Binding sell_is_visible, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
<Setter Property="Grid.Column" Value="2" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="1" />
|
||||
<Setter Property="Content">
|
||||
<Setter.Value>
|
||||
<TextBlock VerticalAlignment="Center" Foreground="{u:BTSColor UI.alternate_text}">Sell</TextBlock>
|
||||
<Setter.Value>
|
||||
<TextBlock VerticalAlignment="Center" Foreground="{u:BTSColor UI.alternate_text}">Sell</TextBlock>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
@@ -60,16 +56,6 @@
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding is_broker_mode}" Value="True" />
|
||||
<Condition Binding="{Binding sell_is_visible}" Value="True" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3" />
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="BuyButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Background" Value="{u:BTSColor MarketData.bid}" />
|
||||
@@ -78,8 +64,6 @@
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
<Setter Property="Visibility" Value="{Binding buy_is_visible, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="1" />
|
||||
<Setter Property="Content">
|
||||
<Setter.Value>
|
||||
<TextBlock VerticalAlignment="Center" Foreground="{u:BTSColor UI.alternate_text}">Buy</TextBlock>
|
||||
@@ -113,15 +97,6 @@
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding is_broker_mode}" Value="True" />
|
||||
<Condition Binding="{Binding buy_is_visible}" Value="True" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3" />
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
@@ -140,9 +115,9 @@
|
||||
<ColumnDefinition MinWidth="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<usp:OrderModificationControl Grid.ColumnSpan="3" />
|
||||
<Button Grid.Row="2" Style="{StaticResource BuyButton}" Command="{Binding send_order}" CommandParameter="{u:Enum Buy, Type=msys:Side}" />
|
||||
<Button Grid.Row="2" Style="{StaticResource SellButton}" Command="{Binding send_order}" CommandParameter="{u:Enum Sell, Type=msys:Side}" />
|
||||
</Grid>
|
||||
<Button Grid.Row="2" Style="{StaticResource BuyButton}" Command="{Binding send_order}" CommandParameter="{u:Enum Buy, Type=msys:Side}" />
|
||||
<Button Grid.Row="2" Grid.Column="2" Style="{StaticResource SellButton}" Command="{Binding send_order}" CommandParameter="{u:Enum Sell, Type=msys:Side}" />
|
||||
</Grid>
|
||||
<u:WindowStyle.TitleContentTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock>
|
||||
|
||||
@@ -330,13 +330,6 @@ namespace mbts.spark {
|
||||
}
|
||||
}
|
||||
|
||||
public static Side opposite(this Side side) {
|
||||
switch (side) {
|
||||
case Side.Buy: return Side.Sell;
|
||||
case Side.Sell: return Side.Buy;
|
||||
default: return Side.Undefined;
|
||||
}
|
||||
}
|
||||
public static AggressorSide to_aggressor(this Side side) {
|
||||
switch (side) {
|
||||
case Side.Buy: return AggressorSide.Buy;
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace mbts {
|
||||
_second.Equals(other._second);
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
Equals(obj is OrTrigger<T>);
|
||||
Equals(obj as OrTrigger<T>);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
EqualityComparer.aggregate_hash(
|
||||
@@ -256,7 +256,7 @@ namespace mbts {
|
||||
$"OrTrigger ({_first}, {_second})";
|
||||
}
|
||||
|
||||
class GreaterThanTrigger<T> : IPredicate<T> {
|
||||
class GreaterThanTrigger<T> : IPredicate<T>, IEquatable<GreaterThanTrigger<T>> {
|
||||
readonly T _value;
|
||||
readonly IComparer<T> _comparer;
|
||||
|
||||
@@ -268,6 +268,17 @@ namespace mbts {
|
||||
public bool trigger(T value) =>
|
||||
_comparer.Compare(value, _value) > 0;
|
||||
|
||||
public bool Equals(GreaterThanTrigger<T> other) =>
|
||||
other != null &&
|
||||
_comparer.Equals(other._comparer) &&
|
||||
_comparer.Compare(_value, other._value) == 0;
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
Equals(obj as GreaterThanTrigger<T>);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
_value.GetHashCode();
|
||||
|
||||
public override string ToString() =>
|
||||
$"GreaterThanTrigger ({_value})";
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using mbts.ui;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using static mbts.spark.SparkBusData;
|
||||
|
||||
namespace mbts.spark
|
||||
{
|
||||
@@ -30,7 +30,6 @@ namespace mbts.spark
|
||||
public static ITag<uint> ShowModifyOrderTag { get; } = new SparkTag<uint>(nameof(ShowModifyOrderTag));
|
||||
public static ITag<SecurityMD> ShowOrderTicketFromSecurityTag = new SparkTag<SecurityMD>(nameof(ShowOrderTicketFromSecurityTag));
|
||||
public static ITag<(OrderDefinitionImmutable def, double price, uint size)> ShowOrderTicketTag = new SparkTag<(OrderDefinitionImmutable def, double price, uint size)>(nameof(ShowOrderTicketTag));
|
||||
public static ITag<(OrderDefinitionImmutable def, double price, uint size, Point window_start_position)> ShowOrderTicketAtPositionTag = new SparkTag<(OrderDefinitionImmutable def, double price, uint size, Point window_start_position)>(nameof(ShowOrderTicketAtPositionTag));
|
||||
#endregion
|
||||
|
||||
#region Selection/Utility
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using mbts.ui.shell;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,7 +10,6 @@ namespace mbts.ui {
|
||||
void remove(IShellWindow window);
|
||||
bool contains(IShellWindow window);
|
||||
void clear();
|
||||
WindowPosition GetPosition(IShellWindow shell_window);
|
||||
|
||||
// Bring to front of window stack and z-order
|
||||
void MakeVisible(IShellWindow window);
|
||||
|
||||
@@ -12,9 +12,6 @@ using FontFamily = System.Windows.Media.FontFamily;
|
||||
namespace mbts.ui.controls {
|
||||
partial class DIYGrid {
|
||||
public class HyperlinkCell : FrameworkElement, ICommandSource {
|
||||
static Brush _hover_background_highlight = new SolidColorBrush(Colors.Yellow) { Opacity = 0.5 }.frozen();
|
||||
static Brush _hover_foreground_brush = new SolidColorBrush(Colors.Black).frozen();
|
||||
static Pen _hover_underline_pen = new Pen(_hover_foreground_brush, 1);
|
||||
// these fields each represent properties that are accessed frequently,
|
||||
// they are stored locally to reduce repetative DependencyProperty lookups
|
||||
Thickness _padding;
|
||||
@@ -52,14 +49,12 @@ namespace mbts.ui.controls {
|
||||
_font_size = FontSize;
|
||||
_text = Text;
|
||||
_glyph_context = GlyphContext.create(FontFamily, FontWeight);
|
||||
AddHandler(MouseDownEvent, new RoutedEventHandler(on_hyperlink_click_command), true);
|
||||
IsMouseDirectlyOverChanged += (s, e) => {
|
||||
_toggle_mouse_cursor();
|
||||
if (_is_mouse_over_text != IsMouseDirectlyOver)
|
||||
_toggle_mouse_over_text();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region Background
|
||||
public static readonly DependencyProperty BackgroundProperty =
|
||||
WPFHelper.create_dp<Brush, HyperlinkCell>(
|
||||
@@ -226,53 +221,32 @@ namespace mbts.ui.controls {
|
||||
|
||||
#endregion
|
||||
|
||||
#region EnableHoverEffect
|
||||
public static readonly DependencyProperty EnableHoverEffectProperty =
|
||||
WPFHelper.create_dp<bool, HyperlinkCell>(nameof(EnableHoverEffect), false);
|
||||
|
||||
public bool EnableHoverEffect {
|
||||
get => (bool)GetValue(EnableHoverEffectProperty);
|
||||
set => SetValue(EnableHoverEffectProperty, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Paraphrased/Simplified from https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Documents/Hyperlink.cs
|
||||
|
||||
// Note that OnMouseDown doesn't appear to fire when used in a MarketViewHyperlinkElementColumn due to the
|
||||
// InputBindings, we think, setting e.Handled to true.
|
||||
// Instead, we AddHandler to the MouseDownEvent in the constructor and use the
|
||||
// callback below, on_hyperlink_click_command, to reset Handled
|
||||
// so that it continues propagating down to the ListBoxItem. This in turn,
|
||||
// causes the ListBoxItem to be selected, which is then reflected in the
|
||||
// RowSelectionAdorner.
|
||||
protected override void OnMouseDown(MouseButtonEventArgs e) {
|
||||
base.OnMouseDown(e);
|
||||
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) {
|
||||
base.OnMouseLeftButtonDown(e);
|
||||
_check_mouse_over_text(e);
|
||||
if (_is_mouse_over_text) {
|
||||
// Hyperlink should take focus when left mouse button is clicked on it
|
||||
// This is consistent with all ButtonBase controls and current Win32 behavior
|
||||
Focus();
|
||||
|
||||
// It is possible that the mouse state could have changed during all of
|
||||
// the call-outs that have happened so far.
|
||||
if (e.ButtonState == MouseButtonState.Pressed) {
|
||||
// Capture the mouse, and make sure we got it.
|
||||
CaptureMouse();
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
// It is possible that the mouse state could have changed during all of
|
||||
// the call-outs that have happened so far.
|
||||
if (e.ButtonState == MouseButtonState.Pressed) {
|
||||
// Capture the mouse, and make sure we got it.
|
||||
CaptureMouse();
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void on_hyperlink_click_command(object sender, RoutedEventArgs e) {
|
||||
e.Handled = false;
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseButtonEventArgs e) {
|
||||
base.OnMouseUp(e);
|
||||
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) {
|
||||
base.OnMouseLeftButtonUp(e);
|
||||
_check_mouse_over_text(e);
|
||||
if (IsMouseCaptured)
|
||||
ReleaseMouseCapture();
|
||||
if (_can_execute)
|
||||
if (_can_execute && _is_mouse_over_text)
|
||||
CommandHelper.ExecuteCommandSource(this);
|
||||
e.Handled = true;
|
||||
}
|
||||
@@ -305,21 +279,12 @@ namespace mbts.ui.controls {
|
||||
var rs = RenderSize;
|
||||
var rect = new Rect(0, 0, rs.Width, rs.Height);
|
||||
var bg = Background;
|
||||
if (bg != null) {
|
||||
if (_glyph_run != null && IsMouseDirectlyOver && EnableHoverEffect) {
|
||||
drawingContext.DrawRectangle(_hover_background_highlight, null, rect);
|
||||
} else {
|
||||
drawingContext.DrawRectangle(bg, null, rect);
|
||||
}
|
||||
}
|
||||
if (bg != null)
|
||||
drawingContext.DrawRectangle(bg, null, rect);
|
||||
if (_glyph_run != null) {
|
||||
drawingContext.PushClip(new RectangleGeometry(rect));
|
||||
if (IsMouseDirectlyOver) {
|
||||
if (EnableHoverEffect) {
|
||||
drawingContext.DrawGlyphRun(_hover_foreground_brush, _glyph_run);
|
||||
} else {
|
||||
drawingContext.DrawGlyphRun(_foreground, _glyph_run);
|
||||
}
|
||||
drawingContext.DrawGlyphRun(_foreground, _glyph_run);
|
||||
if (_is_mouse_over_text) {
|
||||
// draw underline
|
||||
Point pt;
|
||||
switch (_horizontal_alignment) {
|
||||
@@ -334,15 +299,9 @@ namespace mbts.ui.controls {
|
||||
pt = new Point(0.5 * (ActualWidth - _glyph_width), 0.5 * (ActualHeight + _font_size) + 1);
|
||||
break;
|
||||
}
|
||||
if (EnableHoverEffect) {
|
||||
drawingContext.DrawLine(_hover_underline_pen, pt, new Point(pt.X + _glyph_width, pt.Y));
|
||||
} else {
|
||||
drawingContext.DrawLine(_underline_pen, pt, new Point(pt.X + _glyph_width, pt.Y));
|
||||
}
|
||||
} else {
|
||||
drawingContext.DrawGlyphRun(_foreground, _glyph_run);
|
||||
}
|
||||
drawingContext.DrawLine(_underline_pen, pt, new Point(pt.X + _glyph_width, pt.Y));
|
||||
|
||||
}
|
||||
drawingContext.Pop();
|
||||
}
|
||||
}
|
||||
@@ -372,15 +331,10 @@ namespace mbts.ui.controls {
|
||||
|
||||
void _toggle_mouse_over_text() {
|
||||
_is_mouse_over_text = !_is_mouse_over_text;
|
||||
_toggle_mouse_cursor();
|
||||
}
|
||||
|
||||
void _toggle_mouse_cursor() {
|
||||
if (_glyph_run != null && IsMouseDirectlyOver) {
|
||||
if (_is_mouse_over_text)
|
||||
SetCurrentValue(CursorProperty, Cursors.Hand);
|
||||
} else {
|
||||
else
|
||||
ClearValue(CursorProperty);
|
||||
}
|
||||
InvalidateVisual();
|
||||
}
|
||||
}
|
||||
|
||||
+7
-41
@@ -1,11 +1,9 @@
|
||||
using bts.api;
|
||||
using mbts.spark;
|
||||
using mbts.spark.filters;
|
||||
using mbts.ui.spark;
|
||||
using mbts.spark.filters;
|
||||
using mbts.ui.converters;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using static mbts.ui.controls.DIYGrid;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace mbts.ui.controls {
|
||||
partial class DIYGrid {
|
||||
@@ -14,21 +12,19 @@ namespace mbts.ui.controls {
|
||||
readonly BindingBase _binding, _command_binding;
|
||||
|
||||
public HyperlinkElementColumn(
|
||||
TKey key, BindingBase binding, BindingBase command_binding, IDataGridColumnFilter filter, string filter_template, bool enable_hover_effect = false) : base(key) {
|
||||
TKey key, BindingBase binding, BindingBase command_binding, IDataGridColumnFilter filter, string filter_template) : base(key) {
|
||||
this.filter = filter;
|
||||
this.filter_template = filter_template;
|
||||
_binding = binding;
|
||||
_command_binding = command_binding;
|
||||
this.enable_hover_effect = enable_hover_effect;
|
||||
}
|
||||
|
||||
public IDataGridColumnFilter filter { get; }
|
||||
public string filter_template { get; }
|
||||
public Thickness padding { get; set; } = _default_padding;
|
||||
public bool enable_hover_effect { get; set; }
|
||||
|
||||
|
||||
public override FrameworkElement view_factory() {
|
||||
var hl = new HyperlinkCell { Padding = padding, EnableHoverEffect = enable_hover_effect };
|
||||
var hl = new HyperlinkCell { Padding = padding };
|
||||
hl.SetBinding(HyperlinkCell.ForegroundProperty, new Binding(nameof(font_brush)) { Source = this });
|
||||
hl.SetBinding(HyperlinkCell.TextProperty, _binding);
|
||||
hl.SetBinding(HyperlinkCell.FontFamilyProperty, new Binding(nameof(font_family)) { Source = this });
|
||||
@@ -40,35 +36,5 @@ namespace mbts.ui.controls {
|
||||
return hl;
|
||||
}
|
||||
}
|
||||
|
||||
internal class MarketViewHyperlinkElementColumn : HyperlinkElementColumn<MarketViewVM.Row, MarketViewView.Columns> {
|
||||
|
||||
readonly Side _market_side;
|
||||
|
||||
public MarketViewHyperlinkElementColumn(MarketViewView.Columns key, BindingBase binding, BindingBase command_binding, IDataGridColumnFilter filter, string filter_template, Side market_side) : base(key, binding, command_binding, filter, filter_template, true) {
|
||||
_market_side = market_side;
|
||||
}
|
||||
|
||||
public override FrameworkElement view_factory() {
|
||||
var hl = base.view_factory();
|
||||
hl.InputBindings.Add(new MouseBinding(HyperLinkRoutedCommands.rc, new MouseGesture(MouseAction.LeftClick)) { CommandParameter = _market_side });
|
||||
hl.InputBindings.Add(new MouseBinding(HyperLinkRoutedCommands.rc, new MouseGesture(MouseAction.RightClick)) { CommandParameter = _market_side.opposite() });
|
||||
hl.CommandBindings.Add(new CommandBinding(HyperLinkRoutedCommands.rc, HyperLinkRoutedCommands.create_command_with_coordinates<Side>()));
|
||||
return hl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class HyperLinkRoutedCommands {
|
||||
|
||||
public static RoutedCommand rc = new RoutedCommand();
|
||||
public static ExecutedRoutedEventHandler create_command_with_coordinates<T>() =>
|
||||
(s, e) => {
|
||||
if (s is HyperlinkCell hl && e.Parameter is T orig_param) {
|
||||
hl.Command.TryExecuteIfCan((orig_param, hl));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,9 +34,6 @@
|
||||
u:TextBoxBehavior.EnableArrowKeyTraverse="True"
|
||||
BorderThickness="0"
|
||||
>
|
||||
<TextBox.ContextMenu>
|
||||
<ContextMenu Visibility="Collapsed" />
|
||||
</TextBox.ContextMenu>
|
||||
<TextBox.CommandBindings>
|
||||
<CommandBinding Command="{x:Static u:TextBoxBehavior.SelectAllCommand}" Executed="{x:Static u:TextBoxBehavior.SelectAllCommandExecutedHandler}"/>
|
||||
</TextBox.CommandBindings>
|
||||
|
||||
@@ -429,11 +429,7 @@
|
||||
Name="PART_TextBox"
|
||||
u:TextBoxBehavior.EnableArrowKeyTraverse="True"
|
||||
BorderThickness="0"
|
||||
>
|
||||
<TextBox.ContextMenu>
|
||||
<ContextMenu Visibility="Collapsed" />
|
||||
</TextBox.ContextMenu>
|
||||
</TextBox>
|
||||
/>
|
||||
</c:TickUpDown>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace mbts.ui.converters {
|
||||
|
||||
public static IMultiValueConverter create<TIn1, TIn2, TIn3, TOut>(Func<TIn1, TIn2, TIn3, TOut> convert) =>
|
||||
new AnonymousMultiValueConverter<TIn1, TIn2, TIn3, TOut>(convert);
|
||||
|
||||
public static IMultiValueConverter create<TIn1, TIn2, TIn3, TIn4, TOut>(Func<TIn1, TIn2, TIn3, TIn4, TOut> convert) =>
|
||||
new AnonymousMultiValueConverter<TIn1, TIn2, TIn3, TIn4, TOut>(convert);
|
||||
}
|
||||
|
||||
static class ValueConverters {
|
||||
@@ -92,4 +95,17 @@ namespace mbts.ui.converters {
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
class AnonymousMultiValueConverter<TIn1, TIn2, TIn3, TIn4, TOut> : IMultiValueConverter {
|
||||
readonly Func<TIn1, TIn2, TIn3, TIn4, TOut> _convert;
|
||||
|
||||
public AnonymousMultiValueConverter(Func<TIn1, TIn2, TIn3, TIn4, TOut> convert) => _convert = convert;
|
||||
|
||||
public TOut ErrorValue { get; set; }
|
||||
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) =>
|
||||
ConvertUtils.try_convert_args(values, out TIn1 a, out TIn2 b, out TIn3 c, out TIn4 d) ? _convert(a, b, c, d) : ErrorValue;
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -312,17 +312,5 @@ namespace mbts.ui {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static IDisposable ShowAtPosition(this Window window, Point coords, bool dispose_vm_on_close = false) {
|
||||
if (dispose_vm_on_close) window.Closed += (s, e) => (window.DataContext as IDisposable)?.Dispose();
|
||||
window.set_position(new WindowPosition() { top = (int)coords.Y, left = (int)coords.X });
|
||||
window.Show();
|
||||
return Disposable.Create(() => {
|
||||
// not very elegant, but safe and effective
|
||||
if (window != null) {
|
||||
try { window.Close(); } catch { }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,10 +213,18 @@ namespace bts.md
|
||||
return _data.Values.Where(filt);
|
||||
}
|
||||
|
||||
public SecurityImmutable? find_security(Func<SecurityImmutable, bool> filter)
|
||||
public SecurityImmutable? find_security(Func<SecurityImmutable, bool> filter, TimeSpan? timeout = null)
|
||||
{
|
||||
var fnd = find(filter).TryFirst();
|
||||
return fnd?.security;
|
||||
var deadline = DateTime.UtcNow;
|
||||
if (timeout.HasValue) deadline += timeout.Value;
|
||||
do {
|
||||
var fnd = find(filter).TryFirst();
|
||||
if (fnd.HasValue) {
|
||||
return fnd?.security;
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
} while (DateTime.UtcNow < deadline);
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task<SecurityImmutable?> find_security_async(Func<SecurityImmutable, bool> filter, TimeSpan? timeout = null)
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace bts.sdk
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
public async Task<Result<Response>> send_order(string user, string account ,
|
||||
public Response send_order(string user, string account ,
|
||||
string exch, string sectype, string symbol, string security_desc, string qty, string price = null)
|
||||
{
|
||||
Venue ven = MarketDataSample.parse_venue(exch);
|
||||
@@ -49,7 +49,7 @@ namespace bts.sdk
|
||||
int quan = int.Parse(qty);
|
||||
|
||||
Create cr = new Create();
|
||||
await order_setup(cr, user, account);
|
||||
order_setup(cr, user, account);
|
||||
cr.Price = px;
|
||||
cr.Quantity = Convert.ToUInt32(Math.Abs(quan));
|
||||
cr.NewOrder.Side = quan < 0 ? Side.Sell : Side.Buy;
|
||||
@@ -57,12 +57,15 @@ namespace bts.sdk
|
||||
cr.NewOrder.CustomDef = new CustomOrderDefinition() { Limit = new LimitOrderDefinition() };
|
||||
else
|
||||
cr.NewOrder.CustomDef = new CustomOrderDefinition() { Market = new MarketOrderDefinition() };
|
||||
var sec = await _md.find_security_async(x => x.Glbx.SecurityDesc == security_desc.ToUpper());
|
||||
Console.WriteLine("Fetching security details...");
|
||||
var sec = _md.find_security(x => x.Glbx.SecurityDesc == security_desc.ToUpper(), TimeSpan.FromSeconds(30));
|
||||
if (!sec.HasValue) {
|
||||
Console.WriteLine($"Failed to find security {security_desc}.");
|
||||
return null;
|
||||
}
|
||||
cr.NewOrder.SecurityKey = sec.Value.Id;
|
||||
Result<Response> resp = await _orders.Value.create_order_async(cr);
|
||||
Response resp = _orders.Value.create_order(cr);
|
||||
print_update(resp);
|
||||
if(resp.value != null)
|
||||
print_update(resp.value);
|
||||
//subscribei_ subscribes to a stream of Immutable (in this case FillImmutable) which is nice if you know you don't want to change the fills, which you dont'
|
||||
_disps.Add(_orders.Value.subscribei_fills().Subscribe(x =>
|
||||
{
|
||||
@@ -80,7 +83,7 @@ namespace bts.sdk
|
||||
return resp;
|
||||
}
|
||||
|
||||
static async Task order_setup(Create cr, string username, string accountname)
|
||||
static void order_setup(Create cr, string username, string accountname)
|
||||
{
|
||||
cr.NewOrder = new OrderDefinition();
|
||||
cr.NewOrder.ManualOrderIndicator = ManualOrderIndicator.Yes;
|
||||
@@ -88,12 +91,8 @@ namespace bts.sdk
|
||||
cr.NewOrder.CustomerOrFirm = CustomerOrFirm.Firm;
|
||||
cr.NewOrder.SubType = OrderSubType.None;
|
||||
cr.NewOrder.TimeInForce = TimeInForce.Day;
|
||||
var admin = await _admin.Value.get_admin_data_async(new VoidMessage());
|
||||
if (!admin.success) {
|
||||
Console.Error.WriteLine(admin.error_message);
|
||||
return;
|
||||
}
|
||||
BTSUser user = admin.value.Users.FirstOrDefault( x=> username != null ? x.Name.ToLowerInvariant() == username.ToLowerInvariant() : true );
|
||||
var admin = _admin.Value.get_admin_data(new VoidMessage());
|
||||
BTSUser user = admin.Users.FirstOrDefault( x=> username != null ? x.Name.ToLowerInvariant() == username.ToLowerInvariant() : true );
|
||||
if (user != null)
|
||||
{
|
||||
cr.NewOrder.UserId = (uint)user.Id;
|
||||
@@ -102,11 +101,11 @@ namespace bts.sdk
|
||||
{
|
||||
var accid = user.UserData.AccountPermissions.AccountPermissions.FirstOrDefault();
|
||||
cr.NewOrder.AccountId = (uint)accid.Key;
|
||||
cr.NewOrder.Account = admin.value.Accounts.First(x => x.Id == accid.Key).Name;
|
||||
cr.NewOrder.Account = admin.Accounts.First(x => x.Id == accid.Key).Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
var acc = admin.value.Accounts.FirstOrDefault(x => x.Name.ToLowerInvariant() == accountname.ToLowerInvariant());
|
||||
var acc = admin.Accounts.FirstOrDefault(x => x.Name.ToLowerInvariant() == accountname.ToLowerInvariant());
|
||||
if (acc != null)
|
||||
{
|
||||
cr.NewOrder.Account = acc.Name;
|
||||
|
||||
@@ -13,28 +13,25 @@ namespace bts.sdk
|
||||
|
||||
public class SDKMain
|
||||
{
|
||||
static async Task<LoginResult> login(string user, string pass)
|
||||
{
|
||||
return await Locator.login(user, pass);
|
||||
}
|
||||
private static void user_test()
|
||||
private static void user_test(ServiceContext ctx)
|
||||
{
|
||||
var s = Locator.locate<api.user.AuthService>();
|
||||
var s = ctx.locate<api.user.AuthService>();
|
||||
var r = new api.user.GetUsersRequest();
|
||||
var resp = s.get_users(r);
|
||||
Console.WriteLine("{0}", resp);
|
||||
}
|
||||
public async static Task Main(string[] args)
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
BTS.init();
|
||||
Log.ClientSdk.info("Welcome to the BTS Client Side SDK example");
|
||||
var ctx = new ServiceContext();
|
||||
|
||||
string u = args.FirstOrDefault(x => x.Contains("--user="));
|
||||
string p = args.FirstOrDefault(x => x.Contains("--pass="));
|
||||
u = u?.Replace("--user=", string.Empty) ?? string.Empty;
|
||||
p = p?.Replace("--pass=", string.Empty) ?? string.Empty;
|
||||
|
||||
var lr = await login(u, p);
|
||||
var lr = ctx.login(u,p).Result;
|
||||
if (!lr.success)
|
||||
{
|
||||
Console.WriteLine("Login failure: " + lr.reason);
|
||||
@@ -43,7 +40,7 @@ namespace bts.sdk
|
||||
|
||||
if (args.FirstOrDefault() == "users")
|
||||
{
|
||||
user_test();
|
||||
user_test(ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -52,55 +49,56 @@ namespace bts.sdk
|
||||
if (pu != null)
|
||||
ms = uint.Parse(p.Replace("--pump=", string.Empty));
|
||||
|
||||
MarketDataClient client = new MarketDataClient(ms, Locator.token);
|
||||
CompositeDisposable disp = new CompositeDisposable(client);
|
||||
if (args.Length > 0 && args.FirstOrDefault().Contains("md"))
|
||||
{
|
||||
var s = new MarketDataSample(client);
|
||||
if (args.FirstOrDefault() == "md")
|
||||
MarketDataClient client = new MarketDataClient(ms, ctx.token);
|
||||
using(var disp = new CompositeDisposable(client)) {
|
||||
if (args.Length > 0 && args.FirstOrDefault().Contains("md"))
|
||||
{
|
||||
if (args.Length >= 5)
|
||||
var s = new MarketDataSample(client);
|
||||
if (args.FirstOrDefault() == "md")
|
||||
{
|
||||
s.print_security(args[1], args[2], args[3], args[4]);
|
||||
}
|
||||
else if (args.Length >= 4)
|
||||
{
|
||||
s.print_product(args[1], args[2], args[3]);
|
||||
if (args.Length >= 5)
|
||||
{
|
||||
s.print_security(args[1], args[2], args[3], args[4]);
|
||||
}
|
||||
else if (args.Length >= 4)
|
||||
{
|
||||
s.print_product(args[1], args[2], args[3]);
|
||||
}
|
||||
else
|
||||
md_help();
|
||||
}
|
||||
else
|
||||
md_help();
|
||||
}
|
||||
else if (args.FirstOrDefault() == "order")
|
||||
{
|
||||
OrderSample os = new OrderSample(client);
|
||||
disp.Add(os);
|
||||
order_sample(os, u, args);
|
||||
}
|
||||
else
|
||||
md_help();
|
||||
}
|
||||
else if (args.FirstOrDefault() == "order")
|
||||
{
|
||||
OrderSample os = new OrderSample(client);
|
||||
disp.Add(os);
|
||||
order_sample(os, u, args);
|
||||
}
|
||||
else
|
||||
help();
|
||||
help();
|
||||
|
||||
wait_for_stop(disp);
|
||||
wait_for_stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static async void order_sample(OrderSample os, string user, string[] args)
|
||||
static void order_sample(OrderSample os, string user, string[] args)
|
||||
{
|
||||
if (args.Length >= 10) //--user and --pass are in args[]
|
||||
{
|
||||
await os.send_order(user, args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
||||
os.send_order(user, args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
||||
}
|
||||
else if (args.Length >= 9)
|
||||
{
|
||||
await os.send_order(user, args[1], args[2], args[3], args[4], args[5], args[6]);
|
||||
os.send_order(user, args[1], args[2], args[3], args[4], args[5], args[6]);
|
||||
}
|
||||
else
|
||||
order_help();
|
||||
}
|
||||
|
||||
static void wait_for_stop(IDisposable disp)
|
||||
static void wait_for_stop()
|
||||
{
|
||||
Console.WriteLine("Hit q to stop");
|
||||
ConsoleKeyInfo c;
|
||||
@@ -109,7 +107,6 @@ namespace bts.sdk
|
||||
c = Console.ReadKey();
|
||||
Console.WriteLine();
|
||||
} while (c.KeyChar != 'q');
|
||||
disp.Dispose();
|
||||
}
|
||||
|
||||
static void help()
|
||||
|
||||
@@ -1 +1 @@
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spreader.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;os/os.cpp;os/tests/os_tests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;utils/AuthSessionManager.cpp;utils/AuthToken.cpp;utils/Dispatcher.cpp;utils/GrowableSPSCQueue.cpp;utils/HTTPStream.cpp;utils/PBUtils.cpp;utils/Puid.cpp;utils/SecureLogon.cpp;utils/SharedMemory.cpp;utils/Sqlite_utils.cpp;utils/Uuid.cpp;utils/crypto/CipherType.cpp;utils/crypto/CryptoInit.cpp;utils/crypto/Digest.cpp;utils/crypto/KeyCodeHelper.cpp;utils/crypto/PasswordCallbaLine truncated
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spreader.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;os/os.cpp;os/tests/os_tests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;utils/AuthSessionManager.cpp;utils/AuthToken.cpp;utils/Dispatcher.cpp;utils/GrowableSPSCQueue.cpp;utils/HTTPStream.cpp;utils/PBUtils.cpp;utils/Puid.cpp;utils/SecureLogoLine truncated
|
||||
@@ -4,7 +4,7 @@ Logging {
|
||||
console { default_level: "Error" }
|
||||
syslog { default_level: "Info" }
|
||||
file { default_level: "Info" }
|
||||
initial_queue_size: 128
|
||||
initial_queue_size: 1024
|
||||
max_queue_growth: 100
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,15 @@ GMI_SymbolMap {
|
||||
sym { gmi: "05" spark: "ZS" venue: VENUE_GLBX price_multiplier: 100.0}
|
||||
sym { gmi: "KW" spark: "KE" venue: VENUE_GLBX price_multiplier: 100.0}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GMI_Import {
|
||||
rule: "DeploymentType.type == 'DEV'"
|
||||
value {
|
||||
sftp_host: "10.96.18.41"
|
||||
sftp_port: 22222
|
||||
sftp_user: "PaTeACYB"
|
||||
sftp_password: "DLXKuVK8"
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,11 @@ package bts.config;
|
||||
|
||||
message GMI_Import
|
||||
{
|
||||
required string sftp_host = 10 [default = "10.96.18.41"];
|
||||
optional uint32 sftp_port = 11 [default = 22222];
|
||||
required string sftp_user = 12 [default = "sftp"];
|
||||
required string sftp_password = 2 [default = "sftp"];
|
||||
required string sftp_host = 10 ;
|
||||
optional uint32 sftp_port = 11 ;
|
||||
required string sftp_user = 12 ;
|
||||
required string sftp_password = 2 ;
|
||||
|
||||
required int32 pause_between_downloads_seconds = 4 [default = 30];
|
||||
required int32 download_timeout_seconds = 5 [default = 35];
|
||||
optional string download_window_begin = 6 [default = "22:00"];
|
||||
|
||||
@@ -24,14 +24,14 @@ _sod_time(sod_time){
|
||||
LOG(persist, Info, "SODPosition::cons sod_time:{}", sod_time.tv_sec);
|
||||
}
|
||||
|
||||
// returns the timeval for today's hh,mm,ss (in local machine terms)
|
||||
// (timeval is the microseconds from epoch)
|
||||
// returns the timeval (secs/usecs from epoch) for today's hh,mm,ss
|
||||
// (in local machine time zone)
|
||||
timeval SODPosition::to_timeval(uint16_t hh, uint16_t mm, uint16_t ss) {
|
||||
// function does the conversion the following way:
|
||||
// 1. gets the now secs from epoch using time
|
||||
// 2. converts it into local time (so we have now local time)
|
||||
// 3. overrides the hh, mm, ss passed
|
||||
// 4. converts it back into secs from epoch using mktime
|
||||
// 1. gets the secs from epoch (time_t)
|
||||
// 2. converts it into local time
|
||||
// 3. overrides the hh, mm, ss for local time with the func args
|
||||
// 4. converts it back into timeval
|
||||
bts_assert(hh < 24);
|
||||
bts_assert(mm < 60);
|
||||
bts_assert(ss < 60);
|
||||
|
||||
@@ -178,7 +178,9 @@ void OrderMatcher::match(std::vector<Order> *out) {
|
||||
auto iBid = me->bids.begin();
|
||||
auto iAsk = me->asks.begin();
|
||||
|
||||
if (iBid->price() >= iAsk->price()) {
|
||||
if (iBid->price() > iAsk->price() ||
|
||||
price_equals(iBid->price(), iAsk->price()))
|
||||
{
|
||||
|
||||
Order bid = *iBid;
|
||||
Order ask = *iAsk;
|
||||
|
||||
@@ -15,73 +15,3 @@ Now update securities to add an exchange listed spread
|
||||
Double click each of the security cells and verify a ladder comes up
|
||||
Right click in the grid and bring up each form, close them
|
||||
Test each Spark Menu (toolbar) item other than update securities with a security row selected, make sure context from the selected row is respected if applicable
|
||||
|
||||
=== "broker mode" functionality test steps circa Sep 2019 (MV and corresponding OrderTicket)
|
||||
|
||||
-- MV Hyperlink cell highlighting --
|
||||
|
||||
Bid/Ask column test - Verify price columns reflect a hover effect when the mouse is over their cells
|
||||
The background will change to yellow
|
||||
The foreground hyperlink cell text will change to black
|
||||
The cursor changes to a hand anywhere within the cell (not only over the hyperlink text itself)
|
||||
|
||||
Qty (M) column test - Verify the Qty (Merged) column reflect a hover effect
|
||||
same as above
|
||||
|
||||
Working column test - Verify the Working columns reflect a hover effect
|
||||
Note: the hover effect should only occur over cell that actually have text
|
||||
Clicking on an empty working column cell should *not* launch an OrderBook
|
||||
|
||||
-- broker mode OrderTicket --
|
||||
|
||||
"Broker mode" general notes:
|
||||
Order Tickets should appear immediately below the cell from which they were clicked
|
||||
The qty box has focus an is ready to be typed into immediately
|
||||
The qty box has the same left/right mouse behavior as the ladder qty for quick increment/decrement
|
||||
There is only 1 big Buy/Sell button on the bottom
|
||||
|
||||
Mousebutton action to join/cross
|
||||
Left click on a bid price cell
|
||||
A buy-only ticket launches (i.e. your intent is to join the bid)
|
||||
Right click on a bid price cell
|
||||
A sell-only ticket launches (i.e. your intent is to cross the bid)
|
||||
Left click on a ask price cell
|
||||
A sell-only ticket launches (i.e. your intent is to join the ask)
|
||||
Right click on a sell price cell
|
||||
A buy-only ticket launches (i.e. your intent is to cross the ask)
|
||||
|
||||
Order Ticket price buttons
|
||||
Launch a buy order ticket by joining a bid
|
||||
Click on the Ask Price button
|
||||
The price field should update to reflect the ask price at the time the button was clicked
|
||||
The single Buy button is replaced with a Sell button
|
||||
Now, click the "1" qty button
|
||||
Click Sell
|
||||
Verify a Sell Order was actually sent at the appropriate price and size
|
||||
Now, click on the Bid Price button
|
||||
The price field should update to reflect the bid price at the time the button was clicked
|
||||
The single Ask button is replaced with a Buy button
|
||||
Click Buy
|
||||
Verify a Buy Order was actually sent at the appropriate price and size
|
||||
Close the ticket
|
||||
Extra credit - repeat the above test by first lauching a sell order and swap everything else
|
||||
|
||||
Order Ticket size buttons
|
||||
Launch a buy order ticket by joining a bid
|
||||
Click on the Ask Size button
|
||||
The price field should update to reflect the ask price at the time the button was clicked
|
||||
The size field should update to reflect the ask size at the time the button was clicked
|
||||
The single Buy button is replaced with a Sell button
|
||||
Click Sell
|
||||
Verify a Sell order was sent at the appropriate price and size
|
||||
Now, click on the Bid Size button
|
||||
The price field should update to reflect the bid price at the time the button was clicked
|
||||
The size field should update to reflect the bid size at the time the button was clicked
|
||||
The single Sell button is replaced with a Buy button
|
||||
Click Buy
|
||||
Verify a Buy order was actually sent at the appopriate price and size
|
||||
Close the ticket
|
||||
Extra credit - repeat the above test by first lauching a sell order and swap everything else
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user