Compare commits

..
19 Commits
Author SHA1 Message Date
Taha Afzal 482c300b72 Merge branch 'DJ_ICE_space_bar_recenter' into DJ_ICE 2020-06-14 21:08:51 -04:00
Pedro Pinto 69ad995ba9 Updated docker 2020-06-14 15:23:18 -04:00
Pedro Pinto 0b26ec1132 Added a few build tools. 2020-06-14 15:21:55 -04:00
John Colvin 3de494c80f recenter all ladders on spacebar (don't require shift) 2020-06-12 17:05:53 -05:00
John Colvin 7deb25dd1c fix ladder recenter on spacebar 2020-06-12 13:16:57 -05:00
Pedro Pinto 7a29ae1a83 Merge branch 'DJ_ICE' of bitbucket.org:bluetradesys/spark into DJ_ICE 2020-06-12 08:44:36 -04:00
Pedro Pinto 6da893128c Cleaned up logging. 2020-06-12 08:44:20 -04:00
Pedro Pinto 2cb458af2d Added OnBehalfofcompid tag to ICE as per cert. 2020-06-12 08:42:40 -04:00
Taha Afzal 04db38d627 Merge branch 'DJ_ICE_release_candidates' into DJ_ICE 2020-06-11 21:22:18 -04:00
John Colvin a144b03361 ladder recenter on spacebar (across thread barrier) 2020-06-11 18:28:37 -05:00
John Colvin 9c89a9a47e TabDocument forwards key press events to IShellWindows 2020-06-11 18:24:26 -05:00
John Colvin 007af71bb2 fix ladder center-on-settle behavior once and for all 2020-06-11 17:09:05 -05:00
Taha Afzal a216d1cc81 Fixing sell order check for distance from settlement 2020-06-11 09:19:03 -04:00
Pedro Pinto f8395c11b5 Fixed application, vendor tags for DJ. 2020-06-11 08:26:26 -04:00
John Colvin 2b0e46ed38 fix ladder center around settle behavior 2020-06-11 00:36:11 -05:00
John Colvin 5f3b243265 'max settlement cross ticks limit' ladder setting 2020-06-10 18:16:52 -05:00
John Colvin c9ce2d18bf simplify 'Safety Checks' content alignment in ladder settings dialog 2020-06-10 17:33:13 -05:00
John Colvin 7b563ba66c ladder centers around settlement price if no bid/ask market 2020-06-10 13:17:01 -05:00
Taha Afzal 3e1be70923 Fix for HHD Balmo spreads 2020-06-10 13:57:19 -04:00
22 changed files with 328 additions and 68 deletions

No files matched your search

@@ -87,6 +87,15 @@ namespace mbts.spark {
public static bool operator !=(LadderColumnSettings x, LadderColumnSettings y) => !(x == y);
}
[ProtoContract]
class LadderOrderLimits : IEquatable<LadderOrderLimits> {
[ProtoMember(1)]
public ToggleInt32Proto max_settlement_cross_ticks { get; set; }
public bool Equals(LadderOrderLimits other) =>
other != null && max_settlement_cross_ticks == other.max_settlement_cross_ticks;
}
[ProtoContract]
class HistogramBarAnimation : IEquatable<HistogramBarAnimation> {
// this class is 100% mutable (there are literally 0 readonly members),
@@ -314,6 +323,8 @@ namespace mbts.spark {
// Settings are liable to change in the near future, so an internal IEqualityComparer simply won't do as it risks becoming out of date.
[ProtoContract]
class LadderSettings : IEquatable<LadderSettings> {
// RESERVED ProtoMember indices
// 900-999: dj settings
const double _default_order_entry_panel_width = 110.0;
const double _default_zoom_factor = 1.0;
const bool _default_show_warn_on_cross = true;
@@ -592,6 +603,9 @@ namespace mbts.spark {
[ProtoMember(61), DefaultValue(true)]
public bool status_message_visible { get; set; }
[ProtoMember(900)]
public LadderOrderLimits ladder_order_limits { get; set; }
public void sanitize() =>
sanitize(this);
@@ -697,7 +711,8 @@ namespace mbts.spark {
a.enforce_max_clip == b.enforce_max_clip &&
a.max_clip == b.max_clip &&
a.price_display_format == b.price_display_format &&
a.status_message_visible == b.status_message_visible;
a.status_message_visible == b.status_message_visible &&
a.ladder_order_limits.safe_equals(b.ladder_order_limits);
public bool Equals(LadderSettings other) =>
profile_equals(this, other) &&
@@ -100,6 +100,7 @@ namespace bts.shell {
ShellWindowVM shell_window_vm = null;
IShellWindow shell_window = null;
var title_source = new LazyObservable<string>(() => ShellWindowExtensions.literal_title_source(shell_window, shell_window_vm));
LadderVM vm = null;
var view = new Lazy<UIElement>(() => {
// resources
var model = new LadderModel(md, _orders_model, _mbo);
@@ -113,7 +114,6 @@ namespace bts.shell {
/// In response to that event, 'needs_resync' is set to true. This causes 'last_value' to be refreshed when the next caller requests the latest settings
/// (i.e., an IObserver subscribing to the settings_source, or the settings-dialog viewmodel).
bool initialized = false, needs_resync = false;
LadderVM vm = null;
var settings_subject = new Subject<LadderSettings>();
var settings_source = Observable.Create<LadderSettings>(o => {
ensure_synced();
@@ -272,10 +272,11 @@ namespace bts.shell {
(v, s) => save(_get_state(((LadderView)v).vm, settings_id), s),
icon: Icons.Ladder,
thread_id: _thread_id_provider.next_id(),
vm => {
shell_window_vm = vm;
swvm => {
shell_window_vm = swvm;
title_source.connect();
});
},
key_event_args => vm?.key_down(key_event_args));
}
async void _show_windows(IImmutableSet<uint> securities) {
@@ -3,6 +3,7 @@ using bts.api;
using bts.api.orderman;
using bts.collections;
using bts.persist.algo;
using bts.proto;
using bts.shell.orderbook;
using bts.utils;
using mbts.collections;
@@ -44,7 +45,8 @@ namespace mbts.spark {
LadderSettings.NetChangeTerms _price_format;
LadderSettings.PriceDisplayFormat _price_display_format;
double _order_entry_panel_width, _zoom_factor;
bool _auto_clear, _show_warn_on_cross, _enforce_max_clip;
bool _auto_clear, _show_warn_on_cross, _enforce_max_clip, _enforce_max_settlement_cross_ticks;
int _max_settlement_cross_ticks;
LadderSettings _current;
LadderColumnSettingsVM
_orders = new OrdersColumnSettingsVM(),
@@ -190,6 +192,8 @@ namespace mbts.spark {
public bool show_warn_on_cross { get => _show_warn_on_cross; set => Set(ref _show_warn_on_cross, value); }
public bool enforce_max_clip { get => _enforce_max_clip; set => Set(ref _enforce_max_clip, value); }
public uint max_clip { get => _max_clip.Value; set => _max_clip.Value = value; }
public bool enforce_max_settlement_cross_ticks { get => _enforce_max_settlement_cross_ticks; set => Set(ref _enforce_max_settlement_cross_ticks, value); }
public int max_settlement_cross_ticks { get => _max_settlement_cross_ticks; set => Set(ref _max_settlement_cross_ticks, value); }
// favorites
public FavoriteAlgosVM favorite_algos_vm { get; }
@@ -370,6 +374,10 @@ namespace mbts.spark {
show_warn_on_cross = settings.show_warn_on_cross;
enforce_max_clip = settings.enforce_max_clip;
max_clip = settings.max_clip;
if (settings.ladder_order_limits != null) {
enforce_max_settlement_cross_ticks = settings.ladder_order_limits.max_settlement_cross_ticks.is_enabled;
max_settlement_cross_ticks = settings.ladder_order_limits.max_settlement_cross_ticks.value;
}
}
}
@@ -448,6 +456,10 @@ namespace mbts.spark {
clone.show_warn_on_cross = show_warn_on_cross;
clone.enforce_max_clip = enforce_max_clip;
clone.max_clip = max_clip;
if (clone.ladder_order_limits == null)
clone.ladder_order_limits = new LadderOrderLimits();
clone.ladder_order_limits.max_settlement_cross_ticks =
new ToggleInt32Proto(max_settlement_cross_ticks, enforce_max_settlement_cross_ticks);
return clone;
}
@@ -1,5 +1,6 @@
using bts.api;
using bts.api.orderman;
using bts.proto;
using bts.shell;
using bts.spark;
using bts.utils;
@@ -259,7 +260,11 @@ namespace mbts.spark {
public IBus bus => _bus;
public event Action on_tick, request_settings_dialog, settings_invalidated;
public event Action
on_tick,
request_settings_dialog,
request_recenter,
settings_invalidated;
public MDConsumerHandle md => _model.md;
// we return only entries who have piqs and whose piqs are not uint.Max
@@ -447,15 +452,27 @@ namespace mbts.spark {
public void key_down(KeyEventArgs e) {
if (order_properties_vm == null)
return;
if (KeyboardExtensions.IsDown(Key.Space)) {
_bus?.post(SparkTags.RequestRecenterLadder, null);
}
// the ctrl modifier requirement helps avoid keyboard-input collisions w/ algo-templates popup
if (!KeyboardExtensions.IsCtrlDown()) return;
var new_algo = order_properties_vm.algo_definitions.FirstOrDefault(o => o.algo_root.key_match(e));
if (new_algo != null) {
order_properties_vm.selected_algo_definition = new_algo;
e.Handled = true;
switch (e.Key) {
case Key.Space:
if (KeyboardExtensions.IsShiftDown()) {
// only recenter this ladder
request_recenter?.Invoke();
} else {
// recenter all ladders
_bus?.post(SparkTags.RequestRecenterLadder, null);
}
e.Handled = true;
break;
default:
// the ctrl modifier requirement helps avoid keyboard-input collisions w/ algo-templates popup
if (KeyboardExtensions.IsCtrlDown()) {
var new_algo = order_properties_vm.algo_definitions.FirstOrDefault(o => o.algo_root.key_match(e));
if (new_algo != null) {
order_properties_vm.selected_algo_definition = new_algo;
e.Handled = true;
}
}
break;
}
}
@@ -489,6 +506,10 @@ namespace mbts.spark {
}
public async Task send_order_async(Side side, uint size, double price) {
if (!_validate_price(side, price, out var invalid_price_msg)) {
status_update(new Activity { security = security, message = invalid_price_msg, category = ActivityLogCategory.order });
return;
}
var order = order_properties_vm.create(side);
if (order.CustomDef != null) {
if (order.CustomDef.Stop != null) {
@@ -520,6 +541,23 @@ namespace mbts.spark {
}
}
bool _validate_price(Side side, double price, out string msg) {
msg = null;
if (!price.is_real()) {
msg = "not a real number";
} else if (settlement.is_real()) {
var ticks_from_settle = security.ContractSpec.tickdiff(price, settlement);
if (ticks_from_settle.HasValue) {
var max_cross = (current_settings?.ladder_order_limits?.max_settlement_cross_ticks)?.as_nullable();
if (max_cross.HasValue) {
if (side == Side.Sell ? ticks_from_settle < (-1 * max_cross.Value) : ticks_from_settle > max_cross.Value)
msg = $"exceeds settle cross ticks limit ({ticks_from_settle.Value})";
}
}
}
return msg == null;
}
void _update_header() {
bool last_updated = md.get_last_trade(ref _last_trade_time, out NativePriceSize last, out DateTime time, out ulong volume);
if (_misc_time != _model.md.misc_timestamp || last_updated) {
@@ -53,7 +53,7 @@ namespace mbts.spark {
readonly RefValueContainer<IEnumerable<VolumeAtPriceLevelImmutable>> _volume_container =
new RefValueContainer<IEnumerable<VolumeAtPriceLevelImmutable>>();
IDisposable _settings_sub, _volume_sub, _tick_sub;
IDisposable _settings_sub, _volume_sub, _tick_sub, _vm_sub;
ScrollViewer _scrollViewer;
LadderSettings _settings;
LadderVM _vm;
@@ -697,10 +697,22 @@ namespace mbts.spark {
_price_comparer = Comparer<double>.Create((x, y) => security.ContractSpec.tick_equals(x, y) ? 0 : y.CompareTo(x));
_price_dirty = true;
_piq_dirty = true;
_vm.on_tick += _tick;
// **use local vm to protect against re-assignment,
// so the events are unhooked from the same instance to which they were added
// when the subs are disposed.
var local_vm = _vm;
local_vm.on_tick += _tick;
local_vm.request_recenter += on_request_recenter;
_settings_sub = _vm.settings.OnDispatcher().Subscribe(_settings_updated);
_volume_sub = _vm.model.order_gateway.md_auxiliary_model.security_volume_at_price(security.Id).Subscribe(t => _volume_container.write_value(t.state.Values));
_tick_sub = Disposable.Create(() => _vm.on_tick -= _tick);
// **unhook from local_vm.request_recenter.
// todo: organize these subs into a single entity, prob _vm_subs.
// This hasn't already been done bc the ladder a bit fragile, so changes must be carefully implemented,
// with meticulous attention to detail.
_tick_sub = Disposable.Create(() => local_vm.on_tick -= _tick);
_vm_sub = Disposable.Create(() => local_vm.request_recenter -= on_request_recenter);
void on_request_recenter() =>
RecenterCommand?.ExecuteIfCan(null);
}
}
@@ -1069,7 +1081,7 @@ namespace mbts.spark {
double best_bid = _get_top_price(_bids);
double best_ask = _get_top_price(_asks);
return double.IsNaN(best_bid) ?
double.IsNaN(best_ask) ? _vm.low : security.ContractSpec.tickdown(best_ask) :
double.IsNaN(best_ask) ? _vm.settlement : security.ContractSpec.tickdown(best_ask) :
best_bid;
}
@@ -1077,7 +1089,7 @@ namespace mbts.spark {
double best_bid = _get_top_price(_bids);
double best_ask = _get_top_price(_asks);
return double.IsNaN(best_ask) ?
double.IsNaN(best_bid) ? security.ContractSpec.tickdown(_vm.high) : best_bid :
double.IsNaN(best_bid) ? _vm.settlement : best_bid :
security.ContractSpec.tickdown(best_ask);
}
@@ -1085,7 +1097,7 @@ namespace mbts.spark {
double best_bid = _get_top_price(_bids);
double best_ask = _get_top_price(_asks);
return double.IsNaN(best_bid) ?
double.IsNaN(best_ask) ? 0.5 * (_vm.low + _vm.high) : security.ContractSpec.tickdown(best_ask) :
double.IsNaN(best_ask) ? _vm.settlement : security.ContractSpec.tickdown(best_ask) :
double.IsNaN(best_ask) ? best_bid : TickUtils.mid_tick(security.ContractSpec, best_bid, best_ask);
}
@@ -1019,45 +1019,47 @@
<Grid HorizontalAlignment="Left" Margin="6">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="{Binding Source={StaticResource VerticalPush1}}"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="{Binding Source={StaticResource VerticalPush1}}"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="{Binding Source={StaticResource HorizontalPush3}}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- market cross -->
<CheckBox Name="warn" Grid.Column="0" FlowDirection="RightToLeft" IsChecked="{Binding show_warn_on_cross}">
<CheckBox.Resources>
<Style TargetType="{x:Type Path}">
<Setter Property="FlowDirection" Value="LeftToRight"/>
</Style>
</CheckBox.Resources>
<CheckBox Grid.Column="0" VerticalContentAlignment="Center" IsChecked="{Binding show_warn_on_cross}">
<TextBlock
Style="{StaticResource EnableDisableFeatureText}"
IsEnabled="{Binding show_warn_on_cross}"
Text="Warn on Market Cross"
/>
</CheckBox>
<TextBlock Grid.Column="1"
Style="{StaticResource EnableDisableFeatureText}"
IsEnabled="{Binding ElementName=warn, Path=IsChecked}"
Text="Warn on Market Cross" />
<!-- max order qty -->
<CheckBox Name="enforce_max_clip" Grid.Row="1" Grid.Column="0" FlowDirection="RightToLeft" IsChecked="{Binding enforce_max_clip}">
<CheckBox.Resources>
<Style TargetType="{x:Type Path}">
<Setter Property="FlowDirection" Value="LeftToRight"/>
</Style>
</CheckBox.Resources>
<CheckBox Grid.Row="2" Grid.Column="0" VerticalContentAlignment="Center" IsChecked="{Binding enforce_max_clip}">
<TextBlock
Style="{StaticResource EnableDisableFeatureText}"
IsEnabled="{Binding enforce_max_clip}"
Text="Max Order Quantity"
/>
</CheckBox>
<TextBlock Grid.Row="1" Grid.Column="1"
Style="{StaticResource EnableDisableFeatureText}"
IsEnabled="{Binding ElementName=enforce_max_clip, Path=IsChecked}"
MinWidth="{Binding ElementName=warn, Path=ActualWidth}"
Text="Max Order Quantity"/>
<c:TickUpDownUInt Grid.Row="1" Grid.Column="2"
IsEnabled="{Binding ElementName=enforce_max_clip, Path=IsChecked}"
Value="{Binding max_clip}" />
<c:TickUpDownUInt
Grid.Row="2"
Grid.Column="2"
IsEnabled="{Binding enforce_max_clip}"
Value="{Binding max_clip}"
Width="60"
/>
<CheckBox Grid.Row="4" VerticalContentAlignment="Center" IsChecked="{Binding enforce_max_settlement_cross_ticks}">
<TextBlock
Style="{StaticResource EnableDisableFeatureText}"
IsEnabled="{Binding enforce_max_settlement_cross_ticks}"
Text="Max Ticks from Settlement"
/>
</CheckBox>
<c:TickUpDownInt Grid.Row="4" Grid.Column="2" IsEnabled="{Binding enforce_max_settlement_cross_ticks}" Value="{Binding max_settlement_cross_ticks}"/>
</Grid>
</TabItem>
<TabItem Header="Mini Order Book">
@@ -93,6 +93,7 @@ namespace mbts.spark {
_ui_scaler.MouseDoubleClick += _ui_scaler_MouseDoubleClick;
this.PreviewMouseWheel += LadderView_PreviewMouseWheel;
this.PreviewMouseDown += LadderView_PreviewMouseDown;
PreviewKeyDown += (s, e) => vm.key_down(e);
}
IDisposable _connect_left_panel_scroll() {
@@ -0,0 +1,34 @@
using ProtoBuf;
using System;
namespace bts.proto {
[ProtoContract]
readonly struct ToggleInt32Proto : IEquatable<ToggleInt32Proto> {
public ToggleInt32Proto(int value, bool is_enabled) {
this.value = value;
this.is_enabled = is_enabled;
}
[ProtoMember(1)]
public int value { get; }
[ProtoMember(2)]
public bool is_enabled { get; }
public bool Equals(ToggleInt32Proto other) =>
value == other.value && is_enabled == other.is_enabled;
public override bool Equals(object obj) =>
obj is ToggleInt32Proto other && Equals(other);
public override int GetHashCode() =>
(value % (1 << 31)) | (is_enabled ? 1 << 31 : 0);
public static bool operator ==(ToggleInt32Proto a, ToggleInt32Proto b) => a.Equals(b);
public static bool operator !=(ToggleInt32Proto a, ToggleInt32Proto b) => !a.Equals(b);
}
static class ToggleInt32ProtoExtensions {
public static int? as_nullable(this ToggleInt32Proto toggle) =>
toggle.is_enabled ? toggle.value : (int?)null;
}
}
@@ -2,6 +2,7 @@
using System;
using System.IO;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace mbts.ui {
@@ -51,15 +52,19 @@ namespace mbts.ui {
public void thread_init() { }
}
public static IShellWindow create(IShellModule owner, string title, string window_type, Lazy<UIElement> content, Action<UIElement, Stream> get_state = null, ImageSource icon = null, string thread_id=null, Action<ShellWindowVM> on_shell_window_vm = null) {
public static IShellWindow create(IShellModule owner, string title, string window_type, Lazy<UIElement> content, Action<UIElement, Stream> get_state = null, ImageSource icon = null, string thread_id=null, Action<ShellWindowVM> on_shell_window_vm = null, Action<KeyEventArgs> on_key_down = null) {
IShellWindow rv = null;
if (string.IsNullOrEmpty(thread_id)) {
return create<AnonShellWindow>(owner, title, window_type, content, get_state, icon, on_shell_window_vm);
rv = create<AnonShellWindow>(owner, title, window_type, content, get_state, icon, on_shell_window_vm);
if (on_key_down != null)
rv = new KeyListenerWrapper(rv, on_key_down);
}
else {
var res = create<LazyAnonShellWindow>(owner, title, window_type, content, get_state, icon, on_shell_window_vm);
res.thread_id = thread_id;
return res;
rv = on_key_down == null ? (ISharedWindow)res : new SharedKeyListenerWrapper(res, on_key_down);
}
return rv;
}
static T create<T>(IShellModule owner, string title, string window_type, Lazy<UIElement> content, Action<UIElement,Stream> get_state=null, ImageSource icon=null, Action<ShellWindowVM> on_shell_window_vm = null) where T : AnonShellWindow, new() {
var result = new T() {
@@ -121,5 +126,56 @@ namespace mbts.ui {
if (cleanup != null) { window.Closed += (o, e) => cleanup.Dispose(); }
return window;
}
class KeyListenerWrapper<T> : IShellWindow, IKeyListener where T : class, IShellWindow {
readonly T _model;
readonly Action<KeyEventArgs> _key_down;
public KeyListenerWrapper(T model, Action<KeyEventArgs> key_down) {
_model = model ?? throw new ArgumentNullException(nameof(model));
_key_down = key_down ?? throw new ArgumentNullException(nameof(key_down));
}
public event Action TitleChanged {
add => _model.TitleChanged += value;
remove => _model.TitleChanged -= value;
}
public event Action IconChanged {
add => _model.IconChanged += value;
remove => _model.IconChanged -= value;
}
public string Title { get => _model.Title; set => _model.Title = value; }
public string window_type => _model.window_type;
public ImageSource Icon => _model.Icon;
public IShellModule Owner => _model.Owner;
public void Dispose() => _model.Dispose();
public ShellWindowUI GetContent() => _model.GetContent();
public void GetState(Stream save_here) => _model.GetState(save_here);
public void on_shell_window_vm(ShellWindowVM shell_window_vm) => _model.on_shell_window_vm(shell_window_vm);
public void key_down(KeyEventArgs e) =>
_key_down(e);
}
class KeyListenerWrapper : KeyListenerWrapper<IShellWindow> {
public KeyListenerWrapper(IShellWindow model, Action<KeyEventArgs> key_down)
: base(model, key_down) { }
}
class SharedKeyListenerWrapper : KeyListenerWrapper<ISharedWindow>, ISharedWindow {
readonly ISharedWindow _model;
readonly Action<KeyEventArgs> _key_down;
public SharedKeyListenerWrapper(ISharedWindow model, Action<KeyEventArgs> key_down)
: base(model, key_down) {
_model = model ?? throw new ArgumentNullException(nameof(model));
_key_down = key_down ?? throw new ArgumentNullException(nameof(key_down));
}
public string thread_id => _model.thread_id;
public void thread_init() => _model.thread_init();
}
}
}
@@ -10,6 +10,7 @@ using System.Linq;
using System.Reactive.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace mbts.ui.shell {
// This Class owns the hierarchy of shell Windows
@@ -59,6 +60,14 @@ namespace mbts.ui.shell {
viewmodel.host_id = state.host_id ?? "";
viewmodel.TitleOverride = state.custom_title;
}
if (model is IKeyListener key_listener) {
content.KeyDown += on_key_down;
void on_key_down(object sender, KeyEventArgs e) {
viewmodel.Dispatcher.InvokeAsync(() => {
key_listener.key_down(e);
});
}
}
var window = await CreateWindow(content, state);
window.Show();
+2 -2
View File
@@ -786,9 +786,9 @@ OutFIXPtr make_logon(uint32_t seq_num, uint32_t last_seq_num_processed,
if(session_cfg.platform() == bts::config::JetFIX_Connection_JetFIXPlatform_ICE ||
session_cfg.platform() == bts::config::JetFIX_Connection_JetFIXPlatform_SIMICE)
{
buffer.add<ICEApplicationSystemName>(application);
buffer.add<ICEApplicationSystemName>("Katallage");
buffer.add<ICEApplicationSystemVersion>("1.0");
buffer.add<ICEApplicationSystemVendor>("BTS");
buffer.add<ICEApplicationSystemVendor>("Katallage");
buffer.add<UserName>(session_cfg.user_name());
buffer.add<RawDataLength>(session_cfg.raw_data().size());
+8 -8
View File
@@ -620,7 +620,7 @@ OrderOpResult ICENativeOrder::on_update(api::orderman::Update const &update)
if (me->state.last_msg().size())
me->state.set_last_msg("");
LOG(OrderMan, Warn,
LOG(OrderMan, Info,
"ICE may not honor this update if we recently issued an unacknowledged cancelreplace {}. Update: {}@{}. Buffering",
key().value(), q.value(), p.value());
me->buffered_update.emplace(p, q);
@@ -807,7 +807,7 @@ void ICENativeOrder::on_exe_report(const NewExecutionReportEvent &er)
if(er.data->exec_type == api::orderman::ExecType::EXEC_TYPE_TRADE_CANCEL ||
er.data->exec_type == api::orderman::ExecType::EXEC_TYPE_TRADE_CORRECT)
{
LOG(OrderMan, Info, "ICENativeOrder ignoring Cancel or Correct execution report {} in order {}", er.data->msg_seq_num, key().value());
LOG(OrderMan, Error, "ICENativeOrder ignoring Cancel or Correct execution report {} in order {}", er.data->msg_seq_num, key().value());
return;
}
@@ -934,7 +934,7 @@ void ICENativeOrder::handle_buffered_state(const std::string& condition)
{
if (me->buffered_cancel)
{
LOG(OrderMan, Warn,
LOG(OrderMan, Info,
"Applying buffered cancel to order {}, on ",
condition,
key().value());
@@ -943,7 +943,7 @@ void ICENativeOrder::handle_buffered_state(const std::string& condition)
else if (me->buffered_update.has_value())
{
auto [p, q] = me->buffered_update.value();
LOG(OrderMan, Warn,
LOG(OrderMan, Info,
"Applying buffered update ({}@{}) to order {}, on ",
condition,
q.value(),p.value(), key().value());
@@ -1106,14 +1106,14 @@ void ICENativeOrder::init_fix()
create_encoding.add<fix::Memo>(memo);
me->create_clordid_bm = create_encoding.add<fix::Int_ClOrdID>(get_clordid(0), ice_orderid_sz());
create_encoding.add<fix::CompanyID>(std::atoi(rr.company_id().c_str()));
//create_encoding.add<fix::OnBehalfOfCompID>(""); //optional, unclear if we need
create_encoding.add<fix::OnBehalfOfCompID>("Katallage|Katallage");
std::string cust = rr.cust_order_handing_inst();
if(cust == "")
cust = "Y";
create_encoding.add<fix::CustOrderHandlingInst>(cust);
create_encoding.add<fix::SenderSubID>(rr.operator_id());
create_encoding.add<fix::OnBehalfOfSubID>(rr.operator_id() + "|" + rr.authorized_trader());
create_encoding.add<fix::OnBehalfOfLocationID>("ISV-BTS|" + rr.authorized_group());
create_encoding.add<fix::OnBehalfOfLocationID>("DAU|" + rr.authorized_group());
create_encoding.add<fix::OriginatorUserID>(rr.authorized_trader());
create_encoding.add<fix::HandlInst>('1');
create_encoding.add<fix::Int_Symbol>(sec.ice().exchange_id());
@@ -1137,10 +1137,10 @@ void ICENativeOrder::init_fix()
update_encoding.add<fix::Memo>(memo);
me->update_orig_clordid_bm = update_encoding.add<fix::Int_OrigClOrdID>(get_clordid(0), ice_orderid_sz());
update_encoding.add<fix::CompanyID>(std::atoi(rr.company_id().c_str()));
//update_encoding.add<fix::OnBehalfOfCompID>(""); //optional, unclear if we need
update_encoding.add<fix::OnBehalfOfCompID>("Katallage|Katallage");
update_encoding.add<fix::SenderSubID>(rr.operator_id());
update_encoding.add<fix::OnBehalfOfSubID>(rr.operator_id() + "|" + rr.authorized_trader());
update_encoding.add<fix::OnBehalfOfLocationID>("ISV-BTS|" + rr.authorized_group());
update_encoding.add<fix::OnBehalfOfLocationID>("DAU|" + rr.authorized_group());
update_encoding.add<fix::OriginatorUserID>(rr.authorized_trader());
update_encoding.add<fix::HandlInst>('1');
update_encoding.add<fix::Int_Symbol>(sec.ice().exchange_id());
@@ -84,7 +84,7 @@ void ICEListener::onFuturesProductDefinition(const onixs_ice::FuturesProductDefi
on_future_strip(msg, is_interested);
else
on_future(msg, is_interested);
LOG(md,Info,"ICE_Future,{},{},{},{},{},{},{},{},{},{},{},{},{}",
LOG(md,Diag,"ICE_Future,{},{},{},{},{},{},{},{},{},{},{},{},{}",
is_interested,
msg.productName, // NG Swing GDD Futures,
msg.hubAlias, // Henry
@@ -108,7 +108,7 @@ void ICEListener::onNewExpiry(const onixs_ice::NewExpiry& msg, bool& is_interest
void ICEListener::onFuturesStrategyDefinition(const onixs_ice::FuturesStrategyDefinition& msg, bool& is_interested)
{
on_uds_future_spread(msg, is_interested);
LOG(md,Info,"ICE_Strategy,{},{},{},{},{},{},{},{},{},{},{},{},{},{}",
LOG(md,Diag,"ICE_Strategy,{},{},{},{},{},{},{},{},{},{},{},{},{},{}",
is_interested,
msg.productName,
msg.hubAlias,
@@ -334,7 +334,7 @@ void ICEListener::onSettlementPrice(const onixs_ice::SettlementPrice& msg, const
auto price = msg.settlementPrice;
auto time = msg.dateTime;
auto denominator = data->handle.security().ice_settle_denominator;
LOG(md,Diag,"OnixSICE Got Settlement: {} - {}", std::to_string(data->id), std::to_string(price));
LOG(md,Info,"OnixSICE Got Settlement: {} - {}", std::to_string(data->id), std::to_string(price));
data->handle.update_settlement(ts, convert_price(price, denominator), date_of_timestamp(time));
}
}
@@ -382,7 +382,7 @@ void ICEListener::onEndOfDayMarketSummary(const onixs_ice::EndOfDayMarketSummary
auto settle_denominator = data->handle.security().ice_settle_denominator;
data->handle.update_settlement( ts, convert_price(msg.settlementPrice, settle_denominator), date_of_timestamp(time) );
LOG(md,Warn,"OnixSICE Got EOD Market : {} - {}", std::to_string(data->id), std::to_string(msg.settlementPrice));
LOG(md,Info,"OnixSICE Got EOD Market : {} - {}", std::to_string(data->id), std::to_string(msg.settlementPrice));
auto deal_denominator = data->handle.security().ice_deal_denominator;
data->handle.update_opening( ts, double_of_price(msg.openingPrice, deal_denominator), date_of_timestamp(time) );
@@ -124,8 +124,13 @@ private:
const auto& sym = def.contractSymbol;
// TODO : this is only exception right now but for HHD sstrips
// def.contractSymbol is empty !
if (sym.size() == 0 && def.marketDesc.rfind("NG Swing GDD Futures - Henry", 0) == 0)
if (sym.size() == 0 &&
(
def.marketDesc.rfind("NG Swing GDD Futures - Henry", 0) == 0 ||
def.marketDesc.rfind("NG GDD for LD1 Futures Spr - Henry", 0) == 0
))
return "HHD";
auto end = sym.find(' ');
if(end == std::string::npos)
return sym;
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SRC_ROOT=$DIR/../..
BUILD_ROOT=`readlink -f $SRC_ROOT/build`
BUILD_TYPE="${1:-clang_debug}"
BUILD_CMD="ninja -C $BUILD_ROOT/$BUILD_TYPE"
touch $SRC_ROOT/CMakeLists.txt
$DIR/execute_in_docker $BUILD_CMD
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SRC_ROOT=$DIR/../..
BUILD_ROOT=`readlink -f $SRC_ROOT/build`
cgdb -- -ex start --cd=$BUILD_ROOT/ninja_debug/server --args ./sparkd run
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SRC_ROOT=$DIR/../..
CMD=$@
read -d '' docker_cmd << EOF
docker run \
--rm \
--net host \
-h $(hostname)_spark \
-e "TZ=America/New_York" \
--security-opt seccomp=unconfined \
-v /var/log/syslog:/var/log/syslog \
-v /usr/local/share/fonts:/usr/local/share/fonts \
-v /usr/share/fonts:/usr/share/fonts \
-v /run/user/:/run/user/ \
-v /tmp:/tmp \
-v /etc/group:/etc/group \
-v /etc/passwd:/etc/passwd \
-v /tmp:/tmp \
-v /etc/sudoers:/etc/sudoers \
-v /home:/home \
--shm-size=4024m \
-w $SRC_ROOT \
-u $UID \
-t \
-i \
-e DISPLAY=$DISPLAY \
bluetradingsystems/linux_docker
EOF
if [ -f /.dockerenv ]; then
$CMD
else
echo "Running $CMD"
$docker_cmd $CMD
fi
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/execute_in_docker /usr/local/bin/rdm $@
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CMD="$DIR/../setup_builds.sh"
$DIR/execute_in_docker "/bin/bash -c $CMD"
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SRC_ROOT=$DIR/../
$DIR/execute_in_docker /bin/bash
+3
View File
@@ -14,6 +14,7 @@ mkdir $BUILD_ROOT/clang_debug
cd $BUILD_ROOT/clang_debug
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ $SRC_ROOT
rm -rf $BUILD_ROOT/ninja_debug
mkdir $BUILD_ROOT/ninja_debug
cd $BUILD_ROOT/ninja_debug
@@ -24,3 +25,5 @@ mkdir $BUILD_ROOT/ninja_release
cd $BUILD_ROOT/ninja_release
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_CXX_COMPILER=g++ $SRC_ROOT
rm -f $SRC_ROOT/compile_commands.json
ln -s $BUILD_ROOT/clang_debug/compile_commands.json $SRC_ROOT/compile_commands.json