diff --git a/doc/user/content/release_notes/_index.md b/doc/user/content/release_notes/_index.md index f2ba4c36e..ffb88aee2 100644 --- a/doc/user/content/release_notes/_index.md +++ b/doc/user/content/release_notes/_index.md @@ -4,6 +4,14 @@ weight = 3 sort_by = "weight" insert_anchor_links = "right" +++ +## 2.6.0 +### User Visible Changes + - In the ladder made last trade more distinctive when overlayed on the volumn column + - In the ladder, corrected display of volume tool tip + - In the ladder, changed the consolidation of last trade to consider only the price ignoring aggressor changes +### Internal Changes + - Ensure that admin logins are always allowed to login, regardless of keycode status. + ## 2.5.0 ### User Visible Changes - Added loss limit risk check diff --git a/src/client/spark/Modules/Trading/Ladder/View/LadderGridHost.cs b/src/client/spark/Modules/Trading/Ladder/View/LadderGridHost.cs index 2a2af3223..b78519f62 100644 --- a/src/client/spark/Modules/Trading/Ladder/View/LadderGridHost.cs +++ b/src/client/spark/Modules/Trading/Ladder/View/LadderGridHost.cs @@ -694,12 +694,14 @@ namespace mbts.spark { // At any rate, we need this part hiding the tooltip so that we don't leave random tooltips around // and we have to reset to old row so that when we go back to what could be our preivous row, the tooltip gets drawn again //System.Diagnostics.Debug.WriteLine(" Tooltip - Volume is 0"); + _old_tooltip_row = int.MaxValue; _hide_tool_tip(); //_old_tooltip_row = Int32.MaxValue; } } } else { //System.Diagnostics.Debug.WriteLine(" Tooltip - not over Volume column"); + _old_tooltip_row = int.MaxValue; _hide_tool_tip(); } } diff --git a/src/client/spark/Modules/Trading/Ladder/View/LadderRender.cs b/src/client/spark/Modules/Trading/Ladder/View/LadderRender.cs index 8f0168332..d12c79a6c 100644 --- a/src/client/spark/Modules/Trading/Ladder/View/LadderRender.cs +++ b/src/client/spark/Modules/Trading/Ladder/View/LadderRender.cs @@ -215,16 +215,16 @@ namespace mbts.spark { Brush total_brush = null; if (settings.total.bars.result.HasValue) { total_brush = new SolidColorBrush(settings.total.bars.result.Value); - } else if (components.Count == 0) { + } else if (components.Count == 0 && !settings.show_ltq) { _clear_visual(dv); return; } // inflate the max so that the graph never fills the available space double max = data.Max(v => v.Volume) * 1.1; - Brush text_brush = settings.general.foreground.rgb_brush(); _render_cells(dv, row_height, data.Select(d => (d.Price, d)), settings.general, prices, spec, render_cell); /// local methods void render_cell(DrawingContext dc, int r, VolumeAtPriceLevelImmutable vap) { + Brush text_brush = settings.general.foreground.rgb_brush(); double y = row_height * r; var last_trade_here = r == last_index; @@ -259,6 +259,7 @@ namespace mbts.spark { if (settings.show_ltq && last_trade_here) { numbers_text.Clear(); numbers_text.Add(last_size_and_direction); + text_brush = BTSCoreColors.white; } if (numbers_text.Count > 0) { string str = string.Join("/", numbers_text); diff --git a/src/client/spark_api/Co2/MDConsumerHandle.cs b/src/client/spark_api/Co2/MDConsumerHandle.cs index d13ef5b08..7b03bdaee 100644 --- a/src/client/spark_api/Co2/MDConsumerHandle.cs +++ b/src/client/spark_api/Co2/MDConsumerHandle.cs @@ -253,14 +253,13 @@ namespace mbts.co2 { } } - [StructLayout(LayoutKind.Sequential, Size = 712)] + [StructLayout(LayoutKind.Sequential, Size = 704)] internal struct ColdEntry { public int exchange_status; // Last trade public AtomicPriceSize last_trade; public ulong total_volume; public utils.LLDateTime last_trade_time; - private AggressorSide last_side; //// Settlement public UInt64 misc_timestamp; diff --git a/src/lib/md/MDProducerHandle.cpp b/src/lib/md/MDProducerHandle.cpp index 471fd53e1..a52292972 100644 --- a/src/lib/md/MDProducerHandle.cpp +++ b/src/lib/md/MDProducerHandle.cpp @@ -102,14 +102,13 @@ void MDProducerHandle::set_status(CoconutSecurityStatus status) { } void MDProducerHandle::add_trade(TimeStamp time, const PriceSize price, LLDateTime tradetime, co2::AggressorSide agside, uint32_t volume) { - // Add this trade to the last trade if price/side match + // Add this trade to the last trade if price match auto current = std::get(cdata().last_trade.load()); - if (current.int_price() == price.int_price() && agside == cdata().last_side) { + if (current.int_price() == price.int_price()) { cdata().last_trade.store(PriceSize { price.int_price(), price.size() + current.size() }, time); } else { cdata().last_trade.store(price,time); - cdata().last_side = agside; } cdata().last_trade_time = tradetime; cdata().total_volume = volume; diff --git a/src/lib/md/Shm/MDStructure.h b/src/lib/md/Shm/MDStructure.h index dd5dbb6b5..3553b71d8 100644 --- a/src/lib/md/Shm/MDStructure.h +++ b/src/lib/md/Shm/MDStructure.h @@ -26,7 +26,7 @@ namespace md { using utils::TimeStamp; -const uint32_t shm_version = 101; +const uint32_t shm_version = 102; struct ALIGNED_(CACHE_LINE) HotHeader { size_t count; @@ -214,7 +214,6 @@ struct ColdEntry { last_trade(), total_volume(0), last_trade_time(), - last_side(co2::AggressorSide::AGGRESSOR_SIDE_NONE), misc(), deleted(false) { @@ -230,7 +229,6 @@ struct ColdEntry { AtomicPriceSize last_trade; size_t total_volume; datetime::LLDateTime last_trade_time; - co2::AggressorSide last_side; MiscData misc; diff --git a/src/lib/utils/AuthSessionManager.cpp b/src/lib/utils/AuthSessionManager.cpp index 11d620282..dddb415fd 100644 --- a/src/lib/utils/AuthSessionManager.cpp +++ b/src/lib/utils/AuthSessionManager.cpp @@ -86,7 +86,7 @@ bool AuthSessionManager::add_or_replace_session(const api::user::TokenPayload& t return true; if(datetime::ll_diff_in_us(datetime::ll_now(), _expiration) < 0) { - LOG(Gen,Error, "Your BTS Keycode is expired!"); + LOG(User,Error, "Your BTS Keycode is expired!"); if(msg) *msg = "Your BTS Keycode is EXPIRED! Please contact sales@bluetradesys.com"; return false; @@ -105,13 +105,18 @@ bool AuthSessionManager::add_or_replace_session(const api::user::TokenPayload& t if(it != _map.end()) { _map[tok.id()] = Session{tok}; + LOG(User, Warn, "KEYCODE: Replacing session {} ", tok.id()); return true; } else if(_map.size() < _nusers) { _map[tok.id()] = Session{tok}; + LOG(User, Warn, "KEYCODE: Creating session {} ", tok.id()); return true; } + if(msg) + *msg = "KEYCODES: Not Enough Logins available for session"; + LOG(User, Error, "KEYCODES: Not Enough Logins available for session {}", tok.id()); return false; } diff --git a/src/lib/utils/AuthToken.cpp b/src/lib/utils/AuthToken.cpp index e1292b595..2423638a8 100644 --- a/src/lib/utils/AuthToken.cpp +++ b/src/lib/utils/AuthToken.cpp @@ -51,6 +51,35 @@ AuthSessionManager& session_manager() return mgr; } +bool requires_auth_session(const admin::BTSUser& user) +{ + //if the user can trade in any account or see market data, it needs a session + if(user.has_user_data() && + user.user_data().has_account_permissions() && + user.user_data().account_permissions().account_permissions_size()) + { + for(const auto& i: user.user_data().account_permissions().account_permissions()) + { + if(i.second.has_trading_permission() && i.second.trading_permission().has_permissions()) + return true; + } + } + + if(user.has_user_data() && + user.user_data().has_exchange_user_data()) + { + if(user.user_data().exchange_user_data().has_cme_data()) + { + for(const auto& i: user.user_data().exchange_user_data().cme_data().md_permissions()) + { + if(i.enabled()) + return true; + } + } + } + return false; +} + AuthToken generate_token(const admin::BTSUser& user, std::string* msg) { api::user::TokenPayload payload; @@ -58,7 +87,9 @@ AuthToken generate_token(const admin::BTSUser& user, std::string* msg) payload.set_id(user.id()); if(user.name() == "bts") payload.set_wheel(true); - session_manager().add_or_replace_session(payload, msg); + + if(requires_auth_session(user)) + session_manager().add_or_replace_session(payload, msg); auto token = encrypt(payload.SerializeAsString()); bts_assert_d(token.size() < 255-8); AuthToken result; diff --git a/src/server/sparkd/user/AdminServiceServer.cpp b/src/server/sparkd/user/AdminServiceServer.cpp index 9e317e7fc..b795c7f39 100644 --- a/src/server/sparkd/user/AdminServiceServer.cpp +++ b/src/server/sparkd/user/AdminServiceServer.cpp @@ -155,7 +155,7 @@ void AdminServiceServer::get_filtered_admin_data( const api::Response& reply) { bts::api::user::TokenPayload toke; - if(bts::api::auth::decode_token(token, &toke)) + bts::api::auth::decode_token(token, &toke); { if(toke.wheel()) reply(_state); diff --git a/src/web/CMakeDeps.cmake b/src/web/CMakeDeps.cmake index 40156daa9..1843aaacb 100644 --- a/src/web/CMakeDeps.cmake +++ b/src/web/CMakeDeps.cmake @@ -1 +1 @@ -set(sources ../../externals/linux/include/google/protobuf/descriptor.proto;../../externals/linux/include/google/protobuf/timestamp.proto;../lib/api/apicore.proto;../lib/api/apigateway.proto;../lib/api/apioptions.proto;../lib/api/services/AdminService.proto;../lib/api/services/AlgoDefinitionService.proto;../lib/api/services/AlgoService.proto;../lib/api/services/ApiUnitTestService.proto;../lib/api/services/AuthService.proto;../lib/api/services/ErrorReportService.proto;../lib/api/services/HelloService.proto;../lib/api/services/MBOService.proto;../lib/api/services/MarketDataAuxiliaryService.proto;../lib/api/services/MarketDataRelay.proto;../lib/api/services/OrderService.proto;../lib/api/services/OutOfProcessURLListener.proto;../lib/api/services/PersistenceService.proto;../lib/api/services/PositionService.proto;../lib/api/services/ShellDiagnosticService.proto;../lib/api/services/ShellLatencyService.proto;../lib/api/services/SyntheticSecurityService.proto;../lib/domain_model/Security.proto;../lib/md/protos/co2.proto;../lib/sparkproto/SparkProtos.proto;api/build.sh;api/node_modules/exit/test/fixtures/create-files.sh;api/node_modules/protobufjs/cli/node_modules/acorn-jsx/node_modules/acorn/bin/update_authors.sh;api/node_modules/watch/release.sh;api/quiet_build.sh;api/src/DynamicService.ts;api/src/ServiceContext.ts;api/src/bts_assert.ts;ui/src/Access.fs;ui/src/Accounts/ClipLimits.fs;ui/src/Accounts/ProductLimits.fs;ui/src/Accounts/SecurityLimits.fs;ui/src/Accounts/State.fs;ui/src/Accounts/Types.fs;ui/src/Accounts/View.fs;ui/src/App.fs;ui/src/Cmd.fs;ui/src/Controls/Button.fs;ui/src/Controls/DataGrid.fs;ui/src/Controls/Fields.fs;ui/src/Controls/Modal.fs;ui/src/Controls/ReactGrid.fs;ui/src/Controls/Table.fs;ui/src/Controls/nbsp.fs;ui/src/Global.fs;ui/src/Imports.fs;ui/src/Lens.fs;ui/src/Login/Login.fs;ui/src/Nav.fs;ui/src/State.fs;ui/src/Types.fs;ui/src/Users/State.fs;ui/src/Users/Types.fs;ui/src/Users/View.fs;ui/src/Util/EnumUtils.fs;ui/src/Util/JSMap.fs;ui/src/obj/Debug/netstandard2.0/ui.AssemblyInfo.fs) \ No newline at end of file +set(sources ../../externals/linux/include/google/protobuf/descriptor.proto;../../externals/linux/include/google/protobuf/timestamp.proto;../lib/api/apicore.proto;../lib/api/apigateway.proto;../lib/api/apioptions.proto;../lib/api/services/AdminService.proto;../lib/api/services/AlgoDefinitionService.proto;../lib/api/services/AlgoService.proto;../lib/api/services/ApiUnitTestService.proto;../lib/api/services/AuthService.proto;../lib/api/services/ErrorReportService.proto;../lib/api/services/HelloService.proto;../lib/api/services/MBOService.proto;../lib/api/services/MarketDataAuxiliaryService.proto;../lib/api/services/MarketDataRelay.proto;../lib/api/services/OrderService.proto;../lib/api/services/OutOfProcessURLListener.proto;../lib/api/services/PersistenceService.proto;../lib/api/services/PositionService.proto;../lib/api/services/ShellDiagnosticService.proto;../lib/api/services/ShellLatencyService.proto;../lib/api/services/SyntheticSecurityService.proto;../lib/domain_model/Security.proto;../lib/md/protos/co2.proto;../lib/sparkproto/SparkProtos.proto;api/build.sh;api/node_modules/exit/test/fixtures/create-files.sh;api/node_modules/protobufjs/cli/node_modules/acorn-jsx/node_modules/acorn/bin/update_authors.sh;api/node_modules/psl/scripts/ci-build.sh;api/node_modules/watch/release.sh;api/quiet_build.sh;api/src/DynamicService.ts;api/src/ServiceContext.ts;api/src/bts_assert.ts;ui/src/Access.fs;ui/src/Accounts/ClipLimits.fs;ui/src/Accounts/ProductLimits.fs;ui/src/Accounts/SecurityLimits.fs;ui/src/Accounts/State.fs;ui/src/Accounts/Types.fs;ui/src/Accounts/View.fs;ui/src/App.fs;ui/src/Cmd.fs;ui/src/Controls/Button.fs;ui/src/Controls/DataGrid.fs;ui/src/Controls/Fields.fs;ui/src/Controls/Modal.fs;ui/src/Controls/ReactGrid.fs;ui/src/Controls/Table.fs;ui/src/Controls/nbsp.fs;ui/src/Global.fs;ui/src/Imports.fs;ui/src/Lens.fs;ui/src/Login/Login.fs;ui/src/Nav.fs;ui/src/State.fs;ui/src/Types.fs;ui/src/Users/State.fs;ui/src/Users/Types.fs;ui/src/Users/View.fs;ui/src/Util/EnumUtils.fs;ui/src/Util/JSMap.fs;ui/src/obj/Debug/netstandard2.0/ui.AssemblyInfo.fs) \ No newline at end of file diff --git a/testing/manual/keycodes/keycode.txt b/testing/manual/keycodes/keycode.txt index ffd573a26..ed9535602 100644 --- a/testing/manual/keycodes/keycode.txt +++ b/testing/manual/keycodes/keycode.txt @@ -15,7 +15,7 @@ This will test our ability to generate and enforce keycodes. You should see keycode details printed to screen -4) Now test concurrent logins. Start a sparkd. +4) Now test concurrent logins. Start a sparkd. Make sure bts_2 and bts_3 have market data permission a) Start a spark -multiple login as bts and go to where you would see some market data b) Start another spark -multiple but log in as bts_2 and display some data c) Start a third spark -multiple, log in as bts_2 and display some data. @@ -37,5 +37,19 @@ You should see keycode details printed to screen d) remove the expired keycode you just generated by: rm ~/sparkdata/conf/keycode.conf e) restart sparkd, you should see data as normal in bts_2 + +6) Test admin vs trading logins +Note that an admin login is one that does not have trading permission in any account +AND does not have the ability to see any market data + + a) start sparkd again. make sure bts_2 and bts_3 have market data and trading permissions in webui + b) Start a spark -multiple login as bts_2 and go to where you would see some market data. You should see data + c) Start a webui and log in as bts_3, you should see data + d) close your shell and log out of web ui, now log in bts_3 into the webui and log in bts_2 in a shell ( + this is the reverse of the previous order), you should see a message in the shell about keycodes, but it will let you log in, just not see market data + e) from the webui, de-permission bts_3 from trading AND market data, + f) exit shell, log out of webui and kill sparkd, restart sparkd + + g)now try d again-- you should not get the same shell error