From dd6b415ce77e7e7ba71cb1ebfc6dd087da9e6eb9 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Tue, 5 Feb 2019 11:06:55 -0600 Subject: [PATCH 01/17] remove trade key column from Time and Sales --- .../spark/Modules/Market/TimeAndSales/TimeAndSalesVM.cs | 7 +------ .../Modules/Market/TimeAndSales/TimeAndSalesView.xaml.cs | 2 +- .../spark/Modules/Market/TimeAndSalesWindowFactory.cs | 6 ++---- .../spark/view/Controls/DIYGrid/Columns/ColumnBase.cs | 2 -- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesVM.cs b/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesVM.cs index b95459cc6..d566f7441 100644 --- a/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesVM.cs +++ b/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesVM.cs @@ -38,7 +38,6 @@ namespace mbts.spark { price_filter.load_state(filters.price); size_filter.load_state(filters.size); aggressor_filter.load_state(filters.aggressor_sides); - trade_key_filter.load_state(filters.trade_key); security_key_filter.load_state(filters.security_key); } // Columns @@ -47,7 +46,6 @@ namespace mbts.spark { add_column(TimeAndSalesView.Columns.Price, DefaultColumnHeaders.Price, DefaultColumnWidths.Price, nameof(Row.price), price_filter, DataGridFilterKnownTemplates.DoubleMinMax, System.Windows.HorizontalAlignment.Right); add_column(TimeAndSalesView.Columns.Size, DefaultColumnHeaders.Size, DefaultColumnWidths.Size, nameof(Row.size), size_filter, DataGridFilterKnownTemplates.UIntMinMax, System.Windows.HorizontalAlignment.Right); add_column(TimeAndSalesView.Columns.Aggressor, DefaultColumnHeaders.Aggressor, DefaultColumnWidths.Aggressor, nameof(Row.aggressor_side), aggressor_filter, DataGridFilterKnownTemplates.EnumValues); - add_column(TimeAndSalesView.Columns.TradeKey, DefaultColumnHeaders.TradeKey, DefaultColumnWidths.TradeKey, nameof(Row.trade_key), trade_key_filter, DataGridFilterKnownTemplates.Regex); add_column(TimeAndSalesView.Columns.SecurityKey, DefaultColumnHeaders.SecurityKey, DefaultColumnWidths.SecurityKey, nameof(Row.security_key), security_key_filter, DataGridFilterKnownTemplates.Regex); void add_column(TimeAndSalesView.Columns col_key, string header, double width, string sort_member_path, IDataGridColumnFilter filter, string filter_template, System.Windows.HorizontalAlignment h_alignment = System.Windows.HorizontalAlignment.Left) => columns.Add(new TimeAndSalesColumn( @@ -66,7 +64,7 @@ namespace mbts.spark { _resources.AddRange( show_ladder, DataGridFilterHelper.hook_filters( - rows_view, time_filter, security_filter, price_filter, size_filter, aggressor_filter, trade_key_filter, security_key_filter), + rows_view, time_filter, security_filter, price_filter, size_filter, aggressor_filter, security_key_filter), settings_manager.subscribe_current().OnDispatcher().Subscribe(grid_settings_manager) ); rows_view.set_sort_descriptions(startup_data.sorting_criterion, columns); @@ -103,7 +101,6 @@ namespace mbts.spark { public IDataGridColumnPersistentFilter size_filter { get; } = new UIntMinMax(r => r.size, nameof(Row.size)); public IDataGridColumnPersistentFilter aggressor_filter { get; } = DiscreteValuesFilterVM.Create(EnumHelper.get_values().ToArray(), r => r.aggressor_side, nameof(Row.aggressor_side)); public IDataGridColumnPersistentFilter security_key_filter { get; } = new RegexFilterVM(r => r.security_key.ToString(), nameof(Row.security_key)); - public IDataGridColumnPersistentFilter trade_key_filter { get; } = new RegexFilterVM(r => r.trade_key.ToString(), nameof(Row.trade_key)); FilterStates _get_filter_states() => new FilterStates { @@ -111,7 +108,6 @@ namespace mbts.spark { security = security_filter.get_state(), price = price_filter.get_state(), size = size_filter.get_state(), - trade_key = trade_key_filter.get_state(), security_key = security_key_filter.get_state(), aggressor_sides = aggressor_filter.get_state() }; @@ -175,7 +171,6 @@ namespace mbts.spark { case TimeAndSalesView.Columns.Price: return _price_text; case TimeAndSalesView.Columns.Size: return _size_text; case TimeAndSalesView.Columns.Aggressor: return _aggressor_text; - case TimeAndSalesView.Columns.TradeKey: return _trade_key_text; case TimeAndSalesView.Columns.SecurityKey: return _security_key_text; default: return null; } diff --git a/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesView.xaml.cs b/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesView.xaml.cs index fff762c5c..ab066f2dd 100644 --- a/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesView.xaml.cs +++ b/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesView.xaml.cs @@ -7,7 +7,7 @@ namespace mbts.ui.spark { /// Interaction logic for TimeAndSalesView.xaml /// partial class TimeAndSalesView : UserControl { - public enum Columns { Time, Security, Price, Size, OrderType, TradeKey, SecurityKey, Aggressor } + public enum Columns { Time, Security, Price, Size, OrderType, SecurityKey, Aggressor } public TimeAndSalesView() => InitializeComponent(); diff --git a/src/client/spark/Modules/Market/TimeAndSalesWindowFactory.cs b/src/client/spark/Modules/Market/TimeAndSalesWindowFactory.cs index 16b1ba341..a5719bdbc 100644 --- a/src/client/spark/Modules/Market/TimeAndSalesWindowFactory.cs +++ b/src/client/spark/Modules/Market/TimeAndSalesWindowFactory.cs @@ -84,7 +84,6 @@ namespace bts.shell { public static GridColumnSettings price => new GridColumnSettings(col_id(Columns.Price), DefaultColumnHeaders.Price, width: DefaultColumnWidths.Price, horizontal_alignment: System.Windows.HorizontalAlignment.Right); public static GridColumnSettings size => new GridColumnSettings(col_id(Columns.Size), DefaultColumnHeaders.Size, width: DefaultColumnWidths.Size, horizontal_alignment: System.Windows.HorizontalAlignment.Right); public static GridColumnSettings aggressor => new GridColumnSettings(col_id(Columns.Aggressor), DefaultColumnHeaders.Aggressor, width: DefaultColumnWidths.Aggressor); - public static GridColumnSettings trade_key => new GridColumnSettings(col_id(Columns.TradeKey), DefaultColumnHeaders.TradeKey, width: DefaultColumnWidths.TradeKey); public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, width: DefaultColumnWidths.SecurityKey); public static IEnumerable default_sorting_criterion { @@ -100,7 +99,6 @@ namespace bts.shell { yield return price; yield return size; yield return aggressor; - yield return trade_key; yield return security_key; } } @@ -117,8 +115,8 @@ namespace bts.shell { public DoubleMinMaxState price; [ProtoMember(4)] public UIntMinMaxState size; - [ProtoMember(5)] - public string trade_key; + // [ProtoMember(5)] + // ProtoMember 5 cannot be used further [ProtoMember(6)] public string security_key; [ProtoMember(7)] diff --git a/src/client/spark/view/Controls/DIYGrid/Columns/ColumnBase.cs b/src/client/spark/view/Controls/DIYGrid/Columns/ColumnBase.cs index 02ff43b49..336861a5c 100644 --- a/src/client/spark/view/Controls/DIYGrid/Columns/ColumnBase.cs +++ b/src/client/spark/view/Controls/DIYGrid/Columns/ColumnBase.cs @@ -36,7 +36,6 @@ namespace mbts.ui.controls { Symbol = 78, Time = 112, TimeInForce = 47, - TradeKey = 76, User = 53, Aggressor = 80, Volume = 74, @@ -71,7 +70,6 @@ namespace mbts.ui.controls { ImpliedSize = "Qty (I)", Symbol = "Symbol", TimeInForce = "TIF", - TradeKey = "Trade Key", User = "User", Time = "Time", Aggressor = "Aggressor", From 5b40b4b4ca60d205c89676143757d09443e213a4 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Tue, 5 Feb 2019 11:14:40 -0600 Subject: [PATCH 02/17] Hiding Security Key column in default settings in all grids --- .../spark/Modules/Market/MarketView/MarketViewWindowFactory.cs | 2 +- src/client/spark/Modules/Market/TimeAndSalesWindowFactory.cs | 2 +- .../spark/Modules/Spreader/SyntheticManagementWindowFactory.cs | 2 +- src/client/spark/Modules/Trading/Fills/FillsWindowFactory.cs | 2 +- .../spark/Modules/Trading/OrderBook/OrderBookWindowFactory.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs b/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs index a5d80795c..44759c0c5 100644 --- a/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs +++ b/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs @@ -96,7 +96,7 @@ namespace bts.shell { public static GridColumnSettings day_change => new GridColumnSettings(col_id(Columns.DayChange), DefaultColumnHeaders.DayChange, width: DefaultColumnWidths.Price, horizontal_alignment: System.Windows.HorizontalAlignment.Right); public static GridColumnSettings session_low => new GridColumnSettings(col_id(Columns.SessionLow), DefaultColumnHeaders.SessionLow, width: DefaultColumnWidths.Price, horizontal_alignment: System.Windows.HorizontalAlignment.Right); public static GridColumnSettings session_high => new GridColumnSettings(col_id(Columns.SessionHigh), DefaultColumnHeaders.SessionHigh, width: DefaultColumnWidths.Price, horizontal_alignment: System.Windows.HorizontalAlignment.Right); - public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, width: DefaultColumnWidths.SecurityKey); + public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, is_visible: false, width: DefaultColumnWidths.SecurityKey); diff --git a/src/client/spark/Modules/Market/TimeAndSalesWindowFactory.cs b/src/client/spark/Modules/Market/TimeAndSalesWindowFactory.cs index a5719bdbc..efb01ab83 100644 --- a/src/client/spark/Modules/Market/TimeAndSalesWindowFactory.cs +++ b/src/client/spark/Modules/Market/TimeAndSalesWindowFactory.cs @@ -84,7 +84,7 @@ namespace bts.shell { public static GridColumnSettings price => new GridColumnSettings(col_id(Columns.Price), DefaultColumnHeaders.Price, width: DefaultColumnWidths.Price, horizontal_alignment: System.Windows.HorizontalAlignment.Right); public static GridColumnSettings size => new GridColumnSettings(col_id(Columns.Size), DefaultColumnHeaders.Size, width: DefaultColumnWidths.Size, horizontal_alignment: System.Windows.HorizontalAlignment.Right); public static GridColumnSettings aggressor => new GridColumnSettings(col_id(Columns.Aggressor), DefaultColumnHeaders.Aggressor, width: DefaultColumnWidths.Aggressor); - public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, width: DefaultColumnWidths.SecurityKey); + public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, is_visible:false, width: DefaultColumnWidths.SecurityKey); public static IEnumerable default_sorting_criterion { get { diff --git a/src/client/spark/Modules/Spreader/SyntheticManagementWindowFactory.cs b/src/client/spark/Modules/Spreader/SyntheticManagementWindowFactory.cs index afb327aa7..e676dd306 100644 --- a/src/client/spark/Modules/Spreader/SyntheticManagementWindowFactory.cs +++ b/src/client/spark/Modules/Spreader/SyntheticManagementWindowFactory.cs @@ -66,7 +66,7 @@ namespace bts.shell { public static GridColumnSettings description => new GridColumnSettings(col_id(Columns.Description), DefaultColumnHeaders.Description, width: DefaultColumnWidths.Description); public static GridColumnSettings n_legs => new GridColumnSettings(col_id(Columns.n_legs), DefaultColumnHeaders.N_Legs, width: DefaultColumnWidths.N_Legs); public static GridColumnSettings n_working_orders => new GridColumnSettings(col_id(Columns.n_working_orders), DefaultColumnHeaders.N_Working_Orders, width: DefaultColumnWidths.N_Working_Orders); - public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, width: DefaultColumnWidths.SecurityKey); + public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, is_visible: false, width: DefaultColumnWidths.SecurityKey); public static IEnumerable default_sorting_criterion { get { diff --git a/src/client/spark/Modules/Trading/Fills/FillsWindowFactory.cs b/src/client/spark/Modules/Trading/Fills/FillsWindowFactory.cs index b4e789c2b..69c9df1dc 100644 --- a/src/client/spark/Modules/Trading/Fills/FillsWindowFactory.cs +++ b/src/client/spark/Modules/Trading/Fills/FillsWindowFactory.cs @@ -86,7 +86,7 @@ namespace bts.shell { public static GridColumnSettings fill_kind => new GridColumnSettings(col_id(Columns.FillKind), DefaultColumnHeaders.FillKind, width: DefaultColumnWidths.FillKind); public static GridColumnSettings fill_key => new GridColumnSettings(col_id(Columns.FillKey), DefaultColumnHeaders.FillKey, width: DefaultColumnWidths.FillKey); public static GridColumnSettings order_key => new GridColumnSettings(col_id(Columns.OrderKey), DefaultColumnHeaders.OrderKey, width: DefaultColumnWidths.OrderKey); - public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, width: DefaultColumnWidths.SecurityKey); + public static GridColumnSettings security_key => new GridColumnSettings(col_id(Columns.SecurityKey), DefaultColumnHeaders.SecurityKey, is_visible: false, width: DefaultColumnWidths.SecurityKey); public static IEnumerable default_sorting_criterion { get { yield return new SortingCriteria(fill_time.id, false); diff --git a/src/client/spark/Modules/Trading/OrderBook/OrderBookWindowFactory.cs b/src/client/spark/Modules/Trading/OrderBook/OrderBookWindowFactory.cs index 5912ac397..0733cb42b 100644 --- a/src/client/spark/Modules/Trading/OrderBook/OrderBookWindowFactory.cs +++ b/src/client/spark/Modules/Trading/OrderBook/OrderBookWindowFactory.cs @@ -112,7 +112,7 @@ namespace bts.shell { public static GridColumnSettings last_price => new GridColumnSettings(Columns.LastPrice.ToString(), "Last Filled", width: DIYGrid.DefaultColumnWidths.LastPrice, horizontal_alignment: HorizontalAlignment.Right); public static GridColumnSettings status => new GridColumnSettings(Columns.Status.ToString(), "Status", width: 80); public static GridColumnSettings last_message => new GridColumnSettings(Columns.LastMessage.ToString(), "Last Message", width: DIYGrid.DefaultColumnWidths.LastMessage); - public static GridColumnSettings security_key => new GridColumnSettings(Columns.SecurityKey.ToString(), DIYGrid.DefaultColumnHeaders.SecurityKey, width: DIYGrid.DefaultColumnWidths.SecurityKey); + public static GridColumnSettings security_key => new GridColumnSettings(Columns.SecurityKey.ToString(), DIYGrid.DefaultColumnHeaders.SecurityKey, is_visible: false, width: DIYGrid.DefaultColumnWidths.SecurityKey); public static GridColumnSettings order_key => new GridColumnSettings(Columns.OrderKey.ToString(), DIYGrid.DefaultColumnHeaders.OrderKey, width: DIYGrid.DefaultColumnWidths.OrderKey); public static GridColumnSettings parent_key => new GridColumnSettings(Columns.ParentKey.ToString(), "Parent Key", width: DIYGrid.DefaultColumnWidths.ParentKey); From 1864c27584759e3af163c0a130ea49c03bf43437 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Tue, 5 Feb 2019 14:35:10 -0600 Subject: [PATCH 03/17] Anything that used to hit get_cme_gen_open now hits get_start_of_trading_day --- .../spark/core/data/Proto/DateTimeProvider.cs | 2 +- .../DataGridEx/Filters/VM/TimeFilterVM.cs | 2 +- .../spark/view/Spark/PAndL/PnLCalculator.cs | 42 +++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/client/spark/core/data/Proto/DateTimeProvider.cs b/src/client/spark/core/data/Proto/DateTimeProvider.cs index 8224670bb..e0df81f72 100644 --- a/src/client/spark/core/data/Proto/DateTimeProvider.cs +++ b/src/client/spark/core/data/Proto/DateTimeProvider.cs @@ -51,7 +51,7 @@ namespace bts.proto { static class DateTimeProviderExtensions { public static DateTime get_date_time(this DateTimeProvider dtp) { switch (dtp.mode) { - case DateTimeProviderMode.CMEOpen: return MarketSchedule.get_cme_gen_open(); + case DateTimeProviderMode.CMEOpen: return MarketSchedule.get_start_of_trading_day(); case DateTimeProviderMode.Today: return DateTime.Today; case DateTimeProviderMode.Explicit: default: return dtp.explicit_date.GetValueOrDefault(); diff --git a/src/client/spark/view/Controls/DataGridEx/Filters/VM/TimeFilterVM.cs b/src/client/spark/view/Controls/DataGridEx/Filters/VM/TimeFilterVM.cs index c89353f5a..da48d458d 100644 --- a/src/client/spark/view/Controls/DataGridEx/Filters/VM/TimeFilterVM.cs +++ b/src/client/spark/view/Controls/DataGridEx/Filters/VM/TimeFilterVM.cs @@ -14,7 +14,7 @@ namespace mbts.spark.filters { TimeFilterMode _mode; TimeTextTuple _begin, _end; DateTime? _begin_dt, _end_dt; - readonly DateTime _cme_open = MarketSchedule.get_cme_gen_open(); + readonly DateTime _cme_open = MarketSchedule.get_start_of_trading_day(); public TimeFilterVM(Func get_row_val, string prop_name) : base(get_row_val, prop_name) => _set_default_values(); diff --git a/src/client/spark/view/Spark/PAndL/PnLCalculator.cs b/src/client/spark/view/Spark/PAndL/PnLCalculator.cs index 58c41f9ba..f0fb40328 100644 --- a/src/client/spark/view/Spark/PAndL/PnLCalculator.cs +++ b/src/client/spark/view/Spark/PAndL/PnLCalculator.cs @@ -28,31 +28,10 @@ namespace mbts.spark { static readonly int sod_hh = (int)config.Configuration.get().sod_hh; static readonly int sod_mm = (int)config.Configuration.get().sod_mm; static readonly TimeZoneInfo central_tzi = TimeZoneInfo.FindSystemTimeZoneById(cst_id); - static readonly DateTime _start_of_trading_day_utc; - static readonly DateTime _adjusted_central_sod; - - - static readonly DateTime unadjusted_central_sod = TimeZoneInfo.ConvertTimeFromUtc( - DateTime.UtcNow.Date.Add(new TimeSpan(sod_hh, sod_mm, 0)), - central_tzi - ); static MarketSchedule() { var cme_schedule = config.Configuration.get(); _cme_gen_open_hrs = cme_schedule?.gen_open_hour ?? 8.5; - - _adjusted_central_sod = !central_tzi.IsDaylightSavingTime(unadjusted_central_sod) ? unadjusted_central_sod.AddHours(1) : unadjusted_central_sod; - - // Note that this isn't the acutal start of the trading day - // but it's close enough for pnl purposes. - // In reality, instruments have different schedules - - // if now is less than the current sod, then we me move the sod back a day to account for the trading day start - if (_adjusted_central_sod >= TimeZoneInfo.ConvertTime(DateTime.Now, central_tzi)) { - _adjusted_central_sod = _adjusted_central_sod.AddDays(-1); - } - var local_time_zone_sod = TimeZoneInfo.ConvertTime(_adjusted_central_sod, central_tzi, TimeZoneInfo.Local); - _start_of_trading_day_utc = local_time_zone_sod.ToUniversalTime(); } // for object initializers public MarketSchedule() { } @@ -73,6 +52,27 @@ namespace mbts.spark { return last_open; } + // DateTime? used here b/c we can't set a default parameter with DateTime.Now + // since it's now + public static DateTime get_start_of_trading_day(DateTime? target_datetime = null, DateTimeKind dtk = DateTimeKind.Local ) { + if (target_datetime == null) target_datetime = DateTime.Now; + var dst_adjusted_central_sod = new DateTimeOffset( + new DateTime(target_datetime.Value.Date.Add(new TimeSpan(sod_hh, sod_mm, 0)).Ticks, DateTimeKind.Unspecified), + central_tzi.BaseUtcOffset + ); + + // if we're not currently past the start of the trading day, then the start must be yesterday + var temp = dst_adjusted_central_sod; + if (temp >= TimeZoneInfo.ConvertTime(target_datetime.Value, central_tzi)) { + temp = dst_adjusted_central_sod.AddDays(-1); + } + var local_time_zone_sod = TimeZoneInfo.ConvertTime(temp.DateTime, central_tzi, TimeZoneInfo.Local); + if (dtk == DateTimeKind.Utc) { + return local_time_zone_sod.ToUniversalTime(); + } + return local_time_zone_sod; + } + public static DateTime get_utctimestamp_as_localtime(string s) { return DateTimeOffset.ParseExact(s, "yyyyMMddHHmmssffffff", null, System.Globalization.DateTimeStyles.AssumeUniversal).ToLocalTime().LocalDateTime; } From fb059e557190a897b0b955f39dfcdcb628898154 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Tue, 5 Feb 2019 14:36:51 -0600 Subject: [PATCH 04/17] refine comment --- src/client/spark/view/Spark/PAndL/PnLCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/spark/view/Spark/PAndL/PnLCalculator.cs b/src/client/spark/view/Spark/PAndL/PnLCalculator.cs index f0fb40328..0966c538d 100644 --- a/src/client/spark/view/Spark/PAndL/PnLCalculator.cs +++ b/src/client/spark/view/Spark/PAndL/PnLCalculator.cs @@ -53,7 +53,7 @@ namespace mbts.spark { } // DateTime? used here b/c we can't set a default parameter with DateTime.Now - // since it's now + // since it's not a compile-time constant public static DateTime get_start_of_trading_day(DateTime? target_datetime = null, DateTimeKind dtk = DateTimeKind.Local ) { if (target_datetime == null) target_datetime = DateTime.Now; var dst_adjusted_central_sod = new DateTimeOffset( From 00ce3adde533459487f1779863ae6aec0a38aa14 Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Wed, 6 Feb 2019 13:10:18 -0500 Subject: [PATCH 05/17] Add ApiThreading man page (draft) --- doc/user/docs/ApiThreading.md | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 doc/user/docs/ApiThreading.md diff --git a/doc/user/docs/ApiThreading.md b/doc/user/docs/ApiThreading.md new file mode 100644 index 000000000..9b8b05a33 --- /dev/null +++ b/doc/user/docs/ApiThreading.md @@ -0,0 +1,74 @@ + +# API Threading + +BTS API provides two types of calls. There are RPC (remote procedure calls) which accept an argument and return a value and there are streams of tabular data which we call subscriptions. All communication to and from the server happens on a connection thread owned by the ServiceContext object and data must be marshaled back to the right context when the call is complete. + +## RPC + +### C# + +All API calls provide both a synchronous and [asynconous](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/async) version. If you are calling the API from a WPF or Windows Forms application you should always prefer the async version of the method because it will efficiently make the call and resume execution on the correct thread without blocking or lagging user interactions. The syncronous calls are intended for use in console applications where nothing else needs use of the thread until the data is available. + +The async version of the method will return a `Result` type which is used to signal if an error occurred during the call. You should test the Result.success to see if the call succeeded before using Result.value. + +```csharp + var s = context.locate(); + var result = await s.get_users_async(new GetUsersRequest()); + if (result.success) { + Console.WriteLine(result.value); + } + else { + Console.WriteLine($"Error {result.error_message}"); + } +``` + +### C++ + +All C++ API calls also provide both a blocking synchronous version and a callback based asynchronous version. In the asynchronous case the callback will execute on the ServiceContext thread and you will need to handle marshaling that data to the appropriate thread. Just like in c# the callback will receive a `Result` which will indicate success or failure. `Result.value` returns an `std::shared_ptr` so you have control over the lifetime of the value. + +## Subscriptions + +BTS provides streaming updates for some types of data. These updates are incremental in nature and will provide a snapshot of the current state on a new subscription. Streaming updates use the [ReactiveX library](http://reactivex.io) to manage subscribing and unsubscribing. This library provides a rich set of operators that you can use to slide and dice the data streams based on your specific application requirements. + +### C# + +The subscription callback will arrive on the ServiceContext thread but it can be easily marshaled to the thread of your choice using the [ObserveOn](http://reactivex.io/documentation/operators/observeon.html) operator. For a WPF or Windows Forms application the most common use of this will be [ObserveOnDispatcher]() which will simply execute the callback in the context of the original calling thread. By your choice of where to place the `ObserveOnDispatcher` call in your reactive call chain you can choose whether other operators execute before after switching threads. + +In this example the `Where` and `SelectMany` operators will execute on `ServiceContext` connection thread and only the resulting matches will be marshaled across to the calling thread. It is safe to unsubscribe by disposing `sub` from any thread. + +```csharp + var orders = context.locate(); + ObservableCollection orders_with_errors; + IDisposable sub = + orders + .subscribe_orders() + .SelectMany(update => update.added) + .Where(o => o.State.Status == OrderStatus.Error) + .ObserveOnDispatcher() + .Subscribe(o => { + orders_with_errors.Add(o); + }); +``` + +### C++ + +The C++ subscription callbacks use the [RxCpp](https://github.com/ReactiveX/RxCpp) library which implements the [ReactiveX](http://reactivex.io) operators. The subscribe call will return an `rxcpp::composite_subscription` which implements [RAII](https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization) and will unsubscribe when it is destroyed. + +```cpp +#include "lib/api/public/ServiceContext.h" +#include "lib/api/services/OrderService.client.pb.h" +#include +#include +//... +bts::api::ServiceContext ctx; +auto client = ctx.locate(); +auto sub = + client.subscribe_orders().subscribe([=](const bts::api::orderman::OrdersUpdate& update) { + std::string result; + for(const auto& order : update.added()) { + auto status = google::protobuf::util::MessageToJsonString(*order, &result, {}); + std::cout << "New order: " << result << std::endl; + } + }); + +``` \ No newline at end of file From a7d71fe17055a286d66f2cdcd04d6d2c3df9c0a5 Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Wed, 6 Feb 2019 14:31:04 -0500 Subject: [PATCH 06/17] Move ApiThreading doc --- doc/{user/docs => sdk}/ApiThreading.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{user/docs => sdk}/ApiThreading.md (100%) diff --git a/doc/user/docs/ApiThreading.md b/doc/sdk/ApiThreading.md similarity index 100% rename from doc/user/docs/ApiThreading.md rename to doc/sdk/ApiThreading.md From 03fe75cfd2f1391b66451453a4e1aa997e3d9165 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Wed, 6 Feb 2019 13:38:40 -0600 Subject: [PATCH 07/17] commit button now unselects row --- .../Modules/Trading/OrderBook/OrderBookRowVM.cs | 17 ++++++++++++++--- .../Modules/Trading/OrderBook/OrderBookVM.cs | 14 +++++++++++++- .../Trading/OrderBook/OrderBookWindow.cs | 2 -- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/client/spark/Modules/Trading/OrderBook/OrderBookRowVM.cs b/src/client/spark/Modules/Trading/OrderBook/OrderBookRowVM.cs index 76dc8341f..5323e629f 100644 --- a/src/client/spark/Modules/Trading/OrderBook/OrderBookRowVM.cs +++ b/src/client/spark/Modules/Trading/OrderBook/OrderBookRowVM.cs @@ -130,7 +130,10 @@ namespace mbts.spark { public ICommand modify_order_quantity => _modify_order_quantity ?? (_modify_order_quantity = new DelegateCommand( - (desired_quantity) => _owner.modify_order_quantity(this, (uint)desired_quantity), + (desired_quantity) => { + _owner.modify_order_quantity(this, (uint)desired_quantity); + _unselect_me(); + }, (desired_quantity) => (desired_quantity != null && this.status == OrderStatus.Working && (uint)desired_quantity != this.quantity) || is_qty_dirty @@ -139,12 +142,20 @@ namespace mbts.spark { public ICommand modify_order_price => _modify_order_price ?? (_modify_order_price = new DelegateCommand( - (desired_price) => _owner.modify_order_price(this, (double)desired_price), + (desired_price) => { + _owner.modify_order_price(this, (double)desired_price); + _unselect_me(); + }, (desired_price) => (desired_price != null && this.status == OrderStatus.Working && (double)desired_price != this.price) || is_price_dirty ) - ); + ); + + private void _unselect_me() { + this.is_selected = false; + _owner.current_row = null; + } // These fns present a way for the orderbook to avoid noisy, intermittent collection changes during "Expand/Collapse All" ops, // when incremental changes are ignored in favor of a full reset, after 'is_expanded' is updated for all rows. diff --git a/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs b/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs index b0fc0609d..5b2e9ec19 100644 --- a/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs +++ b/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs @@ -76,7 +76,19 @@ namespace mbts.spark { public ObservableAppendCollection columns { get; } public ObservableCollection core_columns => _columns; public ObservableCollection rows => _row_collection; - public OrderBookRowVM current_row { get => _current_row.Value; set => _current_row.Value = value ?? _selected_rows.FirstOrDefault(); } + public OrderBookRowVM current_row { + get => _current_row.Value; + set { + _current_row.Value = value; + // this is so that when the current_row is set to null from + // the row_vm, we propagate the change up to the OrderBookWindow + // so that the cancel and modify commands can_execute is updated. + // Note that this is really only for if/when the edit_xxx columns + // from the mini-ob are present in regular orderbook, else this is + // a no-op. + selected_order_changed?.Invoke(current_order); + } + } public OrderRecordImmutable? current_order => current_row?.order; public IEnumerable selected_orders => _selected_rows.Select(r => r.order); public _GridSettingsManager grid_settings_manager { get; } diff --git a/src/client/spark/Modules/Trading/OrderBook/OrderBookWindow.cs b/src/client/spark/Modules/Trading/OrderBook/OrderBookWindow.cs index 3c4c08060..3b62863a4 100644 --- a/src/client/spark/Modules/Trading/OrderBook/OrderBookWindow.cs +++ b/src/client/spark/Modules/Trading/OrderBook/OrderBookWindow.cs @@ -167,11 +167,9 @@ namespace mbts.spark { } private void _vm_selected_order_changed(OrderRecordImmutable? e) { - if (e.HasValue) { _modify_order_command.raiseCanExecuteChanged(); _cancel_selected_orders_command.raiseCanExecuteChanged(); _recreate_selected_orders_command.raiseCanExecuteChanged(); - } } } } From 99f1d1fa010d22f2a2220f2e647fc7995f9fd38d Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Wed, 6 Feb 2019 14:48:18 -0500 Subject: [PATCH 08/17] Review feedback --- doc/sdk/ApiThreading.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/sdk/ApiThreading.md b/doc/sdk/ApiThreading.md index 9b8b05a33..1ca91214b 100644 --- a/doc/sdk/ApiThreading.md +++ b/doc/sdk/ApiThreading.md @@ -1,5 +1,5 @@ -# API Threading +# API Client Threading BTS API provides two types of calls. There are RPC (remote procedure calls) which accept an argument and return a value and there are streams of tabular data which we call subscriptions. All communication to and from the server happens on a connection thread owned by the ServiceContext object and data must be marshaled back to the right context when the call is complete. @@ -7,7 +7,7 @@ BTS API provides two types of calls. There are RPC (remote procedure calls) whi ### C# -All API calls provide both a synchronous and [asynconous](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/async) version. If you are calling the API from a WPF or Windows Forms application you should always prefer the async version of the method because it will efficiently make the call and resume execution on the correct thread without blocking or lagging user interactions. The syncronous calls are intended for use in console applications where nothing else needs use of the thread until the data is available. +All API calls provide both a synchronous and [asynchronous](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/async) version. If you are calling the API from a WPF or Windows Forms application you should always prefer the async version of the method because it will efficiently make the call and resume execution on the correct thread without blocking or lagging user interactions. The synchronous calls are intended for use in console applications where nothing else needs use of the thread until the data is available. The async version of the method will return a `Result` type which is used to signal if an error occurred during the call. You should test the Result.success to see if the call succeeded before using Result.value. From 7b9071a1b23050e770a01bcd6911e441d83f01ed Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Wed, 6 Feb 2019 14:49:17 -0500 Subject: [PATCH 09/17] Review feedback 2 --- doc/sdk/ApiThreading.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/sdk/ApiThreading.md b/doc/sdk/ApiThreading.md index 1ca91214b..ab79e821d 100644 --- a/doc/sdk/ApiThreading.md +++ b/doc/sdk/ApiThreading.md @@ -1,5 +1,5 @@ -# API Client Threading +# Client API Threading BTS API provides two types of calls. There are RPC (remote procedure calls) which accept an argument and return a value and there are streams of tabular data which we call subscriptions. All communication to and from the server happens on a connection thread owned by the ServiceContext object and data must be marshaled back to the right context when the call is complete. From cff32ad09a8a59921934251dbdb897c44737a2d0 Mon Sep 17 00:00:00 2001 From: Kevin Darby Date: Wed, 6 Feb 2019 17:03:23 -0500 Subject: [PATCH 10/17] for now I'd like to keep these client and server docs separate since they are two repos --- src/client/spark_sdk/README.md | 44 +++++--- src/client/spark_sdk/doc/Overview.md | 103 ++++++++++++++++++ .../client/spark_sdk/doc/Threading.md | 0 src/client/spark_sdk/spark_sdk.csproj | 4 +- src/sdk/README.md | 33 ++++-- src/sdk/doc/algos.md | 40 +++++++ src/sdk/make_sdk.sh | 1 + 7 files changed, 202 insertions(+), 23 deletions(-) create mode 100644 src/client/spark_sdk/doc/Overview.md rename doc/sdk/ApiThreading.md => src/client/spark_sdk/doc/Threading.md (100%) create mode 100644 src/sdk/doc/algos.md diff --git a/src/client/spark_sdk/README.md b/src/client/spark_sdk/README.md index 49c539fa8..a5367bce8 100644 --- a/src/client/spark_sdk/README.md +++ b/src/client/spark_sdk/README.md @@ -1,8 +1,31 @@ +# BTS Spark + + +Our offering consists of a client UI [Spark Client](https://www.bluetradingsystems.com/images/Images/spark/02.06.19/Ladder.png), a high performance professional futures front end, connected via our proprietary protocol over TCP to our Spark Server, which in turn connects to execution venues via their native protocols (typically FIX/TCP for execution and some proprietary protocol over UDP multicast for market data). + +![alt text](https://www.bluetradingsystems.com/images/Images/api/API.png) + + # BTS Spark Client SDK -#### Getting Started +We currently offer two API extension points. This repository, our BTS **Spark Client SDK** allows users to control our Spark Server externally, that is, out of process, using the exact same protocol our own Spark Client does. In other words, a client application developed via the Spark Client SDK, say a VB .NET UI, would be able to provide any functionality our own UI provides. -## Git +We currently offer bindings for the Spark protocol to C++, C# and Excel clients. Since the underlying transport is TCP, clients developed via the Spark Client SDK can be located anywhere in the world, as long as they can reach the Spark Server via TCP. We do require a VPN or a secure network, since the Spark Protocol is currently not yet encrypted. + +Our second API extension point is intended for users that require adding functionality to our Spark Server. If you are interested in extending the server process through custom order types, market data sources, or execution gateways, please see the [Spark Server SDK](https://github.com/BlueTradingSystems/spark_sdk). + + +### In Depth + + * [Interface Overview](doc/Overview.md) + * [Threading Notes](doc/Threading.md) + + + + +## Getting Started + +### Git * First clone the spark_client_sdk repo @@ -11,7 +34,7 @@ ``` -## Build +### Build * Use msbuild to target windows / .net 4.71 * Install studio here if you don't have it: https://visualstudio.microsoft.com/downloads/ * Use VSCode for editing, it's better: https://code.visualstudio.com/ @@ -24,7 +47,7 @@ spark_client_sdk\src\spark_sdk> msbuild * spark_sdk binaries will be produced in the bin\Debug directory -## Connecting to Spark Server +### Connecting to Spark Server * Start your exe using the -ConfigServer parameter to point at a running Spark Server ``` @@ -35,7 +58,7 @@ spark_client_sdk\src\spark_sdk> msbuild include: "http://location:8000/config/" ``` - ## Examples +### Examples * Make sure you can connect to a running server * run spark_sdk.exe with no parameters to see help ``` @@ -58,22 +81,15 @@ Arguments: * [Driver](src/spark_sdk/samples/SDKMain.cs) - ## Excel + ### Excel ``` spark_sdk\bin\Debug\net471> start spark_excel-addin64-packed.xll ``` * This will start excel and load the bts addin * Check the [```excel```](excel/) directory for an example spreadsheet - -## Notes -* Our client side API is based on Google's protocol buffers; the message types are all protos. https://developers.google.com/protocol-buffers/ - -* We extended the protoc compiler to generate c#, c++, excel and js bindings to the services provided by our server process (https://github.com/BlueTradingSystems/spark_sdk) - - -* ### Dotnet core +### Dotnet core * Right now we only support c# Windows 10 clients, but the package targets both net471 and .net core 2.1.6, so in theory one could run a .net core or c++ client on linux with a little work. diff --git a/src/client/spark_sdk/doc/Overview.md b/src/client/spark_sdk/doc/Overview.md new file mode 100644 index 000000000..6514552a8 --- /dev/null +++ b/src/client/spark_sdk/doc/Overview.md @@ -0,0 +1,103 @@ + +## Spark Client SDK Overview + +The high level description of our order entry interface is as follows: + +``` +service OrderService { + // RPCs + rpc create_order(Create) returns (Response) + rpc cancel_order(Cancel) returns (Response) + rpc update_order(Update) returns (Response) + // Streams + rpc orders (OrdersSub) returns (stream OrderRecord); + rpc fills (FillsSub) returns (stream Fill); +} +``` + +This description uses the Google Protocol Buffers syntax to define the server interface (we use our own little compiler to generate bindings to this interface in C#, C++ and Excel). Using this server interface we can create, cancel or update orders, using the Remote Procedure Calls (RPCs) defined these orders can be exchange native orders or our own high level algo orders, or new order types created by users via the Spark Server SDK). We can monitor order state by subscribing to the orders stream above, which produces a a stream of OrderRecord objects, each capturing the latest state of a particular order, as it goes through it life cycle. + +An OrderRecord looks like this: + +``` +message OrderRecord { + uint32 key; + uint32 parent_key; + OrderDefinition def; + OrderState state; +} +``` + +We have an order key, a possibly null parent order key, an OrderDefinition record, which defines the basic elements of the order, namely its type, side, security, account, etc, and an OrderState record, which captures the latest state of the order: + +``` +message OrderState { + // Standard order state, shared by all order types + OrderStatus status ; + double price ; + uint32 quantity ; + uint32 filled_quantity; + double last_price; + double avg_price; + string last_msg; + google.protobuf.Timestamp created; + google.protobuf.Timestamp last_change; + // Custom order state, specific to the order type in question + oneof custom { + // native order types + MarketOrderState market; + LimitOrderState limit; + StopOrderState stop; + StopLimitOrderState stop_limit; + // algo order types + IcebergOrderState iceberg; + SpreaderOrderState spreader; + TimeBoxOrderState time_box; + TickOrderState tick; + LeanOrderState lean; + JoinOrderState join; + TopOrderState top;evident + TriggerOrderState trigger; + CoverOrderState cover; + OffsetOrderState offset; + DynamicOrderState dynamic; + } +} +``` + +This OrderState record consists of a common part, applicable to all order types, and a custom part that is specific to the particular order type the record is associated with. Most of the standard fields should be self-explanatory, the latest price, the latest quantity, the filled quantity, etc. The status enumerate field tells you which state the order is in. We currently define the following states: + +``` +enum OrderStatus { + // The order has been constructed but not acted on. Inactive orders + // can be abandoned without consequences. This state should only be + // used internally by the order manager, i.e. it should never appear + // in externally visible orders. + ORDER_STATUS_INACTIVE = 0; + // The order is currently working, i.e. its algorithm is operating. + ORDER_STATUS_WORKING = 1; + // The order has completed successfully and accomplished its + // goal. This is a terminal state. + ORDER_STATUS_COMPLETED = 2; + // The order was terminated orderly before it had a chance to + // complete. This is a terminal state. + ORDER_STATUS_CANCELED = 3; + // The order has encountered an unexpected condition from which it + // cannot recover. This a terminal state. + ORDER_STATUS_ERROR = 4; + // The last known state for this order was ORDER_STATUS_WORKING, but + // since then the execution gateway has signaled a disconnect. This + // is not a terminal state. + ORDER_STATUS_DISCONNECTED = 5; + // The order is initializiYou can ng. It cannot be modified at this + point. + ORDER_STATUS_PENDING_WORKING = 6; + // The order is invalid and was rejected by Spark (not the + // exchange), on creation. This is a terminal state. + ORDER_STATUS_REJECTED_BY_SPARK= 7; +} +``` + + +### Threading + Check out our API Threading Doc [here](Threading.md). \ No newline at end of file diff --git a/doc/sdk/ApiThreading.md b/src/client/spark_sdk/doc/Threading.md similarity index 100% rename from doc/sdk/ApiThreading.md rename to src/client/spark_sdk/doc/Threading.md diff --git a/src/client/spark_sdk/spark_sdk.csproj b/src/client/spark_sdk/spark_sdk.csproj index 26ff14c6c..0579a5960 100644 --- a/src/client/spark_sdk/spark_sdk.csproj +++ b/src/client/spark_sdk/spark_sdk.csproj @@ -2,7 +2,8 @@ netcoreapp2.1;net471 Exe - true + + true $(OutputPath)\net471 true true @@ -61,6 +62,7 @@ + diff --git a/src/sdk/README.md b/src/sdk/README.md index d6fdaed69..51dbde907 100644 --- a/src/sdk/README.md +++ b/src/sdk/README.md @@ -1,8 +1,23 @@ -# BTS Spark SDK +# BTS Spark -#### Getting Started +Our offering consists of a client UI ([Spark Client](https://www.bluetradingsystems.com/bts-spark#ladder-algo-screen)), a high performance professional futures front end, connected via our proprietary protocol over TCP to our Spark Server, which in turn connects to execution venues via their native protocols (typically FIX/TCP for execution and some proprietary protocol over UDP multicast for market data). -## Docker +![alt text](https://www.bluetradingsystems.com/images/Images/api/API.png) + + +# BTS Spark Server SDK + +This API extension point is intended for users that require adding functionality to our Spark Server. Using the **Spark Server SDK** users can create [new order types](https://github.com/BlueTradingSystems/spark_sdk/blob/master/examples/order_plugin_example.cpp), [new market data sources](https://github.com/BlueTradingSystems/spark_sdk/blob/master/examples/md_publisher_example.cpp) and soon new execution gateways. In this case users implement the new functionality in C++, producing a shared library that is loaded at run time by our Spark Server. + +If you are interested in sending orders or otherwise controlling a spark server remotely please see the BTS [Spark Client SDK](https://github.com/BlueTradingSystems/spark_client_sdk) repo. + +### In Depth + + * [Spark Algo Descriptions](doc/algos.md) + +## Getting Started + +### Docker We use docker to provide a full dev environment with all the tools users need to develop their own algos. @@ -35,7 +50,7 @@ $ docker start --attach -i bts_sdk * If you prefer to run docker as a daemon, check out [``~/spark_sdk/sdk_shell.sh``](sdk_shell.sh) -## Git +### Git * We assume the git you are using is git-lfs compatible; if you're using the git that comes with our docker, you're all set. @@ -50,7 +65,7 @@ $ cd spark_sdk ``` -## Development +### Development Look at [examples/md_publisher_example.cpp](examples/md_publisher_example.cpp) to look at how to build a custom market data producer @@ -62,7 +77,7 @@ run ```build_examples.sh``` to make sure you can build the examples, this will p $ cd ~/spark_sdk/examples $ ./build_examples.sh ``` -### Server Layout +#### Server Layout * Spark servers reside on a port, usually 8000, but your production instance could be on a different $PORT ##### SDK Package Layout @@ -75,8 +90,10 @@ $ ./build_examples.sh * Production binaries are in ``/sparkbin`` inside the docker container * Production algo plugins should go into the ``/sparkbin/plugins`` directory -### Recorded market data -* If you want to see prices, before you start sparkd, you'll have to extract the futures.coconut.tar.gz found at the root of the sdk repo and place futures.coconut in ``~/sparkdata/data/replay/`` +#### Recorded market data +* We first check for http://mdreplay/spark/futures.coconut + +* Then fall back to ``./data_files/ relative to the sparkd binary`` ## Debugging diff --git a/src/sdk/doc/algos.md b/src/sdk/doc/algos.md new file mode 100644 index 000000000..1264b8de5 --- /dev/null +++ b/src/sdk/doc/algos.md @@ -0,0 +1,40 @@ +# BTS Basic Algos + +## Lean + +The goal of the lean order is to watch the opposite-inside market size and cross when that sizegoes below the threshold (this also implies a cross if that size goes to zero and the markettrades away from you)If the market trades toward you, you can opt into several different behaviors + +##### Parameters + * Cross Thresh - size thresh in absolute or ratio terms + * Max Chase Ticks - max levels to pay up, in ticks + + +## Join +The goal of the join order is to watch the opposite-inside market and join when the market flips (that is, when the best offer becomes the best bid) and has at least threshold size. + +##### Parameters +* Join Thresh - size thresh in absolute or ratio terms + + +## Top + +The goal of the top order is to not trade by yourself, but the intent at the time of order entry is toget filled.If the order is on the market (say current bid price) AND the quantity on that bid price is belowtop thresh then cancel the order else remain working. + +##### Parameters + * Top Thresh - size thresh in absolute or ratio terms + + +## Cover +A Cover order’s purpose is to fire a hedge order (of any type) in response to fills from it’s childorder on the opposite side of the market N ticks away + +##### Parameters + * Profit Ticks - ticks above or below fill price to place profit / cover order + + +## OCO +An OCO order’s purpose is to join a 'stop' or 'other' order to a main order wherein when one of these is cancelled, both cancel, or when one is filled, the other order's size is debited in the amount of the fill. + +Composing this order with Cover simulates scalping functionality + +##### Parameters + * Stop Ticks - ticks below or above main order to place stop / other order \ No newline at end of file diff --git a/src/sdk/make_sdk.sh b/src/sdk/make_sdk.sh index 945b69c2e..53112d13e 100755 --- a/src/sdk/make_sdk.sh +++ b/src/sdk/make_sdk.sh @@ -25,6 +25,7 @@ ln -sf $1/server $1/sdk/lib mkdir $1/sdk/examples cp $2/examples/* $1/sdk/examples +cp $2/doc/* $1/sdk/doc cp $2/sdk_shell.sh $1/sdk/sdk_shell.sh cp $2/update_github.sh $1/sdk/update_github.sh cp $2/README.md $1/sdk/README.md From 82a8d007bfd1296ac8ec6363b1bb302ff411e351 Mon Sep 17 00:00:00 2001 From: Kevin Darby Date: Wed, 6 Feb 2019 17:06:22 -0500 Subject: [PATCH 11/17] only generate package on release build --- src/client/spark_sdk/spark_sdk.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/spark_sdk/spark_sdk.csproj b/src/client/spark_sdk/spark_sdk.csproj index 0579a5960..b1995ae48 100644 --- a/src/client/spark_sdk/spark_sdk.csproj +++ b/src/client/spark_sdk/spark_sdk.csproj @@ -2,8 +2,7 @@ netcoreapp2.1;net471 Exe - - true + true $(OutputPath)\net471 true true From 9132b4a1789fceba98eb9e044e083c1cdb62ab0d Mon Sep 17 00:00:00 2001 From: Michael Harding Date: Thu, 7 Feb 2019 12:37:10 -0500 Subject: [PATCH 12/17] Fix clip limits test --- src/client/spark_test/System/LimitsTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/client/spark_test/System/LimitsTests.cs b/src/client/spark_test/System/LimitsTests.cs index b517765bd..36a2235fe 100644 --- a/src/client/spark_test/System/LimitsTests.cs +++ b/src/client/spark_test/System/LimitsTests.cs @@ -124,10 +124,16 @@ namespace bts.tests over_limit_order_key = over_limit_order_result.value.OrderKey; no_limit_order_key = no_limit_order_result.value.OrderKey; + bool waiting_for_orders = true; + var orders = _order_service.subscribei_orders().Subscribe(ords => { + waiting_for_orders = false; + IEnumerable filtered_orders = ords.all.Where(x => x.Key == under_limit_order_key || x.Key == over_limit_order_key || x.Key == no_limit_order_key); + Assert.IsTrue(filtered_orders.Count() == 3, "There should be 3 matching orders... there are not"); + foreach(var o in filtered_orders) { if(o.Key == under_limit_order_key) { @@ -142,6 +148,9 @@ namespace bts.tests } }); + while(waiting_for_orders) { + await Task.Delay(100); + } // Restore the Limits to the original values bool success = false; From 49e5eab7d3c75546da440cd23840290d47622813 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Mon, 11 Feb 2019 08:55:10 -0500 Subject: [PATCH 13/17] Updated release notes. --- doc/user/docs/release_notes.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/user/docs/release_notes.md b/doc/user/docs/release_notes.md index 110ba5c53..566027819 100644 --- a/doc/user/docs/release_notes.md +++ b/doc/user/docs/release_notes.md @@ -1,5 +1,9 @@ # Release Notes +## 1.5.0 +### Bug Fixes + - Fixed the "Since Open" time filter to use the exchange open time rather than 8:30 AM + ## 1.4.11 ### New Features - Floating Order Book From 1301130afbafaa0c564ff6a6d877eab8252583dc Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Mon, 11 Feb 2019 08:58:00 -0500 Subject: [PATCH 14/17] Quieted the build. --- src/data_files/copy_data_files.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/data_files/copy_data_files.sh b/src/data_files/copy_data_files.sh index b3b880d74..cdce7beaa 100644 --- a/src/data_files/copy_data_files.sh +++ b/src/data_files/copy_data_files.sh @@ -6,7 +6,6 @@ cp -r $2/files/* $1 for filename in $1/*; do if [[ $filename == *.xz ]]; then - echo Decompressing $filename unxz $filename fi done From be6124e72f5a6f4596876d5a09729f9ce72e4d9d Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Mon, 11 Feb 2019 09:06:05 -0500 Subject: [PATCH 15/17] Updated release notes. --- doc/user/docs/release_notes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/user/docs/release_notes.md b/doc/user/docs/release_notes.md index ecd2233da..d3b1f2a87 100644 --- a/doc/user/docs/release_notes.md +++ b/doc/user/docs/release_notes.md @@ -3,7 +3,9 @@ ## 1.5.0 ### Bug Fixes - Fixed the "Since Open" time filter to use the exchange open time rather than 8:30 AM - +### SDK + - Improved SDK documentation and usability + ## 1.4.11 ### New Features - Floating Order Book From ee21b4f597a772140c93def8dadde37bcb89e2be Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Mon, 11 Feb 2019 09:42:37 -0500 Subject: [PATCH 16/17] Updated release notes. --- doc/user/docs/release_notes.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/user/docs/release_notes.md b/doc/user/docs/release_notes.md index d3b1f2a87..ec048c3e1 100644 --- a/doc/user/docs/release_notes.md +++ b/doc/user/docs/release_notes.md @@ -1,10 +1,19 @@ # Release Notes ## 1.5.0 -### Bug Fixes +### User Visible Changes +#### User Interface Improvements + - Removed security key field from most grids + - Removed trade key field from time and sales grid - Fixed the "Since Open" time filter to use the exchange open time rather than 8:30 AM -### SDK +#### SDK - Improved SDK documentation and usability +### Internal Changes + - Improved robustness of limit system test + - Extensive refactoring to the market data subsystem to allow for + updates of security definitions + + ## 1.4.11 ### New Features From 924b654f5f28508adb3bb99a612c6fab93ea6c03 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Mon, 11 Feb 2019 09:53:30 -0500 Subject: [PATCH 17/17] Update release notes. --- doc/user/docs/release_notes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/user/docs/release_notes.md b/doc/user/docs/release_notes.md index ec048c3e1..a08414425 100644 --- a/doc/user/docs/release_notes.md +++ b/doc/user/docs/release_notes.md @@ -6,14 +6,14 @@ - Removed security key field from most grids - Removed trade key field from time and sales grid - Fixed the "Since Open" time filter to use the exchange open time rather than 8:30 AM + - Fixed the floating order book so that rows are no longer + highlighted after an order is modified #### SDK - Improved SDK documentation and usability ### Internal Changes - Improved robustness of limit system test - - Extensive refactoring to the market data subsystem to allow for - updates of security definitions + - Extensive market data refactoring allow for security definition updates - ## 1.4.11 ### New Features