From 715b62977871b08afdf5a975ee88a98c542fc57d Mon Sep 17 00:00:00 2001 From: Michael Harding Date: Thu, 30 May 2019 12:04:21 -0400 Subject: [PATCH 1/6] Set use_onixs to false; for system tests --- .../spreader_simple_sanity.sh | 3 +- .../system_test_scripts/test_clip_limits.sh | 3 +- .../system_test_scripts/test_join_algo.sh | 73 +++++++++++-------- .../test_position_limits.sh | 3 +- 4 files changed, 49 insertions(+), 33 deletions(-) diff --git a/src/client/spark_test/system_test_scripts/spreader_simple_sanity.sh b/src/client/spark_test/system_test_scripts/spreader_simple_sanity.sh index 777685c6d..2ca201c44 100644 --- a/src/client/spark_test/system_test_scripts/spreader_simple_sanity.sh +++ b/src/client/spark_test/system_test_scripts/spreader_simple_sanity.sh @@ -27,7 +27,8 @@ cat << EOF > $sparkdata_dir/conf/spark.conf syslog { default_level: "Error" } file { default_level: "Error" } } -} + } + MarketDataConfig { value { use_onixs: false; } } EOF diff --git a/src/client/spark_test/system_test_scripts/test_clip_limits.sh b/src/client/spark_test/system_test_scripts/test_clip_limits.sh index 6e25645d0..f2f440124 100644 --- a/src/client/spark_test/system_test_scripts/test_clip_limits.sh +++ b/src/client/spark_test/system_test_scripts/test_clip_limits.sh @@ -27,7 +27,8 @@ cat << EOF > $sparkdata_dir/conf/spark.conf syslog { default_level: "Error" } file { default_level: "Error" } } -} + } + MarketDataConfig { value { use_onixs: false; } } EOF nohup ./sparkd run & diff --git a/src/client/spark_test/system_test_scripts/test_join_algo.sh b/src/client/spark_test/system_test_scripts/test_join_algo.sh index 616dcadba..6eeb35b96 100644 --- a/src/client/spark_test/system_test_scripts/test_join_algo.sh +++ b/src/client/spark_test/system_test_scripts/test_join_algo.sh @@ -60,25 +60,28 @@ say_verbose() { fi } -is_merge_with_md_on() { +# is_merge_with_md_on() { +# eval $invocation + +# if [ $(./sparkd configcheck ExchangeSim | grep merge_with_md: | cut -d " " -f 2) == "false" ]; then +# return 0 +# else +# return 1 +# fi +# } + +set_config() { eval $invocation - if [ $(./sparkd configcheck ExchangeSim | grep merge_with_md: | cut -d " " -f 2) == "false" ]; then - return 0 - else - return 1 - fi -} - -set_merge_with_md_off() { - eval $invocation + [ ! -d "$sparkdata_dir/conf" ] && mkdir $sparkdata_dir/conf/ + [ -f "$spark_conf" ] && mv $spark_conf $spark_conf_bak if [ -f $config_file_path ]; then say_verbose "config file exists ... removing" rm $config_file_path fi - echo "$merge_with_md_key" >> $config_file_path && test_config_file_created=true + echo "$test_conf" >> $config_file_path && test_config_file_created=true return 0 } @@ -97,14 +100,6 @@ get_tests_in_class() { return 0 } -# Start sparkd -nohup ./sparkd run & -pid=$! -echo "sparkd pid: " $pid -echo "sleeping for 120 seconds..." -sleep 120 - - # args # class_name - $1 run_bts_test() { @@ -125,27 +120,43 @@ run_bts_test() { test_script_name=$(basename "$0") verbose=true +spark_conf=$sparkdata_dir/conf/spark.conf +spark_conf_bak=$sparkdata_dir/conf/spark.conf.bak config_file_path="$sparkdata_dir/conf/test_join_algo_tests.conf" test_config_file_created=false -merge_with_md_key=$(/bin/cat <<'END_HEREDOC' +test_conf=$(/bin/cat <<'END_HEREDOC' ExchangeSim { value { merge_with_md: false } } +MarketDataConfig { + value { + use_onixs: false; + } +} END_HEREDOC ) -if is_merge_with_md_on; then - set_merge_with_md_off - if is_merge_with_md_on; then - say_err "Could not turn off merge_with_md" - say_err "Please investigate manually" - exit 1 - fi -else - say_verbose "merge with md is already off" -fi +# Start sparkd +set_config +nohup ./sparkd run & +pid=$! +echo "sparkd pid: " $pid +echo "sleeping for 60 seconds..." +sleep 60 + + +# if is_merge_with_md_on; then +# set_config +# if is_merge_with_md_on; then +# say_err "Could not turn off merge_with_md" +# say_err "Please investigate manually" +# exit 1 +# fi +# else +# say_verbose "merge with md is already off" +# fi run_bts_test "JoinAlgoTests" @@ -153,6 +164,8 @@ if [ "$test_config_file_created" = true ]; then rm $config_file_path fi +[ -f "$spark_conf_bak" ] && mv $spark_conf_bak $spark_conf + # Kill sparkd pkill -P $$ diff --git a/src/client/spark_test/system_test_scripts/test_position_limits.sh b/src/client/spark_test/system_test_scripts/test_position_limits.sh index f9ecf5a2d..edd0b1295 100644 --- a/src/client/spark_test/system_test_scripts/test_position_limits.sh +++ b/src/client/spark_test/system_test_scripts/test_position_limits.sh @@ -27,7 +27,8 @@ cat << EOF > $sparkdata_dir/conf/spark.conf syslog { default_level: "Error" } file { default_level: "Error" } } -} + } + MarketDataConfig { value { use_onixs: false; } } EOF From 15f96dda3e769628b61a1c06b162772dacaf3286 Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Thu, 30 May 2019 16:02:07 -0400 Subject: [PATCH 2/6] Fix mbo command line diagnostic utility --- src/client/sparkcmd/Cmd/MBOCommand.cs | 28 +++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/client/sparkcmd/Cmd/MBOCommand.cs b/src/client/sparkcmd/Cmd/MBOCommand.cs index 6a73ec2e3..730a1342d 100644 --- a/src/client/sparkcmd/Cmd/MBOCommand.cs +++ b/src/client/sparkcmd/Cmd/MBOCommand.cs @@ -5,6 +5,7 @@ using bts.api.core; using bts.md; using CommandLine; using System.Linq; +using bts.test; namespace bts { @@ -26,17 +27,32 @@ namespace bts { static void dump_mbo(uint key, api.Side side) { using (var ctx = new ServiceContext()) { var mbo = ctx.locate(); - var data = mbo.get_orders_for_security(new MBOSecurityQuery { SecurityId = key }); + var data = mbo.get_orders_for_security(new MBOSecurityQuery { SecurityId = key, PriceLevel = double.NaN }); Console.WriteLine($"Order data for {data.SecurityId}"); var price = 0.0; - foreach(var e in data.Bid.Concat(data.Ask)) { - if (e.Price != price) { - price = e.Price; - Console.WriteLine("================"); + var color = Console.ForegroundColor; + if (side == api.Side.Sell || side == api.Side.Undefined) { + Console.ForegroundColor = ConsoleColor.Red; + foreach(var e in data.Ask.Reverse()) { + if (e.Price != price) { + price = e.Price; + Console.WriteLine("================"); + } + Console.WriteLine(e); } - Console.WriteLine(e); } + if (side == api.Side.Buy || side == api.Side.Undefined) { + Console.ForegroundColor = ConsoleColor.Blue; + foreach(var e in data.Bid) { + if (e.Price != price) { + price = e.Price; + Console.WriteLine("================"); + } + Console.WriteLine(e); + } + } + Console.ForegroundColor = color; } } } From 9b2f41c805eecf407f1b41df0da69044e27a037f Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Thu, 30 May 2019 17:00:09 -0400 Subject: [PATCH 3/6] SPARK-2472 our orders are hard to identify in mbo --- .../spark/view/Spark/Ladder/MBO/MBOPopupModel.cs | 16 +++++++++------- .../spark/view/Spark/Ladder/MBO/MBOPopupView.cs | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/client/spark/view/Spark/Ladder/MBO/MBOPopupModel.cs b/src/client/spark/view/Spark/Ladder/MBO/MBOPopupModel.cs index ede6f0e84..b5bea76dc 100644 --- a/src/client/spark/view/Spark/Ladder/MBO/MBOPopupModel.cs +++ b/src/client/spark/view/Spark/Ladder/MBO/MBOPopupModel.cs @@ -44,7 +44,7 @@ namespace mbts.spark { readonly MBOService _mbo; readonly SecurityImmutable _security; readonly MBOSecurityQueryImmutable _query; - readonly Dictionary _cache; + readonly Dictionary<(string,bool), FormattedText> _cache; int _max_order_size = 1; double _height = 0; double _number_width = 0; @@ -60,17 +60,17 @@ namespace mbts.spark { Enumerable.Range(1, 1+(int)default_query.Limit) .AsParallel() .Select(i => TextUtils.GetFormattedText(i.ToString(), font_size)) - .ToDictionary(ft => ft.Text); + .ToDictionary(ft => (ft.Text,false)); } FormattedText format_text(string s, bool bold=false) { // cache FormattedText for the life of the popup - if (_cache.TryGetValue(s, out FormattedText ft)) { + var key = (s, bold); + if (_cache.TryGetValue(key, out FormattedText ft)) { return ft; } - else ft = bold ? TextUtils.GetFormattedTextBold(s, font_size) : TextUtils.GetFormattedText(s, font_size); - _cache.TryAdd(s, ft); + _cache.TryAdd(key, ft); return ft; } @@ -98,6 +98,8 @@ namespace mbts.spark { } } + public static bool ismine(OrderPositionImmutable op) => op.OrderId != 0; + public MBOPopupDrawParams compute_layout(MBOPopupData p) { var pdp = new MBOPopupDrawParams { data = p }; pdp.header = format_text( @@ -106,9 +108,9 @@ namespace mbts.spark { var margin = MBOPopupDrawParams.margin; var text_margin = margin.Left + margin.Right; - pdp.row_numbers = p.orders.Select((o, i) => format_text((i+1).ToString())).ToList(); + pdp.row_numbers = p.orders.Select((o, i) => format_text((i+1).ToString(), ismine(o))).ToList(); pdp.numbers_width = _number_width = Math.Max(_number_width, (int)pdp.row_numbers.Max(r => r.Width) + text_margin); - pdp.row_labels = p.orders.Select(o => format_text(o.Size.ToString())).ToList(); + pdp.row_labels = p.orders.Select(o => format_text(o.Size.ToString(), ismine(o))).ToList(); var max_label_width = pdp.row_labels.Max(l => l.Width) + text_margin; var available_width = pdp.width - pdp.numbers_width - max_label_width; diff --git a/src/client/spark/view/Spark/Ladder/MBO/MBOPopupView.cs b/src/client/spark/view/Spark/Ladder/MBO/MBOPopupView.cs index 34d3b94a4..3e5a5e219 100644 --- a/src/client/spark/view/Spark/Ladder/MBO/MBOPopupView.cs +++ b/src/client/spark/view/Spark/Ladder/MBO/MBOPopupView.cs @@ -57,7 +57,7 @@ namespace mbts.spark { } static Brush brush_for(Side side, OrderPositionImmutable order) { - if (order.OrderId != 0) return Brushes.Black; + if (MBOPopupModel.ismine(order)) return Brushes.Black; switch (side) { case Side.Buy: return BTSColors.MarketData.bid_brush; case Side.Sell: return BTSColors.MarketData.ask_brush; From d54e9233d188e45a778cf851a4f8f86d7678e878 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Tue, 4 Jun 2019 09:12:11 -0400 Subject: [PATCH 4/6] Improved comment. --- src/sdk/examples/order_plugin_example.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sdk/examples/order_plugin_example.cpp b/src/sdk/examples/order_plugin_example.cpp index 82747faea..69a715c5c 100644 --- a/src/sdk/examples/order_plugin_example.cpp +++ b/src/sdk/examples/order_plugin_example.cpp @@ -304,11 +304,12 @@ void DynamicJoin::on_child_change(OrderKey, ChildState const &st) { } } +// This is called by the spark daemon at startup. In this call we +// describe our algo's parameters and register a factory function to +// create an instance of the algo. extern "C" void init_spark_plugin(bts::SparkServices &serv) { using namespace bts; - // Describe our new algo order so that Spark can generate a GUI for - // it. DynamicOrderDescriptor join_desc; // Start by naming our order type From 3478d1ad52647c105dbf9290312d5a3915199210 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Tue, 4 Jun 2019 09:14:10 -0400 Subject: [PATCH 5/6] Updated release notes. --- doc/user/content/release_notes/_index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/user/content/release_notes/_index.md b/doc/user/content/release_notes/_index.md index b0d852eb4..df776801c 100644 --- a/doc/user/content/release_notes/_index.md +++ b/doc/user/content/release_notes/_index.md @@ -4,6 +4,10 @@ weight = 3 sort_by = "weight" insert_anchor_links = "right" +++ +## 2.1.4 +### User Visible Changes + - Fixed handling of cancel button in security picker + ## 2.1.3 ### User Visible Changes - Fixed a simulator bug in the handling of 0 sized orders From 3e5eb80a7c22a9edf9cdfef464d298dcf1a71fb5 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Tue, 4 Jun 2019 09:57:59 -0400 Subject: [PATCH 6/6] Updated release notes --- doc/user/content/release_notes/_index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/user/content/release_notes/_index.md b/doc/user/content/release_notes/_index.md index df776801c..516dc7957 100644 --- a/doc/user/content/release_notes/_index.md +++ b/doc/user/content/release_notes/_index.md @@ -4,6 +4,10 @@ weight = 3 sort_by = "weight" insert_anchor_links = "right" +++ +## 2.2.0 +### User Visible Changes + - Made our orders easier to spot in MBO display + ## 2.1.4 ### User Visible Changes - Fixed handling of cancel button in security picker