Merge branch 'master' of bitbucket.org:bluetradesys/spark
This commit is contained in:
commit
29ce8b804b
36 files changed
+558
-248
No files matched your search
@@ -92,6 +92,7 @@ namespace mbts.ui
|
||||
public static ImageSource AddSynthetic { get { return (DrawingImage)_resources["AddSynthetic"]; } }
|
||||
public static ImageSource RemoveSynthetic { get { return (DrawingImage)_resources["RemoveSynthetic"]; } }
|
||||
public static ImageSource ModifySynthetic { get { return (DrawingImage)_resources["ModifySynthetic"]; } }
|
||||
public static ImageSource CloneSynthetic { get { return (DrawingImage)_resources["CloneSynthetic"]; } }
|
||||
|
||||
public static ImageSource ModifyOrder { get { return (DrawingImage)_resources["ModifyOrder"]; } }
|
||||
public static ImageSource Clock { get { return (DrawingImage)_resources["Clock"]; } }
|
||||
|
||||
@@ -718,6 +718,17 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
|
||||
<DrawingImage x:Key="CloneSynthetic">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing
|
||||
Brush="Black"
|
||||
Geometry="m 139.80129 180.78831 a 20.783495 20.783495 0 0 0 -20.78345 20.78346 20.783495 20.783495 0 0 0 17.52643 20.50105 l 0.68209 12.05803 1.01877 18.01482 a 23.1993 23.1993 0 0 0 -16.83968 22.30284 23.1993 23.1993 0 0 0 23.1991 23.19938 23.1993 23.1993 0 0 0 23.19935 -23.19938 23.1993 23.1993 0 0 0 -0.058 -1.64105 23.1993 23.1993 0 0 0 -21.4807 -21.47518 l -1.67225 -29.56198 a 20.783495 20.783495 0 0 0 11.34383 -7.12437 l 18.71558 8.86752 v 3.1e-4 a 15.549251 15.549251 0 0 0 -0.0708 1.41086 15.549251 15.549251 0 0 0 15.5493 15.54927 15.549251 15.549251 0 0 0 15.54931 -15.54927 15.549251 15.549251 0 0 0 -15.54931 -15.54932 15.549251 15.549251 0 0 0 -12.67213 6.5572 l -17.75282 -8.41152 a 20.783495 20.783495 0 0 0 0.87902 -5.94921 20.783495 20.783495 0 0 0 -20.78345 -20.78346 z M 31.983713 88.265691 A 30.676234 30.676234 0 0 0 1.3075339 118.94187 30.676234 30.676234 0 0 0 27.17639 149.20122 l 1.006764 17.79752 1.503689 26.58969 A 34.241941 34.241941 0 0 0 4.8316412 226.50722 34.241941 34.241941 0 0 0 39.073263 260.74928 34.241941 34.241941 0 0 0 73.315316 226.50722 34.241941 34.241941 0 0 0 73.229625 224.08505 34.241941 34.241941 0 0 0 41.524291 192.3879 L 39.05604 148.75469 A 30.676234 30.676234 0 0 0 55.799422 138.2392 l 27.624018 13.08837 v 4.4e-4 a 22.950541 22.950541 0 0 0 -0.104638 2.08242 22.950541 22.950541 0 0 0 22.950618 22.9506 22.950541 22.950541 0 0 0 22.95062 -22.9506 22.950541 22.950541 0 0 0 -22.95062 -22.95061 22.950541 22.950541 0 0 0 -18.703946 9.67837 L 61.362463 127.72286 A 30.676234 30.676234 0 0 0 62.65989 118.94187 30.676234 30.676234 0 0 0 31.983713 88.265691 Z" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
|
||||
<!-- Pin
|
||||
<Path Data="F1M3,11L3,7 0,7 0,6 1,6 1,1 1,0 6,0 6,1 6,6 7,6 7,7 4,7 4,11 3,11z M2,1L2,6 4,6 4,1 2,1z" />
|
||||
|
||||
@@ -15,7 +15,7 @@ using System.Windows.Input;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class MarketViewVM {
|
||||
public class Row : SecurityMDRow, IDisposable {
|
||||
public class Row : SecurityMDRow, IDisposable, IEquatable<Row> {
|
||||
readonly IBus _bus;
|
||||
readonly OrdersModel _orders_model;
|
||||
readonly AnimationManager _animation = new AnimationManager();
|
||||
@@ -116,6 +116,16 @@ namespace mbts.spark {
|
||||
_day_change.set(last_price - session_high);
|
||||
}
|
||||
|
||||
public bool Equals(Row other) =>
|
||||
other != null &&
|
||||
other.security_key == security_key;
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
Equals(obj as Row);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
security_key.GetHashCode();
|
||||
|
||||
#region Show Windows
|
||||
void _show_ladder() => _bus.post(SparkTags.ShowLadderTag, md);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace mbts.spark
|
||||
readonly MarketViewWindowFactory _factory;
|
||||
readonly OrdersModel _orders_model;
|
||||
|
||||
SingleValuePump<MarketViewVM> _vm = new SingleValuePump<MarketViewVM>(destroy: vm => vm.Dispose());
|
||||
SingleValuePump<MarketViewVM> _vm = new SingleValuePump<MarketViewVM>();
|
||||
MarketViewWindowFactory.StartupData _state;
|
||||
MarketViewView _view;
|
||||
PartialCommand<SecurityCriteria> _criteria_callback_command;
|
||||
@@ -31,20 +31,20 @@ namespace mbts.spark
|
||||
_criteria_callback_command = SparkCommand.create("Update Market View", SparkCommands.ShowMarketView.icon, _updated_security_criteria_tag);
|
||||
Commands = new SparkCommand[] {
|
||||
SparkCommand.create("Change Securities", Icons.Admin, SparkTags.ShowAndEditPickMultiple, () => (_criteria_callback_command, _state.security_criteria)),
|
||||
SparkCommands.ShowLadder.complete(_vm.Observable.SelectMany(vm => vm.current_security_md), md => md.HasValue, ObjectHelper.ValueOrDefault),
|
||||
SparkCommands.ShowLadder.complete(_vm.observable.SelectMany(vm => vm.current_security_md), md => md.HasValue, ObjectHelper.ValueOrDefault),
|
||||
// TODO: ShowLinkedLadder
|
||||
SparkCommands.ShowOrderTicketFromSecurity.complete(_vm.Observable.SelectMany(vm => vm.current_security_md), md => md.HasValue, ObjectHelper.ValueOrDefault),
|
||||
SparkCommands.ShowOrderTicketFromSecurity.complete(_vm.observable.SelectMany(vm => vm.current_security_md), md => md.HasValue, ObjectHelper.ValueOrDefault),
|
||||
// TODO: ShowLinkedOrderTicket
|
||||
SparkCommands.ShowFills.complete(_vm.Observable.SelectMany(vm => vm.selected_securities_observable()), _ => true,
|
||||
SparkCommands.ShowFills.complete(_vm.observable.SelectMany(vm => vm.selected_securities_observable()), _ => true,
|
||||
secs => new FillsWindowFactory.StartupData(new FillsWindowFactory.FilterStates {
|
||||
security = secs.Count > 0 ? new SecurityCriteria(secs) : _state.security_criteria
|
||||
})
|
||||
),
|
||||
SparkCommands.ShowTimeAndSales.complete(_vm.Observable.SelectMany(vm => vm.selected_securities_observable()), _ => true, secs => secs.Count > 0 ? new SecurityCriteria(secs) : _state.security_criteria),
|
||||
SparkCommands.ShowTimeAndSales.complete(_vm.observable.SelectMany(vm => vm.selected_securities_observable()), _ => true, secs => secs.Count > 0 ? new SecurityCriteria(secs) : _state.security_criteria),
|
||||
// SpreadMatrix ??
|
||||
// SyntheticCreate
|
||||
SparkCommands.ShowSyntheticManagement,
|
||||
SparkCommands.ShowSyntheticCreate.complete(_vm.Observable.SelectMany(vm => vm.selected_securities_observable()), secs => secs.Count > 0, secs => new SecurityCriteria(secs))
|
||||
SparkCommands.ShowSyntheticCreate.complete(_vm.observable.SelectMany(vm => vm.selected_securities_observable()), secs => secs.Count > 0, secs => new SecurityCriteria(secs))
|
||||
// ModifyOrder - await orders
|
||||
// CancelOrdersRoot ?
|
||||
//SparkCommands.CancelBuyOrders,
|
||||
@@ -61,11 +61,11 @@ namespace mbts.spark
|
||||
}
|
||||
|
||||
public void update_criteria(SecurityCriteria c) =>
|
||||
_initialize(new MarketViewWindowFactory.StartupData(c, _vm.Current.rows_view.GetSortingCriteria(), _vm.Current.get_filter_states()));
|
||||
_initialize(new MarketViewWindowFactory.StartupData(c, _vm.value.rows_view.GetSortingCriteria(), _vm.value.get_filter_states()));
|
||||
|
||||
public override UIElement Content => _view;
|
||||
public override IEnumerable<SparkCommand> Commands { get; }
|
||||
public override MarketViewWindowFactory.StartupData SaveState => _state = new MarketViewWindowFactory.StartupData(_state.security_criteria, _vm.Current.rows_view.GetSortingCriteria(), _vm.Current.get_filter_states());
|
||||
public override MarketViewWindowFactory.StartupData SaveState => _state = new MarketViewWindowFactory.StartupData(_state.security_criteria, _vm.value.rows_view.GetSortingCriteria(), _vm.value.get_filter_states());
|
||||
public override double MinWidth => 1035 + SPARK_MENU_COLLAPSED_WIDTH + LAUNCHER_BUTTON_BORDER_WIDTH;
|
||||
|
||||
public override void Dispose() {
|
||||
@@ -77,11 +77,11 @@ namespace mbts.spark
|
||||
void _initialize(MarketViewWindowFactory.StartupData state) {
|
||||
Logger.notnull(state);
|
||||
_state = state;
|
||||
_vm.Push(new MarketViewVM(_bus, _orders_model, state.security_criteria, state.sorting_criteria, state.filters));
|
||||
_vm.value = new MarketViewVM(_bus, _orders_model, state.security_criteria, state.sorting_criteria, state.filters);
|
||||
if (_view == null) {
|
||||
_view = new MarketViewView { DataContext = _vm.Current };
|
||||
_view = new MarketViewView { DataContext = _vm.value };
|
||||
} else {
|
||||
_view.DataContext = _vm.Current;
|
||||
_view.DataContext = _vm.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,12 @@ namespace mbts.spark {
|
||||
class TimeAndSalesModel {
|
||||
static readonly TimeSpan _poll_interval = TimeSpan.FromSeconds(0.4);
|
||||
|
||||
public TimeAndSalesModel(IBus bus, MDConsumer consumer, SecurityCriteria security_criteria) =>
|
||||
public TimeAndSalesModel(IBus bus, MDConsumer consumer, SecurityCriteria security_criteria) {
|
||||
trades = security_criteria.subscribe_md_map(bus)
|
||||
.Scan(new Dictionary<uint, SecurityTradeConsumer>(),
|
||||
.Scan(new Dictionary<ChannelKey, ChannelConsumer>(),
|
||||
(cache, md_map) => {
|
||||
var copy = new Dictionary<uint, SecurityTradeConsumer>(cache);
|
||||
copy.sync_with(md_map, (id, smd) => new SecurityTradeConsumer(smd.security, consumer.get_channel(smd.security.Symbol, smd.security.security_type(), smd.security.Exchange)));
|
||||
var copy = new Dictionary<ChannelKey, ChannelConsumer>(cache);
|
||||
copy.sync_with_demux(md_map, get_channel_key, get_channel_consumer, update_channel_consumer);
|
||||
return copy;
|
||||
}
|
||||
).Select(cache =>
|
||||
@@ -34,20 +34,66 @@ namespace mbts.spark {
|
||||
.Select(_ => new List<TradeInfo>(cache.Values.SelectMany(c => c.read_trades())))
|
||||
).SelectMany(_ => _);
|
||||
|
||||
public IObservable<IReadOnlyList<TradeInfo>> trades { get; }
|
||||
ChannelKey get_channel_key(KeyValuePair<uint, SecurityMD> md_kv) =>
|
||||
new ChannelKey(md_kv.Value.security.Symbol, md_kv.Value.security.security_type(), md_kv.Value.security.Exchange);
|
||||
|
||||
private class SecurityTradeConsumer {
|
||||
readonly SecurityImmutable _security;
|
||||
readonly MDConsumerChannel _channel;
|
||||
long _cursor = 0;
|
||||
|
||||
public SecurityTradeConsumer(SecurityImmutable security, MDConsumerChannel channel) {
|
||||
_security = security;
|
||||
_channel = channel;
|
||||
ChannelConsumer get_channel_consumer(IGrouping<ChannelKey, KeyValuePair<uint, SecurityMD>> channel_sec_group) {
|
||||
var key = channel_sec_group.Key;
|
||||
var rv = new ChannelConsumer(consumer.get_channel(key.symbol, key.type, key.exchange));
|
||||
rv.set_securities(channel_sec_group);
|
||||
return rv;
|
||||
}
|
||||
|
||||
public IEnumerable<TradeInfo> read_trades() =>
|
||||
_channel.read_trades(ref _cursor).Select(tm => new TradeInfo(_security, tm));
|
||||
void update_channel_consumer(KeyValuePair<ChannelKey, ChannelConsumer> channel_kv, IEnumerable<KeyValuePair<uint, SecurityMD>> security_kvs) =>
|
||||
channel_kv.Value.set_securities(security_kvs);
|
||||
}
|
||||
|
||||
public IObservable<IReadOnlyList<TradeInfo>> trades { get; }
|
||||
|
||||
private class ChannelKey : IEquatable<ChannelKey> {
|
||||
public readonly string symbol;
|
||||
public readonly SecurityType type;
|
||||
public readonly Venue exchange;
|
||||
|
||||
public ChannelKey(string symbol, SecurityType type, Venue exchange) {
|
||||
this.symbol = symbol;
|
||||
this.type = type;
|
||||
this.exchange = exchange;
|
||||
}
|
||||
|
||||
public bool Equals(ChannelKey other) =>
|
||||
other != null &&
|
||||
other.symbol == symbol &&
|
||||
other.type == type &&
|
||||
other.exchange == exchange;
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
Equals(obj as ChannelKey);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
symbol.GetHashCode() ^
|
||||
type.GetHashCode() ^
|
||||
exchange.GetHashCode();
|
||||
}
|
||||
|
||||
private class ChannelConsumer {
|
||||
readonly MDConsumerChannel _channel;
|
||||
Dictionary<uint, SecurityImmutable> _securities;
|
||||
long _cursor = 0;
|
||||
|
||||
public ChannelConsumer(MDConsumerChannel channel) =>
|
||||
_channel = channel;
|
||||
|
||||
public void set_securities(IEnumerable<KeyValuePair<uint, SecurityMD>> securities) =>
|
||||
_securities = securities.ToDictionary(kv => kv.Key, kv => kv.Value.security);
|
||||
|
||||
public IEnumerable<TradeInfo> read_trades() {
|
||||
var copy = new Dictionary<uint, SecurityImmutable>(_securities);
|
||||
foreach (var tm in _channel.read_trades(ref _cursor)) {
|
||||
if (copy.TryGetValue(tm.Key, out SecurityImmutable sec))
|
||||
yield return new TradeInfo(sec, tm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace mbts.spark {
|
||||
if (smd_lookup.success) _bus.post(SparkTags.ShowLadderTag, smd_lookup.result);
|
||||
}
|
||||
|
||||
public class Row : SecurityRow, IEquatable<Row> {
|
||||
public class Row : SecurityRow {
|
||||
readonly uint _trade_key;
|
||||
|
||||
public Row(TimeAndSalesVM parent, SecurityImmutable security, TradeMessageImmutable trade) : base(security) {
|
||||
@@ -83,10 +83,6 @@ namespace mbts.spark {
|
||||
public double price { get; }
|
||||
public uint size { get; }
|
||||
public ICommand show_ladder { get; }
|
||||
|
||||
public bool Equals(Row other) => other != null && other._trade_key == _trade_key;
|
||||
public override bool Equals(object obj) => Equals(obj as Row);
|
||||
public override int GetHashCode() => _trade_key.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace mbts.spark {
|
||||
readonly MDConsumer _consumer;
|
||||
readonly TimeAndSalesWindowFactory _factory;
|
||||
|
||||
SingleValuePump<TimeAndSalesVM> _vm = new SingleValuePump<TimeAndSalesVM>(destroy: vm => vm.Dispose());
|
||||
SingleValuePump<TimeAndSalesVM> _vm = new SingleValuePump<TimeAndSalesVM>();
|
||||
TimeAndSalesWindowFactory.StartupData _state;
|
||||
TimeAndSalesView _view;
|
||||
PartialCommand<SecurityCriteria> _criteria_callback_command;
|
||||
@@ -30,14 +30,14 @@ namespace mbts.spark {
|
||||
_criteria_callback_command = SparkCommand.create("Update Time and Sales", SparkCommands.ShowTimeAndSales.icon, _updated_security_criteria_tag);
|
||||
Commands = new SparkCommand[] {
|
||||
SparkCommand.create("Change Securities", Icons.Admin, SparkTags.ShowAndEditPickMultiple, () => (_criteria_callback_command, _state.security_criteria)),
|
||||
SparkCommands.ShowLadder.complete(_vm.Observable.SelectMany(vm => vm.current_security_md_observable(bus)), md => md.HasValue, ObjectHelper.ValueOrDefault),
|
||||
SparkCommands.ShowOrderTicketFromSecurity.complete(_vm.Observable.SelectMany(vm => vm.current_security_md_observable(bus)), md => md.HasValue, ObjectHelper.ValueOrDefault),
|
||||
SparkCommands.ShowFills.complete(_vm.Observable.SelectMany(vm => vm.selected_securities_observable()), _ => true,
|
||||
SparkCommands.ShowLadder.complete(_vm.observable.SelectMany(vm => vm.current_security_md_observable(bus)), md => md.HasValue, ObjectHelper.ValueOrDefault),
|
||||
SparkCommands.ShowOrderTicketFromSecurity.complete(_vm.observable.SelectMany(vm => vm.current_security_md_observable(bus)), md => md.HasValue, ObjectHelper.ValueOrDefault),
|
||||
SparkCommands.ShowFills.complete(_vm.observable.SelectMany(vm => vm.selected_securities_observable()), _ => true,
|
||||
secs => new FillsWindowFactory.StartupData(new FillsWindowFactory.FilterStates {
|
||||
security = secs.Count > 0 ? new SecurityCriteria(secs) : _state.security_criteria
|
||||
})
|
||||
),
|
||||
SparkCommands.ShowMarketView.complete(_vm.Observable.SelectMany(vm => vm.selected_securities_observable()), _ => true, secs => secs.Count > 0 ? new SecurityCriteria(secs) : _state.security_criteria),
|
||||
SparkCommands.ShowMarketView.complete(_vm.observable.SelectMany(vm => vm.selected_securities_observable()), _ => true, secs => secs.Count > 0 ? new SecurityCriteria(secs) : _state.security_criteria),
|
||||
};
|
||||
_subscriptions = _bus.subscribe(_updated_security_criteria_tag).ObserveOnDispatcher().Subscribe(update_criteria);
|
||||
}
|
||||
@@ -48,11 +48,11 @@ namespace mbts.spark {
|
||||
return window;
|
||||
}
|
||||
|
||||
public void update_criteria(SecurityCriteria c) => _initialize(new TimeAndSalesWindowFactory.StartupData(c, _vm.Current.rows_view.GetSortingCriteria(), _vm.Current.get_filter_states()));
|
||||
public void update_criteria(SecurityCriteria c) => _initialize(new TimeAndSalesWindowFactory.StartupData(c, _vm.value.rows_view.GetSortingCriteria(), _vm.value.get_filter_states()));
|
||||
|
||||
public override UIElement Content => _view;
|
||||
public override IEnumerable<SparkCommand> Commands { get; }
|
||||
public override TimeAndSalesWindowFactory.StartupData SaveState => _state = new TimeAndSalesWindowFactory.StartupData(_state.security_criteria, _vm.Current.rows_view.GetSortingCriteria(), _vm.Current.get_filter_states());
|
||||
public override TimeAndSalesWindowFactory.StartupData SaveState => _state = new TimeAndSalesWindowFactory.StartupData(_state.security_criteria, _vm.value.rows_view.GetSortingCriteria(), _vm.value.get_filter_states());
|
||||
public override double MinWidth => 444 + SPARK_MENU_COLLAPSED_WIDTH + LAUNCHER_BUTTON_BORDER_WIDTH;
|
||||
|
||||
public override void Dispose() {
|
||||
@@ -65,11 +65,11 @@ namespace mbts.spark {
|
||||
Logger.notnull(state);
|
||||
_state = state;
|
||||
var model = new TimeAndSalesModel(_bus, _consumer, _state.security_criteria);
|
||||
_vm.Push(new TimeAndSalesVM(_bus, model, state.sorting_criteria, state.filters));
|
||||
_vm.value = new TimeAndSalesVM(_bus, model, state.sorting_criteria, state.filters);
|
||||
if (_view == null)
|
||||
_view = new TimeAndSalesView { DataContext = _vm.Current };
|
||||
_view = new TimeAndSalesView { DataContext = _vm.value };
|
||||
else
|
||||
_view.DataContext = _vm.Current;
|
||||
_view.DataContext = _vm.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bts.shell {
|
||||
@@ -32,6 +33,16 @@ namespace bts.shell {
|
||||
v.Show(-250, -200, true);
|
||||
}
|
||||
|
||||
static string _get_clone_name(string name) {
|
||||
if (string.IsNullOrEmpty(name))
|
||||
return string.Empty;
|
||||
var regex = new Regex(@"(?<=\()\d+(?=\)$)");
|
||||
var match = regex.Match(name);
|
||||
return match.Success && int.TryParse(match.Value, out int i) && i < int.MaxValue ?
|
||||
regex.Replace(name, (i + 1).ToString()) :
|
||||
name + "(1)";
|
||||
}
|
||||
|
||||
async void _show_synthetic_create(SecurityCriteria security_criteria) =>
|
||||
_show_synthetic_create((await security_criteria.securities(_bus)).ToList());
|
||||
|
||||
@@ -61,6 +72,16 @@ namespace bts.shell {
|
||||
_show_synthetic_editor(new SyntheticEditorVM(_model.spreader, verified_synthetic, lookup.result, _model.security_has_working_orders(verified_synthetic.Id)));
|
||||
}
|
||||
|
||||
void _show_synthetic_clone((SecurityImmutable security, ExecutionStrategyImmutable strategy) args) {
|
||||
if (args.security.ContractCase == Security.ContractOneofCase.Synthetic) {
|
||||
var mutable_sec = args.security.CloneToMutable();
|
||||
mutable_sec.Id = 0;
|
||||
mutable_sec.Synthetic.Name = _get_clone_name(mutable_sec.Synthetic.Name);
|
||||
_show_synthetic_editor(new SyntheticEditorVM(_bus, _model.spreader, new SecurityImmutable(mutable_sec), args.strategy, true));
|
||||
} else
|
||||
_show_synthetic_strategy(args.security);
|
||||
}
|
||||
|
||||
void _show_synthetic_create(IEnumerable<ContractLeg> legs) {
|
||||
var syn = SyntheticDataHelper.Defaults.SyntheticContract("Synthetic", legs);
|
||||
var sec = new SecurityImmutable(new Security {
|
||||
@@ -78,7 +99,8 @@ namespace bts.shell {
|
||||
Disposable.dispose(ref _dispose);
|
||||
_dispose = Disposable.Create(
|
||||
_bus.subscribe(SparkTags.ShowSyntheticCreateTag).ObserveOnDispatcher().Subscribe(_show_synthetic_create),
|
||||
_bus.subscribe(SparkTags.ShowSyntheticStrategyTag).ObserveOnDispatcher().Subscribe(_show_synthetic_strategy)
|
||||
_bus.subscribe(SparkTags.ShowSyntheticStrategyTag).ObserveOnDispatcher().Subscribe(_show_synthetic_strategy),
|
||||
_bus.subscribe(SparkTags.ShowSyntheticCloneTag).ObserveOnDispatcher().Subscribe(_show_synthetic_clone)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,8 +99,8 @@ namespace bts.shell {
|
||||
}
|
||||
}
|
||||
public static QuoteMuteZone QuoteMuteZone => new QuoteMuteZone {
|
||||
InsideTicks = 1,
|
||||
OutsideTicks = 1,
|
||||
InsideTicks = 2,
|
||||
OutsideTicks = 3,
|
||||
Priority = RulePriority
|
||||
};
|
||||
public static QuoteInsideMarketDistanceWithTravel QuoteInsideMarketDistanceWithTravel => new QuoteInsideMarketDistanceWithTravel { Priority = RulePriority };
|
||||
@@ -110,8 +110,8 @@ namespace bts.shell {
|
||||
#region PreHedge
|
||||
public static PreHedgeParams PreHedgeParams => new PreHedgeParams {
|
||||
MaxPriceFromInsideMarket = PreHedgeMaxPriceFromInsideMarket,
|
||||
QuantityBasedPaylessTicks = PreHedgeQuantityBasedPayLessTicks,
|
||||
QuantityBasedPayupTicks = PreHedgeQuantityBasedPayUpTicks,
|
||||
QuantityBasedPaylessTicks = null,
|
||||
QuantityBasedPayupTicks = null,
|
||||
SendHedgeAsMarketOrder = PreHedgeSendHedgeAsMarketOrder
|
||||
};
|
||||
public static PreHedgeSendHedgeAsMarketOrder PreHedgeSendHedgeAsMarketOrder => new PreHedgeSendHedgeAsMarketOrder();
|
||||
@@ -122,8 +122,8 @@ namespace bts.shell {
|
||||
|
||||
#region PostHedge
|
||||
public static PostHedgeParams PostHedgeParams => new PostHedgeParams {
|
||||
PriceBasedCross = PostHedgePriceBasedForcedCross,
|
||||
TimeBasedForcedCross = PostHedgeTimeBasedForcedCross,
|
||||
PriceBasedCross = null,
|
||||
TimeBasedForcedCross = null,
|
||||
};
|
||||
public static PostHedgePriceBasedForcedCross PostHedgePriceBasedForcedCross => new PostHedgePriceBasedForcedCross();
|
||||
public static PostHedgeTimeBasedForcedCross PostHedgeTimeBasedForcedCross => new PostHedgeTimeBasedForcedCross();
|
||||
@@ -140,8 +140,8 @@ namespace bts.shell {
|
||||
|
||||
public static ExecutionStrategy ExecutionStrategy(SecurityImmutable security) {
|
||||
switch (security.ContractCase) {
|
||||
case bts.api.Security.ContractOneofCase.Spread: return ExecutionStrategy(security.Spread.Legs.Select(l => l.Security));
|
||||
case bts.api.Security.ContractOneofCase.Synthetic: return ExecutionStrategy(security.Synthetic.Legs.Select(l => l.Security));
|
||||
case Security.ContractOneofCase.Spread: return ExecutionStrategy(security.Spread.Legs.Select(l => l.Security));
|
||||
case Security.ContractOneofCase.Synthetic: return ExecutionStrategy(security.Synthetic.Legs.Select(l => l.Security));
|
||||
default: throw new ArgumentException("Must be a Spread, or Synthetic", nameof(security));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ using static bts.shell.SyntheticManagementWindowFactory;
|
||||
|
||||
namespace mbts.spark {
|
||||
class SyntheticManagementWindow : SparkWindow<StartupData> {
|
||||
SingleValuePump<SyntheticManagementDialogVM> _vm = new SingleValuePump<SyntheticManagementDialogVM>(destroy: vm => vm.Dispose());
|
||||
SingleValuePump<SyntheticManagementDialogVM> _vm = new SingleValuePump<SyntheticManagementDialogVM>();
|
||||
StartupData _state;
|
||||
OrdersModel _orders_model;
|
||||
SyntheticManagementView _view;
|
||||
@@ -29,18 +29,21 @@ namespace mbts.spark {
|
||||
_orders_model = orders_model;
|
||||
Commands = new SparkCommand[] {
|
||||
SparkCommand.create("Add", Icons.AddSynthetic, SparkTags.ShowSyntheticCreateTag).complete(
|
||||
() => new SecurityCriteria(_vm.Current.selected_securities), () => true
|
||||
() => new SecurityCriteria(), () => true
|
||||
), SparkCommand.create("Remove", Icons.RemoveSynthetic, SparkTags.SyntheticDeleteTag).complete(
|
||||
_vm.Observable.SelectMany(vm => vm.current_row_observable),
|
||||
_vm.observable.SelectMany(vm => vm.current_row_observable),
|
||||
can_row_change, r => r == null ? 0 : r.security_key
|
||||
), SparkCommand.create("Change", Icons.ModifySynthetic, SparkTags.ShowSyntheticStrategyTag).complete(
|
||||
_vm.Observable.SelectMany(vm => vm.current_row_observable),
|
||||
_vm.observable.SelectMany(vm => vm.current_row_observable),
|
||||
can_row_change, r => r == null ? SecurityDataHelper.Defaults.SecurityImmutable : r.security
|
||||
), SparkCommand.create("Clone", Icons.CloneSynthetic, SparkTags.ShowSyntheticCloneTag).complete(
|
||||
_vm.observable.SelectMany(vm => vm.current_row_observable),
|
||||
r => r != null && r.strategy.HasValue, r => r == null ? default : (r.security, r.strategy.Value)
|
||||
), SparkCommands.ShowLadder.complete(
|
||||
_vm.Observable.SelectMany(vm => vm.current_security_md), md => md.HasValue, ObjectHelper.ValueOrDefault
|
||||
_vm.observable.SelectMany(vm => vm.current_security_md), md => md.HasValue, ObjectHelper.ValueOrDefault
|
||||
), SparkCommands.ShowOrders.complete(() => new OrderBookWindowFactory.OrderBookStartupData {
|
||||
filters = new OrderBookWindowFactory.FilterStates {
|
||||
security_criteria = new SecurityCriteria(_vm.Current.row_vms.Select(r => r.security))
|
||||
security_criteria = new SecurityCriteria(_vm.value.row_vms.Select(r => r.security))
|
||||
}
|
||||
})
|
||||
};
|
||||
@@ -52,19 +55,19 @@ namespace mbts.spark {
|
||||
public void initialize(StartupData state) {
|
||||
Logger.notnull(state);
|
||||
_state = state;
|
||||
_vm.Push(new SyntheticManagementDialogVM(_bus, _orders_model, state.sorting_criteria, state.filters ?? new FilterStates()));
|
||||
if (_view == null) _view = new SyntheticManagementView { DataContext = _vm.Current };
|
||||
else _view.DataContext = _vm.Current;
|
||||
_vm.value = new SyntheticManagementDialogVM(_bus, _orders_model, state.sorting_criteria, state.filters ?? new FilterStates());
|
||||
if (_view == null) _view = new SyntheticManagementView { DataContext = _vm.value };
|
||||
else _view.DataContext = _vm.value;
|
||||
}
|
||||
|
||||
public override UIElement Content => _view;
|
||||
public override IEnumerable<SparkCommand> Commands { get; }
|
||||
public override StartupData SaveState => _state = new StartupData(_vm.Current.rows_view.GetSortingCriteria(), _vm.Current.get_filter_states());
|
||||
public override StartupData SaveState => _state = new StartupData(_vm.value.rows_view.GetSortingCriteria(), _vm.value.get_filter_states());
|
||||
public override double MinWidth => 700;
|
||||
|
||||
public override void Dispose() {
|
||||
Disposable.dispose(ref _vm);
|
||||
foreach (var c in Commands.OfType<IDisposable>()) c.Dispose();
|
||||
Commands.OfType<IDisposable>().DisposeAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-8
@@ -1,4 +1,5 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.PostHedge, Subsections.TicksAwayCross };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PostHedgeParams.PriceBasedCross.MarketCrossTicks = _value_from_store(leg_tup);
|
||||
_get_price_based_cross(leg_tup).MarketCrossTicks = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var price_based_cross = leg_tup.leg_params.PostHedgeParams.PriceBasedCross;
|
||||
return price_based_cross != null ? price_based_cross.MarketCrossTicks : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_price_based_cross(leg_tup) is PostHedgePriceBasedForcedCross price_based_cross ?
|
||||
price_based_cross.MarketCrossTicks :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var price_based_cross = leg_tup.leg_params.PostHedgeParams.PriceBasedCross;
|
||||
if (price_based_cross != null)
|
||||
if (_get_price_based_cross(leg_tup) is PostHedgePriceBasedForcedCross price_based_cross)
|
||||
price_based_cross.MarketCrossTicks = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_price_based_cross(leg_tup) != null;
|
||||
|
||||
PostHedgePriceBasedForcedCross _get_price_based_cross(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PostHedgeParams.PriceBasedCross;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PostHedgeParams.PriceBasedCross.MarketCrossTicks);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PostHedgePriceBasedForcedCross.MarketCrossTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-8
@@ -1,4 +1,5 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.PostHedge, Subsections.TicksAwayCross };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PostHedgeParams.PriceBasedCross.TicksThreshold = _value_from_store(leg_tup);
|
||||
_get_price_based_cross(leg_tup).TicksThreshold = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var price_based_cross = leg_tup.leg_params.PostHedgeParams.PriceBasedCross;
|
||||
return price_based_cross != null ? price_based_cross.TicksThreshold : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_price_based_cross(leg_tup) is PostHedgePriceBasedForcedCross price_based_cross ?
|
||||
price_based_cross.TicksThreshold :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var price_based_cross = leg_tup.leg_params.PostHedgeParams.PriceBasedCross;
|
||||
if (price_based_cross != null)
|
||||
if (_get_price_based_cross(leg_tup) is PostHedgePriceBasedForcedCross price_based_cross)
|
||||
price_based_cross.TicksThreshold = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_price_based_cross(leg_tup) != null;
|
||||
|
||||
PostHedgePriceBasedForcedCross _get_price_based_cross(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PostHedgeParams.PriceBasedCross;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PostHedgeParams.PriceBasedCross.TicksThreshold);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PostHedgePriceBasedForcedCross.TicksThreshold);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-8
@@ -1,4 +1,5 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.PostHedge, Subsections.TimeBasedCross };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PostHedgeParams.TimeBasedForcedCross.MarketCrossTicks = _value_from_store(leg_tup);
|
||||
_get_time_based_cross(leg_tup).MarketCrossTicks = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var time_based_cross = leg_tup.leg_params.PostHedgeParams.TimeBasedForcedCross;
|
||||
return time_based_cross != null ? time_based_cross.MarketCrossTicks : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_time_based_cross(leg_tup) is PostHedgeTimeBasedForcedCross time_based_cross ?
|
||||
time_based_cross.MarketCrossTicks :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var time_based_cross = leg_tup.leg_params.PostHedgeParams.TimeBasedForcedCross;
|
||||
if (time_based_cross != null)
|
||||
if (_get_time_based_cross(leg_tup) is PostHedgeTimeBasedForcedCross time_based_cross)
|
||||
time_based_cross.MarketCrossTicks = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_time_based_cross(leg_tup) != null;
|
||||
|
||||
PostHedgeTimeBasedForcedCross _get_time_based_cross(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PostHedgeParams.TimeBasedForcedCross;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PostHedgeParams.TimeBasedForcedCross.MarketCrossTicks);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PostHedgeTimeBasedForcedCross.MarketCrossTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-8
@@ -1,4 +1,5 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.PostHedge, Subsections.TimeBasedCross };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PostHedgeParams.TimeBasedForcedCross.TimeInMsThreshold = _value_from_store(leg_tup);
|
||||
_get_time_based_cross(leg_tup).TimeInMsThreshold = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var time_based_cross = leg_tup.leg_params.PostHedgeParams.TimeBasedForcedCross;
|
||||
return time_based_cross != null ? time_based_cross.TimeInMsThreshold : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_time_based_cross(leg_tup) is PostHedgeTimeBasedForcedCross time_based_cross ?
|
||||
time_based_cross.TimeInMsThreshold :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var time_based_cross = leg_tup.leg_params.PostHedgeParams.TimeBasedForcedCross;
|
||||
if (time_based_cross != null)
|
||||
if (_get_time_based_cross(leg_tup) is PostHedgeTimeBasedForcedCross time_based_cross)
|
||||
time_based_cross.TimeInMsThreshold = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_time_based_cross(leg_tup) != null;
|
||||
|
||||
PostHedgeTimeBasedForcedCross _get_time_based_cross(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PostHedgeParams.TimeBasedForcedCross;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PostHedgeParams.TimeBasedForcedCross.TimeInMsThreshold);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PostHedgeTimeBasedForcedCross.TimeInMsThreshold);
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-8
@@ -13,24 +13,29 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.PreHedge, Subsections.Payless };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PreHedgeParams.QuantityBasedPaylessTicks.QuantityThreshold = _value_from_store(leg_tup);
|
||||
_get_payless_ticks(leg_tup).QuantityThreshold = _value_from_store(leg_tup);
|
||||
|
||||
public override QuantityMeasure get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var payless_ticks = leg_tup.leg_params.PreHedgeParams.QuantityBasedPaylessTicks;
|
||||
return payless_ticks != null ? payless_ticks.QuantityThreshold : _value_from_store(leg_tup);
|
||||
}
|
||||
public override QuantityMeasure get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_payless_ticks(leg_tup) is PreHedgeQuantityBasedPayLessTicks payless_ticks ?
|
||||
payless_ticks.QuantityThreshold :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, QuantityMeasure value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var payless_ticks = leg_tup.leg_params.PreHedgeParams.QuantityBasedPaylessTicks;
|
||||
if (payless_ticks != null)
|
||||
if (_get_payless_ticks(leg_tup) is PreHedgeQuantityBasedPayLessTicks payless_ticks)
|
||||
payless_ticks.QuantityThreshold = value;
|
||||
}
|
||||
|
||||
public override ICell create_cell(LegSpreaderParamsTuple leg_tup) => new QuantityMeasureCell(this, leg_tup);
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_payless_ticks(leg_tup) != null;
|
||||
|
||||
PreHedgeQuantityBasedPayLessTicks _get_payless_ticks(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PreHedgeParams.QuantityBasedPaylessTicks;
|
||||
|
||||
QuantityMeasure _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PreHedgeParams.QuantityBasedPaylessTicks.QuantityThreshold);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PreHedgeQuantityBasedPayLessTicks.QuantityThreshold);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-8
@@ -1,4 +1,5 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.PreHedge, Subsections.Payless };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PreHedgeParams.QuantityBasedPaylessTicks.PaylessTicks = _value_from_store(leg_tup);
|
||||
_get_payless_ticks(leg_tup).PaylessTicks = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var payless_ticks = leg_tup.leg_params.PreHedgeParams.QuantityBasedPaylessTicks;
|
||||
return payless_ticks != null ? payless_ticks.PaylessTicks : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_payless_ticks(leg_tup) is PreHedgeQuantityBasedPayLessTicks payless_ticks ?
|
||||
payless_ticks.PaylessTicks :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var payless_ticks = leg_tup.leg_params.PreHedgeParams.QuantityBasedPaylessTicks;
|
||||
if (payless_ticks != null)
|
||||
if (_get_payless_ticks(leg_tup) is PreHedgeQuantityBasedPayLessTicks payless_ticks)
|
||||
payless_ticks.PaylessTicks = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_payless_ticks(leg_tup) != null;
|
||||
|
||||
PreHedgeQuantityBasedPayLessTicks _get_payless_ticks(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PreHedgeParams.QuantityBasedPaylessTicks;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PreHedgeParams.QuantityBasedPaylessTicks.PaylessTicks);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PreHedgeQuantityBasedPayLessTicks.PaylessTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-8
@@ -13,24 +13,29 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.PreHedge, Subsections.Payup };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PreHedgeParams.QuantityBasedPayupTicks.QuantityThreshold = _value_from_store(leg_tup);
|
||||
_get_payup_ticks(leg_tup).QuantityThreshold = _value_from_store(leg_tup);
|
||||
|
||||
public override QuantityMeasure get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var payup_ticks = leg_tup.leg_params.PreHedgeParams.QuantityBasedPayupTicks;
|
||||
return payup_ticks != null ? payup_ticks.QuantityThreshold : _value_from_store(leg_tup);
|
||||
}
|
||||
public override QuantityMeasure get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_payup_ticks(leg_tup) is PreHedgeQuantityBasedPayupTicks payup_ticks ?
|
||||
payup_ticks.QuantityThreshold :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, QuantityMeasure value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var payup_ticks = leg_tup.leg_params.PreHedgeParams.QuantityBasedPayupTicks;
|
||||
if (payup_ticks != null)
|
||||
if (_get_payup_ticks(leg_tup) is PreHedgeQuantityBasedPayupTicks payup_ticks)
|
||||
payup_ticks.QuantityThreshold = value;
|
||||
}
|
||||
|
||||
public override ICell create_cell(LegSpreaderParamsTuple leg_tup) => new QuantityMeasureCell(this, leg_tup);
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_payup_ticks(leg_tup) != null;
|
||||
|
||||
PreHedgeQuantityBasedPayupTicks _get_payup_ticks(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PreHedgeParams.QuantityBasedPayupTicks;
|
||||
|
||||
QuantityMeasure _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PreHedgeParams.QuantityBasedPayupTicks.QuantityThreshold);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PreHedgeQuantityBasedPayUpTicks.QuantityThreshold);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-8
@@ -1,4 +1,5 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.PreHedge, Subsections.Payup };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PreHedgeParams.QuantityBasedPayupTicks.PayupTicks = _value_from_store(leg_tup);
|
||||
_get_payup_ticks(leg_tup).PayupTicks = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var payup_ticks = leg_tup.leg_params.PreHedgeParams.QuantityBasedPayupTicks;
|
||||
return payup_ticks != null ? payup_ticks.PayupTicks : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_payup_ticks(leg_tup) is PreHedgeQuantityBasedPayupTicks payup_ticks ?
|
||||
payup_ticks.PayupTicks :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var payup_ticks = leg_tup.leg_params.PreHedgeParams.QuantityBasedPayupTicks;
|
||||
if (payup_ticks != null)
|
||||
if (_get_payup_ticks(leg_tup) is PreHedgeQuantityBasedPayupTicks payup_ticks)
|
||||
payup_ticks.PayupTicks = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_payup_ticks(leg_tup) != null;
|
||||
|
||||
PreHedgeQuantityBasedPayupTicks _get_payup_ticks(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.PreHedgeParams.QuantityBasedPayupTicks;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PreHedgeParams.QuantityBasedPayupTicks.PayupTicks);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.PreHedgeQuantityBasedPayUpTicks.PayupTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-8
@@ -1,4 +1,5 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.Quote, Subsections.InsideMarketThrottleThresholds };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceWithTravel.Limit = _value_from_store(leg_tup);
|
||||
_get_inside_market_throttle(leg_tup).Limit = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var inside_market_throttle = leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceWithTravel;
|
||||
return inside_market_throttle != null ? inside_market_throttle.Limit : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_inside_market_throttle(leg_tup) is QuoteInsideMarketDistanceWithTravel inside_market_throttle ?
|
||||
inside_market_throttle.Limit :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var inside_market_throttle = leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceWithTravel;
|
||||
if (inside_market_throttle != null)
|
||||
if (_get_inside_market_throttle(leg_tup) is QuoteInsideMarketDistanceWithTravel inside_market_throttle)
|
||||
inside_market_throttle.Limit = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_inside_market_throttle(leg_tup) != null;
|
||||
|
||||
QuoteInsideMarketDistanceWithTravel _get_inside_market_throttle(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceWithTravel;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.QuoteParams.QuoteInsideMarketDistanceWithTravel.Limit);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.QuoteInsideMarketDistanceWithTravel.Limit);
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-8
@@ -13,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.Quote, Subsections.InsideMarketThrottleThresholds };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceWithTravel.TicksFromInside = _value_from_store(leg_tup);
|
||||
_get_inside_market_throttle(leg_tup).TicksFromInside = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var inside_market_throttle = leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceWithTravel;
|
||||
return inside_market_throttle != null ? inside_market_throttle.TicksFromInside : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_inside_market_throttle(leg_tup) is QuoteInsideMarketDistanceWithTravel inside_market_throttle ?
|
||||
inside_market_throttle.TicksFromInside :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var inside_market_throttle = leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceWithTravel;
|
||||
if (inside_market_throttle != null)
|
||||
if (_get_inside_market_throttle(leg_tup) is QuoteInsideMarketDistanceWithTravel inside_market_throttle)
|
||||
inside_market_throttle.TicksFromInside = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_inside_market_throttle(leg_tup) != null;
|
||||
|
||||
QuoteInsideMarketDistanceWithTravel _get_inside_market_throttle(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceWithTravel;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.QuoteParams.QuoteInsideMarketDistanceWithTravel.TicksFromInside);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.QuoteInsideMarketDistanceWithTravel.TicksFromInside);
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-9
@@ -1,4 +1,5 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.Quote, Subsections.Throttle };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.QuoteMuteZone.InsideTicks = _value_from_store(leg_tup);
|
||||
_get_throttle(leg_tup).InsideTicks = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var quote_throttle = leg_tup.leg_params.QuoteParams.QuoteMuteZone;
|
||||
return quote_throttle != null ? quote_throttle.InsideTicks : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup) is QuoteMuteZone throttle ?
|
||||
throttle.InsideTicks :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var quote_throttle = leg_tup.leg_params.QuoteParams.QuoteMuteZone;
|
||||
if (quote_throttle != null)
|
||||
quote_throttle.InsideTicks = value;
|
||||
if (_get_throttle(leg_tup) is QuoteMuteZone throttle)
|
||||
throttle.InsideTicks = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup) != null;
|
||||
|
||||
QuoteMuteZone _get_throttle(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.QuoteMuteZone;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.QuoteParams.QuoteMuteZone.InsideTicks);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.QuoteMuteZone.InsideTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-9
@@ -1,4 +1,5 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,22 +13,27 @@ namespace mbts.spark {
|
||||
public override ParameterSection[] section_path { get; } = new[] { Sections.Quote, Subsections.Throttle };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.QuoteMuteZone.OutsideTicks = _value_from_store(leg_tup);
|
||||
_get_throttle(leg_tup).OutsideTicks = _value_from_store(leg_tup);
|
||||
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) {
|
||||
var quote_throttle = leg_tup.leg_params.QuoteParams.QuoteMuteZone;
|
||||
return quote_throttle != null ? quote_throttle.OutsideTicks : _value_from_store(leg_tup);
|
||||
}
|
||||
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup) is QuoteMuteZone throttle ?
|
||||
throttle.OutsideTicks :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
var quote_throttle = leg_tup.leg_params.QuoteParams.QuoteMuteZone;
|
||||
if (quote_throttle != null)
|
||||
quote_throttle.OutsideTicks = value;
|
||||
if (_get_throttle(leg_tup) is QuoteMuteZone throttle)
|
||||
throttle.OutsideTicks = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_throttle(leg_tup) != null;
|
||||
|
||||
QuoteMuteZone _get_throttle(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.QuoteMuteZone;
|
||||
|
||||
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.QuoteParams.QuoteMuteZone.OutsideTicks);
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.QuoteMuteZone.OutsideTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,13 +60,14 @@ namespace mbts.spark {
|
||||
public IObservable<bool> observe_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_enabled_store.GetOrAdd(leg_tup.leg.Security.Id, sec => {
|
||||
var rs = new ReplaySubject<bool>(1);
|
||||
rs.OnNext(true);
|
||||
rs.OnNext(_get_enabled(leg_tup));
|
||||
return rs;
|
||||
});
|
||||
|
||||
public IObservable<T> observe_override_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_override_value_store.GetOrAdd(leg_tup.leg.Security.Id, sec => new Subject<T>());
|
||||
|
||||
protected virtual bool _get_enabled(LegSpreaderParamsTuple leg_tup) => true;
|
||||
#region IRowModel (explicit)
|
||||
object IRowModel.get_value(LegSpreaderParamsTuple leg_tup) => get_value(leg_tup);
|
||||
void IRowModel.set_value(LegSpreaderParamsTuple leg_tup, object value) {
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace mbts.spark {
|
||||
/// <param name="bus">The application bus</param>
|
||||
/// <param name="synthetic">The new synthetic security to create, or existing synthetic security who's strategy to modify, on commit</param>
|
||||
/// <param name="strategy">The new strategy to create, or existing strategy to modify, on commit</param>
|
||||
public SyntheticEditorVM(IBus bus, SpreaderModel model, SecurityImmutable synthetic, ExecutionStrategyImmutable strategy)
|
||||
public SyntheticEditorVM(IBus bus, SpreaderModel model, SecurityImmutable synthetic, ExecutionStrategyImmutable strategy, bool override_auto_set_behavior = false)
|
||||
: this (synthetic, strategy, true) {
|
||||
ExceptionAssert.InvalidOperation.That(synthetic.Id == 0, "This constructor may only be used for new synthetic securities (id must be zero).");
|
||||
title = "Create Synthetic";
|
||||
@@ -112,10 +112,18 @@ namespace mbts.spark {
|
||||
}
|
||||
}
|
||||
}, () => leg_count >= 2);
|
||||
_deduce_name();
|
||||
_deduce_ticks();
|
||||
_deduce_quantities();
|
||||
_deduce_price_mults();
|
||||
if (override_auto_set_behavior) {
|
||||
_set_name_automatically = false;
|
||||
_set_ticks_automatically = false;
|
||||
_set_quantities_automatically = false;
|
||||
_set_price_mults_automatically = false;
|
||||
_tick_factors = TickUtils.get_regional_ticks(_synthetic.ContractSpec).low_tick;
|
||||
} else {
|
||||
_deduce_name();
|
||||
_deduce_ticks();
|
||||
_deduce_quantities();
|
||||
_deduce_price_mults();
|
||||
}
|
||||
_validate_leg_count();
|
||||
leg_tuples.CollectionChanged += (s, e) => {
|
||||
if (_set_name_automatically) _deduce_name();
|
||||
|
||||
@@ -53,14 +53,15 @@ namespace mbts.spark {
|
||||
};
|
||||
#endregion
|
||||
|
||||
public class Row : SecurityMDRow {
|
||||
public class Row : SecurityMDRow, IEquatable<Row> {
|
||||
public readonly ExecutionStrategyImmutable? strategy;
|
||||
|
||||
readonly IBus _bus;
|
||||
readonly ExecutionStrategyImmutable? _strategy;
|
||||
readonly Property<uint> _n_working_orders;
|
||||
|
||||
public Row(IBus bus, SecurityMD security_md, ExecutionStrategyImmutable? strategy, OrdersModel orders_model) : base(security_md) {
|
||||
_bus = bus;
|
||||
_strategy = strategy;
|
||||
this.strategy = strategy;
|
||||
_n_working_orders = backing(nameof(n_working_orders),
|
||||
orders_model.on_security_orders(security_key)
|
||||
.Select(t => (uint)(t.state
|
||||
@@ -78,11 +79,21 @@ namespace mbts.spark {
|
||||
public string name { get; }
|
||||
public int n_legs { get; }
|
||||
public string description { get; }
|
||||
public bool strategy_present => _strategy.HasValue;
|
||||
public bool strategy_present => strategy.HasValue;
|
||||
public uint n_working_orders => _n_working_orders.Value;
|
||||
public ICommand show_ladder { get; }
|
||||
public ICommand show_order_book { get; }
|
||||
|
||||
public bool Equals(Row other) =>
|
||||
other != null &&
|
||||
other.security_key == security_key;
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
Equals(obj as Row);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
security_key.GetHashCode();
|
||||
|
||||
void _show_ladder() =>
|
||||
_bus.post(SparkTags.ShowLadderTag, md);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace mbts.spark
|
||||
{
|
||||
class FillsWindow : SparkWindow<FillsWindowFactory.StartupData> {
|
||||
readonly OrdersModel _orders_model;
|
||||
SingleValuePump<FillsVM> _vm = new SingleValuePump<FillsVM>(destroy: vm => vm.Dispose());
|
||||
SingleValuePump<FillsVM> _vm = new SingleValuePump<FillsVM>();
|
||||
FillsWindowFactory.StartupData _state;
|
||||
FillsView _view;
|
||||
|
||||
@@ -26,13 +26,13 @@ namespace mbts.spark
|
||||
public void initialize(FillsWindowFactory.StartupData state) {
|
||||
Logger.notnull(state);
|
||||
_state = state;
|
||||
_vm.Push(new FillsVM(_bus,_orders_model, state.orders, state.sorting_criteria, state.filters));
|
||||
if (_view == null) _view = new FillsView { DataContext = _vm.Current };
|
||||
else _view.DataContext = _vm.Current;
|
||||
_vm.value = new FillsVM(_bus,_orders_model, state.orders, state.sorting_criteria, state.filters);
|
||||
if (_view == null) _view = new FillsView { DataContext = _vm.value };
|
||||
else _view.DataContext = _vm.value;
|
||||
}
|
||||
|
||||
public override UIElement Content => _view;
|
||||
public override FillsWindowFactory.StartupData SaveState => _state = new FillsWindowFactory.StartupData(_vm.Current.orders, _vm.Current.rows_view.GetSortingCriteria(), _vm.Current.get_filters());
|
||||
public override FillsWindowFactory.StartupData SaveState => _state = new FillsWindowFactory.StartupData(_vm.value.orders, _vm.value.rows_view.GetSortingCriteria(), _vm.value.get_filters());
|
||||
public override double MinWidth => 1050 + SPARK_MENU_COLLAPSED_WIDTH + LAUNCHER_BUTTON_BORDER_WIDTH;
|
||||
|
||||
public override void Dispose() => Disposable.dispose(ref _vm);
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace mbts.spark
|
||||
public static ITag<SecurityCriteria> ShowMarketViewTag { get; } = new SparkTag<SecurityCriteria>("Show MarketView");
|
||||
public static ITag<OrderBookWindowFactory.OrderBookStartupData> ShowOrderBookTag { get; } = new SparkTag<OrderBookWindowFactory.OrderBookStartupData>(nameof(ShowOrderBookTag));
|
||||
public static ITag<PAndLWindowFactory.PAndLStartupData> ShowPAndLTag { get; } = new SparkTag<PAndLWindowFactory.PAndLStartupData>(nameof(ShowPAndLTag));
|
||||
public static ITag<(SecurityImmutable security, ExecutionStrategyImmutable strategy)> ShowSyntheticCloneTag { get; } = new SparkTag<(SecurityImmutable security, ExecutionStrategyImmutable strategy)>(nameof(ShowSyntheticCloneTag));
|
||||
public static ITag<SecurityCriteria> ShowSyntheticCreateTag { get; } = new SparkTag<SecurityCriteria>(nameof(ShowSyntheticCreateTag));
|
||||
public static ITag<SecurityImmutable> ShowSyntheticStrategyTag { get; } = new SparkTag<SecurityImmutable>(nameof(ShowSyntheticStrategyTag));
|
||||
public static ITag<Nothing> ShowSyntheticManagementTag { get; } = new SparkTag<Nothing>(nameof(ShowSyntheticManagementTag));
|
||||
|
||||
@@ -606,17 +606,58 @@ namespace mbts.collections.extensions {
|
||||
else dictionary.Add(key, create_new());
|
||||
}
|
||||
|
||||
// this overload prevents 'ambiguous calls' compilation errors due to Dictionary implementing IDictionary, and IReadOnlyDictionary.
|
||||
public static void sync_with<TKey, TValue, TSourceValue>(this IDictionary<TKey, TValue> dictionary, Dictionary<TKey, TSourceValue> source, Func<TKey, TSourceValue, TValue> selector) =>
|
||||
_sync_with(dictionary, source, selector);
|
||||
public static void sync_with<TKey, TValue, TSourceValue>(
|
||||
this IDictionary<TKey, TValue> dictionary,
|
||||
Dictionary<TKey, TSourceValue> source,
|
||||
Func<TKey, TSourceValue, TValue> selector
|
||||
) => _sync_with(dictionary, source, selector);
|
||||
|
||||
public static void sync_with<TKey, TValue, TSourceValue>(this IDictionary<TKey, TValue> dictionary, IDictionary<TKey, TSourceValue> source, Func<TKey, TSourceValue, TValue> selector) =>
|
||||
_sync_with(dictionary, source, selector);
|
||||
public static void sync_with<TKey, TValue, TSourceValue>(
|
||||
this IDictionary<TKey, TValue> dictionary,
|
||||
IDictionary<TKey, TSourceValue> source,
|
||||
Func<TKey, TSourceValue, TValue> selector
|
||||
) => _sync_with(dictionary, source, selector);
|
||||
|
||||
public static void sync_with<TKey, TValue, TSourceValue>(this IDictionary<TKey, TValue> dictionary, IReadOnlyDictionary<TKey, TSourceValue> source, Func<TKey, TSourceValue, TValue> selector) =>
|
||||
_sync_with_ro(dictionary, source, selector);
|
||||
public static void sync_with<TKey, TValue, TSourceValue>(
|
||||
this IDictionary<TKey, TValue> dictionary,
|
||||
IReadOnlyDictionary<TKey, TSourceValue> source,
|
||||
Func<TKey, TSourceValue, TValue> selector
|
||||
) => _sync_with_ro(dictionary, source, selector);
|
||||
|
||||
static void _sync_with<TKey, TValue, TSourceValue>(this IDictionary<TKey, TValue> dictionary, IDictionary<TKey, TSourceValue> source, Func<TKey, TSourceValue, TValue> selector) {
|
||||
public static void sync_with_demux<TKey, TValue, TSourceKey, TSourceValue>(
|
||||
this IDictionary<TKey, TValue> dictionary,
|
||||
Dictionary<TSourceKey, TSourceValue> source,
|
||||
Func<KeyValuePair<TSourceKey, TSourceValue>, TKey> key_selector,
|
||||
Func<IGrouping<TKey, KeyValuePair<TSourceKey, TSourceValue>>, TValue> value_selector,
|
||||
Action<KeyValuePair<TKey, TValue>, IEnumerable<KeyValuePair<TSourceKey, TSourceValue>>> update
|
||||
) => _sync_with_demux(dictionary, source, key_selector, value_selector, update);
|
||||
|
||||
public static void sync_with_demux<TKey, TValue, TSourceKey, TSourceValue>(
|
||||
this IDictionary<TKey, TValue> dictionary,
|
||||
IDictionary<TSourceKey, TSourceValue> source,
|
||||
Func<KeyValuePair<TSourceKey, TSourceValue>, TKey> key_selector,
|
||||
Func<IGrouping<TKey, KeyValuePair<TSourceKey, TSourceValue>>, TValue> value_selector,
|
||||
Action<KeyValuePair<TKey, TValue>, IEnumerable<KeyValuePair<TSourceKey, TSourceValue>>> update
|
||||
) => _sync_with_demux(dictionary, source, key_selector, value_selector, update);
|
||||
|
||||
public static void sync_with_demux<TKey, TValue, TSourceKey, TSourceValue>(
|
||||
this IDictionary<TKey, TValue> dictionary,
|
||||
IReadOnlyDictionary<TSourceKey, TSourceValue> source,
|
||||
Func<KeyValuePair<TSourceKey, TSourceValue>, TKey> key_selector,
|
||||
Func<IGrouping<TKey, KeyValuePair<TSourceKey, TSourceValue>>, TValue> value_selector,
|
||||
Action<KeyValuePair<TKey, TValue>, IEnumerable<KeyValuePair<TSourceKey, TSourceValue>>> update
|
||||
) => _sync_with_demux_ro(dictionary, source, key_selector, value_selector, update);
|
||||
|
||||
static void _sync_with<TKey, TValue, TSourceValue>(IDictionary<TKey, TValue> dictionary, IDictionary<TKey, TSourceValue> source, Func<TKey, TSourceValue, TValue> selector) {
|
||||
var removes = dictionary.Keys.Except(source.Keys).ToList();
|
||||
foreach (var k in removes)
|
||||
dictionary.Remove(k);
|
||||
var adds = source.Except(dictionary.Keys, kv => kv.Key).ToList();
|
||||
foreach (var kv in adds)
|
||||
dictionary.Add(kv.Key, selector(kv.Key, kv.Value));
|
||||
}
|
||||
|
||||
static void _sync_with_ro<TKey, TValue, TSourceValue>(IDictionary<TKey, TValue> dictionary, IReadOnlyDictionary<TKey, TSourceValue> source, Func<TKey, TSourceValue, TValue> selector) {
|
||||
var removes = dictionary.Keys.Except(source.Keys).ToList();
|
||||
foreach (var k in removes)
|
||||
dictionary.Remove(k);
|
||||
@@ -625,13 +666,54 @@ namespace mbts.collections.extensions {
|
||||
dictionary.Add(kv.Key, selector(kv.Key, kv.Value));
|
||||
}
|
||||
|
||||
static void _sync_with_ro<TKey, TValue, TSourceValue>(this IDictionary<TKey, TValue> dictionary, IReadOnlyDictionary<TKey, TSourceValue> source, Func<TKey, TSourceValue, TValue> selector) {
|
||||
var removes = dictionary.Keys.Except(source.Keys).ToList();
|
||||
static void _sync_with_demux<TKey, TValue, TSourceKey, TSourceValue>(
|
||||
IDictionary<TKey, TValue> dictionary,
|
||||
IDictionary<TSourceKey, TSourceValue> source,
|
||||
Func<KeyValuePair<TSourceKey, TSourceValue>, TKey> key_selector,
|
||||
Func<IGrouping<TKey, KeyValuePair<TSourceKey, TSourceValue>>, TValue> value_selector,
|
||||
Action<KeyValuePair<TKey, TValue>, IEnumerable<KeyValuePair<TSourceKey, TSourceValue>>> update
|
||||
) {
|
||||
var source_lookup = source.ToLookup(key_selector);
|
||||
HashSet<TKey> changes = new HashSet<TKey>(), removes = new HashSet<TKey>();
|
||||
foreach (var kv in dictionary) {
|
||||
if (source_lookup.TryGetValue(kv.Key, out IEnumerable<KeyValuePair<TSourceKey, TSourceValue>> result)) {
|
||||
update(kv, result);
|
||||
changes.Add(kv.Key);
|
||||
} else {
|
||||
removes.Add(kv.Key);
|
||||
}
|
||||
}
|
||||
foreach (var k in removes)
|
||||
dictionary.Remove(k);
|
||||
var adds = source.Except(dictionary.Keys, kv => kv.Key).ToList();
|
||||
foreach (var kv in adds)
|
||||
dictionary.Add(kv.Key, selector(kv.Key, kv.Value));
|
||||
foreach (var g in source_lookup) {
|
||||
if (!changes.Contains(g.Key))
|
||||
dictionary.Add(g.Key, value_selector(g));
|
||||
}
|
||||
}
|
||||
|
||||
static void _sync_with_demux_ro<TKey, TValue, TSourceKey, TSourceValue>(
|
||||
IDictionary<TKey, TValue> dictionary,
|
||||
IReadOnlyDictionary<TSourceKey, TSourceValue> source,
|
||||
Func<KeyValuePair<TSourceKey, TSourceValue>, TKey> key_selector,
|
||||
Func<IGrouping<TKey, KeyValuePair<TSourceKey, TSourceValue>>, TValue> value_selector,
|
||||
Action<KeyValuePair<TKey, TValue>, IEnumerable<KeyValuePair<TSourceKey, TSourceValue>>> update
|
||||
) {
|
||||
var source_lookup = source.ToLookup(key_selector);
|
||||
HashSet<TKey> changes = new HashSet<TKey>(), removes = new HashSet<TKey>();
|
||||
foreach (var kv in dictionary) {
|
||||
if (source_lookup.TryGetValue(kv.Key, out IEnumerable<KeyValuePair<TSourceKey, TSourceValue>> result)) {
|
||||
update(kv, result);
|
||||
changes.Add(kv.Key);
|
||||
} else {
|
||||
removes.Add(kv.Key);
|
||||
}
|
||||
}
|
||||
foreach (var k in removes)
|
||||
dictionary.Remove(k);
|
||||
foreach (var g in source_lookup) {
|
||||
if (!changes.Contains(g.Key))
|
||||
dictionary.Add(g.Key, value_selector(g));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
|
||||
namespace mbts.utils
|
||||
{
|
||||
class SingleValuePump<T> : IDisposable
|
||||
{
|
||||
public SingleValuePump(Action<T> init=null, Action<T> destroy=null) {
|
||||
// use publisher to ensure that, for each new value, init is called and Current is assigned before the subscribers are notified
|
||||
bool value_set = false;
|
||||
Func<T, T> assign_and_select = init != null ?
|
||||
new Func<T, T>(v => {
|
||||
init(v);
|
||||
Current = v;
|
||||
value_set = true;
|
||||
return v;
|
||||
}) :
|
||||
new Func<T, T>(v => {
|
||||
Current = v;
|
||||
value_set = true;
|
||||
return v;
|
||||
});
|
||||
var publisher = _pump.Select(assign_and_select).Publish();
|
||||
Observable = publisher.AsObservable();
|
||||
_disposables.Add(publisher.Connect());
|
||||
if (destroy != null) {
|
||||
_disposables.Add(_pump.PairWithPrevious().Skip(1).Select(vals => vals.prev).Subscribe(destroy));
|
||||
_disposables.Add(Disposable.Create(() => { if (value_set) destroy(Current); }));
|
||||
namespace mbts.utils {
|
||||
class SingleValuePump<T> : IDisposable {
|
||||
readonly Action<T> _init, _destroy;
|
||||
T _value;
|
||||
bool _value_present;
|
||||
|
||||
public SingleValuePump()
|
||||
: this(null, val => (val as IDisposable)?.Dispose()) { }
|
||||
|
||||
public SingleValuePump(Action<T> init, Action<T> destroy) {
|
||||
_init = init;
|
||||
_destroy = destroy;
|
||||
}
|
||||
|
||||
public event Action<T> value_changed;
|
||||
|
||||
public T value {
|
||||
get => _value;
|
||||
set {
|
||||
if (_value_present)
|
||||
_destroy?.Invoke(_value);
|
||||
_value_present = true;
|
||||
_value = value;
|
||||
_init?.Invoke(value);
|
||||
value_changed?.Invoke(value);
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<IDisposable> _disposables = new List<IDisposable>(3);
|
||||
readonly Subject<T> _pump = new Subject<T>();
|
||||
public IObservable<T> observable =>
|
||||
Observable.FromEvent<Action<T>, T>(cb => value_changed += cb, cb => value_changed -= cb);
|
||||
|
||||
public T Current { get; private set; }
|
||||
public void Push(T value) => _pump.OnNext(value);
|
||||
public IObservable<T> Observable { get; }
|
||||
public void Dispose() => Disposable.dispose(_disposables);
|
||||
public void Dispose() {
|
||||
if (_value_present)
|
||||
_destroy?.Invoke(_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ namespace bts.view.controls {
|
||||
|
||||
private void on_loaded(object sender, RoutedEventArgs e) {
|
||||
MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
|
||||
this.move_to_mouse();
|
||||
}
|
||||
private void any_button_click(object sender, RoutedEventArgs e) {
|
||||
Close();
|
||||
@@ -65,10 +66,10 @@ namespace bts.view.controls {
|
||||
image: screenshot
|
||||
));
|
||||
if (reply.success) {
|
||||
BTSMessageBox.Show("Your message has been received.", "Thank You", BTSMessageBoxButtons.OK, MessageBoxImage.Information, top_most:true);
|
||||
BTSMessageBox.Show("Your message has been received.", "Thank You", BTSMessageBoxButtons.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else {
|
||||
BTSMessageBox.Show($"There was an error submitting your message. '{reply.error_message}'", "Error", BTSMessageBoxButtons.OK, MessageBoxImage.Error, top_most:true);
|
||||
BTSMessageBox.Show($"There was an error submitting your message. '{reply.error_message}'", "Error", BTSMessageBoxButtons.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
using bts.api;
|
||||
using mbts.ui.shell;
|
||||
using System;
|
||||
|
||||
namespace mbts.spark
|
||||
{
|
||||
interface ISecurityRow
|
||||
{
|
||||
namespace mbts.spark {
|
||||
interface ISecurityRow {
|
||||
SecurityImmutable security { get; }
|
||||
}
|
||||
|
||||
abstract class SecurityRow : DisposableViewModelBase, ISecurityRow, IEquatable<SecurityRow>, IEquatable<ISecurityRow>
|
||||
{
|
||||
abstract class SecurityRow : DisposableViewModelBase, ISecurityRow {
|
||||
protected SecurityRow(SecurityImmutable security) => this.security = security;
|
||||
public SecurityImmutable security { get; }
|
||||
public uint security_key => security.Id;
|
||||
|
||||
bool _equals(ISecurityRow other) => other != null && other.security.Id == security.Id;
|
||||
public bool Equals(SecurityRow other) => _equals(other);
|
||||
bool IEquatable<ISecurityRow>.Equals(ISecurityRow other) => _equals(other);
|
||||
public override bool Equals(object obj) => _equals(obj as ISecurityRow);
|
||||
public override int GetHashCode() => security.Id.GetHashCode();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
<Style x:Key="RightAlignedColumn" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="TextAlignment" Value="Right" />
|
||||
</Style>
|
||||
<convert:DoubleTextConverter x:Key="DoubleWithNaNHiddenConverter" Format="F2" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
@@ -52,7 +53,7 @@
|
||||
<DataGridTextColumn Header="Security" Binding="{Binding security_text}" IsReadOnly="true"
|
||||
c:DataGridFilterProperties.Filter="{Binding DataContext.security_filter, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterActive="{Binding DataContext.security_filter.active, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterOpen="{Binding DataContext.security_filter.oppen, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterOpen="{Binding DataContext.security_filter.open, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterTemplate="{StaticResource RegexTemplate}"
|
||||
/>
|
||||
<DataGridTextColumn Header="SOD" Binding="{Binding sod_position}" IsReadOnly="true"
|
||||
@@ -109,31 +110,35 @@
|
||||
</MultiBinding>
|
||||
</DataGridTextColumn.Binding>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="AvgBuy" IsReadOnly="true" SortMemberPath="weighted_average_buy"
|
||||
<DataGridTextColumn Header="AvgBuy" Binding="{Binding weighted_average_buy, Converter={StaticResource DoubleWithNaNHiddenConverter}}" IsReadOnly="true" SortMemberPath="weighted_average_buy"
|
||||
ElementStyle="{StaticResource RightAlignedColumn}"
|
||||
c:DataGridFilterProperties.Filter="{Binding DataContext.weighted_average_buy_filter, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterActive="{Binding DataContext.weighted_average_buy_filter.active, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterOpen="{Binding DataContext.weighted_average_buy_filter.open, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterTemplate="{StaticResource DoubleMinMaxTemplate}">
|
||||
<!--
|
||||
<DataGridTextColumn.Binding>
|
||||
<MultiBinding Converter="{StaticResource TickDisplayConverter}">
|
||||
<Binding Path="weighted_average_buy"/>
|
||||
<Binding Path="security.ContractSpec"/>
|
||||
</MultiBinding>
|
||||
</DataGridTextColumn.Binding>
|
||||
-->
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="AvgSell" IsReadOnly="true" SortMemberPath="weighted_average_sell"
|
||||
<DataGridTextColumn Header="AvgSell" Binding="{Binding weighted_average_sell, Converter={StaticResource DoubleWithNaNHiddenConverter}}" IsReadOnly="true" SortMemberPath="weighted_average_sell"
|
||||
ElementStyle="{StaticResource RightAlignedColumn}"
|
||||
c:DataGridFilterProperties.Filter="{Binding DataContext.weighted_average_sell_filter, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterActive="{Binding DataContext.weighted_average_sell_filter.active, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterOpen="{Binding DataContext.weighted_average_sell_filter.open, Source={uc:DirectReference _grid}}"
|
||||
c:DataGridFilterProperties.FilterTemplate="{StaticResource DoubleMinMaxTemplate}">
|
||||
<!--
|
||||
<DataGridTextColumn.Binding>
|
||||
<MultiBinding Converter="{StaticResource TickDisplayConverter}">
|
||||
<Binding Path="weighted_average_sell"/>
|
||||
<Binding Path="security.ContractSpec"/>
|
||||
</MultiBinding>
|
||||
</DataGridTextColumn.Binding>
|
||||
-->
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</c:DataGridEx>
|
||||
|
||||
@@ -247,5 +247,5 @@ JetFIX {
|
||||
# pp cme_mbx
|
||||
# taha cme_mc1
|
||||
# kevin cme_mc5
|
||||
|
||||
# michael cme_mc8
|
||||
SparkConnection {value {connection_name: "sim"}}
|
||||
@@ -1,12 +1,68 @@
|
||||
|
||||
P&L UI Test
|
||||
|
||||
Open the P&L form (Trading->P&L)
|
||||
Turn merge with md off since we want to control the md
|
||||
|
||||
Open a ladder and select an account that's not currently listed on the P&L form
|
||||
ExchangeSim {
|
||||
value {merge_with_md:false}
|
||||
}
|
||||
|
||||
Make some trades by crossing yourself in that ladder.
|
||||
clear your fills database:
|
||||
rm ~/.bts/data/databases/fills/*
|
||||
|
||||
A new P&L row with your account should come up, P&L should read zero, buy qty and sell qty should be equal
|
||||
and you may also want to clear your orders for a clean slate:
|
||||
rm ~/.bts/data/databases/orders/*
|
||||
|
||||
Bring up the pnl form (empty).
|
||||
Bring up a ladder form. It should be completely empty since we're controlling the md. For this exercise we'll be using ES.
|
||||
Bring up an order ticket for your corresponding ladder
|
||||
place a buy order with price 2500 and qty 100
|
||||
your ladder should populate now
|
||||
Sell a 1 lot at your bid
|
||||
The Start of Day (SOD) position should be 0
|
||||
Buy qty and Sell qty should be 1 (we crossed our own bid)
|
||||
Net Pos should be 0 (buy 1 - sell 1)
|
||||
PnL should be 0 (since we have a 0 net position)
|
||||
PnL Price should be the level of your bid.
|
||||
AvgBuy and Avg Sell should both represent the level at which you entered the buy and sell order
|
||||
Improve the bid
|
||||
Under BTS2 account (this is important for the next step), enter a 100 lot at 2500.25
|
||||
Observe the PnL Price reflect the current bid
|
||||
Switch back to BTS1
|
||||
Sell a 1 lot at the current bid
|
||||
You should now have rows for both the BTS1 and BTS2 account
|
||||
BTS1
|
||||
Sell Qty 2
|
||||
Net Pos -1
|
||||
PnL 0
|
||||
Avg Buy 2500.0
|
||||
Avg Sell 2500.13
|
||||
Improve the Bid
|
||||
Enter a 100 lot at 2500.50
|
||||
The PnL Price should reflect the current Bid (2500.5)
|
||||
The PnL for BTS1 account should show -12.5
|
||||
Fill 1: 25 = (2500.5 - 2500) * 1 * 50
|
||||
Fill 2: -25 = (2500 - 2500.5) * 1 * 50
|
||||
Fill 3: -12.5 = (2500.25 - 2500.5) * 1 * 50
|
||||
The PnL for BTS2 account should show 12.5 by a similar calculation as above (but there is only 1 fill)
|
||||
Go to bed and wake up the next day
|
||||
The SOD for BTS1 should show a -1
|
||||
The SOD for BTS2 should show a 1
|
||||
Buy Qty for all should show 0
|
||||
Sell Qty for all should show 0
|
||||
Net Pos should be the same as SOD at the moment
|
||||
The simulator might not work for orders left up overnight
|
||||
If your ladder shows no working orders, place a buy order with price 2500 and qty 100
|
||||
Sell a 1 lot as the current bid
|
||||
The SOD should still show -1
|
||||
The Buy and Sell Qty should show 1 (we crossed ourself)
|
||||
The net position will still say -1
|
||||
Now switch to BTS2
|
||||
Sell a 5 lot at the current bid
|
||||
The SOD should still show -1
|
||||
BTS1 Buy qty should show 5
|
||||
BTS1 Sell Qty should show 1
|
||||
Net Pos should show 3 (-1 (SOD) + 5 (Buys) -1 (Sells))
|
||||
BTS1 PnL should show 12.5
|
||||
|
||||
Test sorting and filtering
|
||||
@@ -17,6 +17,7 @@ Check that what you mouse into or type into the keypad is reflected in the order
|
||||
Cancels: Work some orders, cancel them individually, and via Cancel Bids, Cancel Asks, Cancel all
|
||||
|
||||
Order Types
|
||||
**Market, Stop, and Stop Limit orders require Cert**
|
||||
Test a market order, do a buy and a sell and make sure they fill at market price and qty
|
||||
Test Stop and Stop limit orders. Put a Stop Buy above the market and a Stop Sell below
|
||||
|
||||
@@ -25,6 +26,4 @@ Select ICEBerg and then specify limit as subtype via the left arrow. Set show q
|
||||
Now select a size greater than 1 in the main ladder, place buys and sells in the ladder.'
|
||||
|
||||
Test TimeBox
|
||||
Ask Taha?
|
||||
|
||||
|
||||
Enter any time in the future and a reasonable end time. Enter two orders. Cross one of the orders during the specified time window with a limit order and verify it was filled correctly. Verify the other order cancels after the end time.
|
||||
@@ -12,4 +12,4 @@ if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Commo
|
||||
)
|
||||
copy /y ..\tools\cpp.build.props Directory.Build.Props
|
||||
del spark.sln
|
||||
nuget_restore.cmd
|
||||
%~dp0\nuget_restore.cmd
|
||||
Reference in new issue
Block a user