Compare commits

..
352 Commits
Author SHA1 Message Date
Michael Harding ebaf8ff51f Merged master into doc-theme 2019-11-04 16:17:12 -05:00
Taha Afzal b3369db7cc Release notes 2019-11-04 13:07:02 -05:00
Taha Afzal 279abcfefd Made the fractional_hedging test a bit easier to do 2019-11-04 10:41:27 -05:00
Taha Afzal 872e2465a6 Fixing the test 2019-11-01 14:15:11 -04:00
Taha Afzal 89fb79c556 Manual tests added 2019-10-29 18:53:17 -04:00
Taha Afzal c92e9df77b Merge branch 'hide_deleted_accounts' 2019-10-29 14:58:11 -04:00
Taha Afzal 81aaa853d5 Merging SP-248 2019-10-29 14:40:00 -04:00
Taha Afzal 4f308faba2 Merge branch 'SP-247-order-entry-sounds' 2019-10-29 14:09:30 -04:00
Taha Afzal 0b924033c2 Merge branch 'SP-252-root-spreader-security' 2019-10-29 14:08:29 -04:00
Taha Afzal 3606c707e4 Merge branch 'SP-204-local-fills' 2019-10-29 14:07:42 -04:00
Taha Afzal 5998107e6a Merge branch 'SP-225-investigate-the-lack-of-price-rep' 2019-10-29 14:03:12 -04:00
Taha Afzal 297982433b Merge branch 'SP-249' 2019-10-29 13:58:28 -04:00
Taha Afzal 15ac9d945b Modified tests 2019-10-29 13:53:20 -04:00
Jake Norbut a0f1d11692 adding manual fills don't show admin fills test 2019-10-28 16:15:01 -05:00
Jake Norbut e7890a459c test for order sent sound 2019-10-28 15:57:27 -05:00
Jake Norbut f7fb5ed400 adding test for deleted accounts 2019-10-28 15:48:47 -05:00
Jake Norbut 75e98d353f adding left panel test steps 2019-10-28 15:41:39 -05:00
Michael Harding 01ab0dd3e5 update manual deploy script 2019-10-28 14:28:59 -04:00
Michael Harding fbdf56b4dc Move lightbox assets into the manual build 2019-10-28 14:28:01 -04:00
Michael Harding b698b64879 Merge master into doc-theme 2019-10-28 11:41:34 -04:00
John Colvin 5fc6ff4c00 SP-204 Local fills UI erroneously shows admin fills too 2019-10-26 16:40:32 -05:00
Taha Afzal 6951272633 Just has to update the last_price 2019-10-25 13:05:44 -04:00
Taha Afzal 548611b44f Adding tooltips, and hooking to the right proto 2019-10-24 18:04:54 -04:00
Taha Afzal 322da04723 Merge branch 'SP-249' of bitbucket.org:bluetradesys/spark into SP-249 2019-10-24 17:09:30 -04:00
Taha Afzal 3544eac815 Cleaned up the quote throttling code 2019-10-24 17:09:24 -04:00
John Colvin 7fef7d88ce refactor QuoteInsideMarketDistance to new proto type (cannot recycle old type bc it must be null in existing synths) 2019-10-24 15:41:30 -05:00
John Colvin 7531cf5eb4 remove unused synth param 'QuoteInsideMarketDistanceAwayModel' 2019-10-24 15:38:15 -05:00
John Colvin 5826a083c0 SyntheticEditor - remove Quote Inside Market Away Distance param 2019-10-24 12:44:47 -05:00
John Colvin ec0d5d22f1 SyntheticEditor - disable Quote Throttle/Inside Market Distance by default 2019-10-24 12:37:13 -05:00
John Colvin d433368795 fix typo in 'order sent alert' predicate (creation time comparison was backwards) 2019-10-24 11:51:39 -05:00
Jake Norbut dc4453e510 SP-256 - hide deleted accounts 2019-10-24 08:32:38 -05:00
Jake Norbut 1b1583abda removing OJ and KC IFU entries; regen cme ref data file 2019-10-23 09:24:28 -05:00
Jake Norbut 9d2f2888bb updating reference data with latest for RodrigoSGU and CNH 2019-10-23 09:08:20 -05:00
John Colvin 26816f0048 SP-249 New spreader quoting throttle parameter 2019-10-22 12:12:17 -05:00
Taha Afzal e97e6b93c7 Adding proto 2019-10-21 16:44:00 -04:00
John Colvin 0d8252e131 SP-252 Parent spreader badge should show the spreader name as well 2019-10-21 12:58:21 -05:00
Taha Afzal 801b9622f8 Merge branch 'master' of bitbucket.org:bluetradesys/spark 2019-10-17 15:09:19 -04:00
Taha Afzal a5df3f2da2 Dynamic Algos are now loaded only when explicitely enabled by name in Toggles config 2019-10-17 15:09:10 -04:00
John Colvin f03a413855 SP-247 Order Entry Sounds 2019-10-17 13:55:52 -05:00
Michael Harding f3a692bda2 Delete ex_sim_orders_venue_sim in system tests 2019-10-17 13:30:11 -04:00
Kevin Darby 6c3bdbdc34 make sim datapaths pretty again 2019-10-17 12:09:05 -04:00
Eric Harding d4749dd381 Tool to test c# api latency 2019-10-17 11:57:20 -04:00
Taha Afzal a008f4d0fd Hiding pyramid, ignoring timer (which was faking market status) 2019-10-17 11:38:35 -04:00
Taha Afzal 0ee9521454 Merge branch 'TAS' 2019-10-17 11:16:03 -04:00
Kevin Darby 62cef7c2f7 release notes 2019-10-17 09:44:53 -04:00
Taha Afzal 1b39f4e47c Merge branch 'master' into TAS 2019-10-16 21:54:24 -04:00
Taha Afzal 3212b2fcee Added logs for TAS Algo 2019-10-16 16:38:12 -04:00
Taha Afzal 1576541bd1 Clean up 2019-10-16 14:59:34 -04:00
Kevin Darby 62e97364fb Merged in ice_exec3 (pull request #230)
Ice execution

Approved-by: Kevin Darby <kevin.darby@bluetradesys.com>
2019-10-16 18:47:10 +00:00
Taha Afzal 93b954ce46 Some cleanup remains, mostlty done 2019-10-16 11:37:32 -04:00
John Colvin c9da022c58 SP-248 Ladder left panel scroll 2019-10-15 12:12:20 -05:00
Michael Harding 68a822c342 Fix build 2019-10-15 11:42:11 -04:00
John Colvin 0772a13b09 introduce ladder settings 'profile-equivalent' logic to avoid disconnecting ladders from profiles due to trivial settings changes 2019-10-14 20:55:00 -05:00
Michael Harding 5ee2cfb5f6 Merged master into doc-theme 2019-10-14 17:05:38 -04:00
John Colvin c53f6ad906 finally remove mutable members from LadderSettings GetHashCode impl 2019-10-14 16:01:24 -05:00
Michael Harding e8d4fa1200 Manual: Add page descriptions 2019-10-14 16:48:31 -04:00
Taha Afzal 1058c8a80e Merge branch 'pyramid' into TAS 2019-10-14 11:45:56 -04:00
Taha Afzal 7ecb106880 Done 2019-10-14 11:39:27 -04:00
Taha Afzal b0c1d93c50 Corner cases fixed 2019-10-14 11:08:29 -04:00
Michael Harding 8d47584ee8 Manual: make navigation fixed 2019-10-11 14:05:48 -04:00
Kevin Darby 0c5a039226 tested buffered cancel and replace with lean_controlled.txt, verified in fix 2019-10-11 14:04:32 -04:00
Michael Harding 7b95174171 Manual: Fix menu on mobile 2019-10-11 13:36:08 -04:00
Michael Harding 31e913fb1b manual: improve lightbox 2019-10-11 10:48:36 -04:00
Kevin Darby 2677144bfa buffer cancel and updates because ice sucks 2019-10-10 17:43:28 -04:00
Michael Harding 20f6c76050 Manual: screen_recording short code better youtube 2019-10-10 17:05:54 -04:00
Kevin Darby 6b30c42c0d added gt_cert jetfix rule to conf per Pete 2019-10-10 14:56:32 -04:00
Michael Harding 4a41f9b166 Manual: image shortcode 2019-10-10 11:27:07 -04:00
BTS f4bb2aaada Manual: image processing 2019-10-09 17:45:01 -04:00
BTS 36b43024ac Manual Dark Mode 2019-10-09 16:35:21 -04:00
Kevin Darby 2f62d29f66 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-10-09 14:03:11 -04:00
Taha Afzal 828f867a80 Merge branch 'pyramid' of bitbucket.org:bluetradesys/spark into pyramid 2019-10-09 13:46:19 -04:00
Taha Afzal c9663cf7ab made the child orders configurable 2019-10-09 13:46:08 -04:00
John Colvin b85de51d0c bring back DefaultAlgoVM for 'None' case (dynamic children placeholders do not have specific impl) 2019-10-09 12:33:40 -05:00
John Colvin dc8e65923d fix adminModel typo '&&' -> '||' (users need admin OR trade permissions to see account) 2019-10-09 12:00:25 -05:00
Eric Harding 1469373b9c fix Sparkcmd -h help printer 2019-10-08 15:59:15 -04:00
Kevin Darby 820e937336 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-10-08 12:49:58 -04:00
John Colvin 8b73878782 null check for TradingPermissions (fixes login crash) 2019-10-08 11:46:32 -05:00
Kevin Darby b15106dac4 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-10-08 11:43:22 -04:00
Michael Harding 100316b791 SP-246: Fix System Tests 2019-10-08 11:06:41 -04:00
Kevin Darby 3c98425226 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-10-07 12:53:44 -04:00
John Colvin 1aa9c46367 fix build (bad using directives after merge) 2019-10-07 10:48:12 -05:00
Kevin Darby 5211cab351 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-10-07 10:24:36 -04:00
Pedro Pinto e89a4cce53 Merged in sim_prorata (pull request #350)
RTM. Documented OrderMatcher better.
2019-10-07 13:38:41 +00:00
Eric Harding cb56b90737 Merged in SP-229-shell-crash-dumps (pull request #346)
RTM: SP-229 shell crash dumps

Approved-by: Jake Norbut <jake.norbut@bluetradesys.com>
2019-10-07 13:38:00 +00:00
Pedro Pinto 761a89f052 Updated release notes 2019-10-07 09:37:00 -04:00
Pedro Pinto cab6b56606 Merged master 2019-10-07 09:36:21 -04:00
Pedro Pinto 8a743a91a5 Updated release notes. 2019-10-07 09:29:30 -04:00
Taha Afzal 5dec5dc392 Merged in SP-232 (pull request #345)
RTM. Fixing SP-232

Approved-by: Pedro Pinto <pedro.pinto+atlassian@bluetradesys.com>
2019-10-07 13:28:30 +00:00
Eric Harding 27aa4fca26 Merged in system-tests (pull request #349)
RTM: System tests

Approved-by: Michael Harding <michael.harding@bluetradesys.com>
Approved-by: Pedro Pinto <pedro.pinto+atlassian@bluetradesys.com>
2019-10-07 13:20:35 +00:00
Pedro Pinto 84a2e50bf7 Updated release notes. 2019-10-07 09:19:18 -04:00
John Colvin 297eb5b25b Merged in SP-181-no-spreads-in-man-fills (pull request #352)
RTM SP-181 Remove the option to enter manual fills of spreads

Approved-by: Jake Norbut <jake.norbut@bluetradesys.com>
2019-10-07 13:18:26 +00:00
Pedro Pinto d9d0e1f4ef Updated release notes. 2019-10-07 09:15:21 -04:00
Eric Harding 6ec0cc8bbe Merged in SP-236-websocketpp (pull request #353)
RTM: SP-236 Disable websocketpp open_handshake timeout
2019-10-07 13:13:30 +00:00
Pedro Pinto 795b77ea3f Updated release notes. 2019-10-07 09:12:45 -04:00
John Colvin 91c97d32bb Merged in SP-223-som-synth-crash (pull request #355)
RTM add dispatcher thread name to assert log

Approved-by: Eric Harding <eric.harding@bluetradesys.com>
2019-10-07 13:11:57 +00:00
John Colvin e0c50703d7 Merged in SPARK-2534-fills-time-filter-bug (pull request #357)
RTM SPARK-2534 fills time filter bug

Approved-by: Jake Norbut <jake.norbut@bluetradesys.com>
2019-10-07 13:11:03 +00:00
Pedro Pinto dab1e76766 Updated release notes. 2019-10-07 09:10:32 -04:00
Pedro Pinto b8c927df27 Merge branch 'master' into SPARK-2534-fills-time-filter-bug 2019-10-07 09:02:25 -04:00
Pedro Pinto 2684d25f09 Updated release notes 2019-10-07 09:01:48 -04:00
John Colvin 7c95a77ae2 Merged in update-naggle-test (pull request #360)
RTM unit test for update.naggle fix
2019-10-07 13:00:06 +00:00
John Colvin 31b115d13b Merged in bts-admin-permissions (pull request #356)
RTM Bts admin permissions
2019-10-07 12:58:42 +00:00
Pedro Pinto d681a6924b Updated release notes. 2019-10-07 08:39:01 -04:00
Pedro Pinto d0cce84d2e Merge branch 'master' into bts-admin-permissions 2019-10-07 08:38:07 -04:00
Pedro Pinto 532591c34f Updated release notes. 2019-10-07 08:36:14 -04:00
Taha Afzal 562b9419bd hedge is a lean now 2019-10-04 17:32:03 -04:00
John Colvin 7f187224c1 add .Replay(1).RefCount() to AdminModel.on_accounts 2019-10-02 13:40:29 -05:00
John Colvin 79b2121f5e OrderBookVM disposes order_mod_vm 2019-10-02 13:40:28 -05:00
John Colvin 0bd477594c FillsVM disposes filters 2019-10-02 13:36:58 -05:00
John Colvin 149cd90fb4 apply permission filter to pnl stream 2019-10-02 11:54:38 -05:00
John Colvin f74e719a9f sort accounts/users in filter dropdowns for OrderBook/Fills/PNL 2019-10-02 11:54:38 -05:00
John Colvin 8b68beae96 Merge remote-tracking branch 'origin/master' into bts-admin-permissions 2019-10-02 10:52:45 -05:00
Pedro Pinto 9cc0b471f2 Added support for tag 1031, defaults to Y. 2019-10-02 10:32:23 -04:00
Taha Afzal 3e035197d0 Top Spread is also a security (forgot to mark it as a security, so it was showing as a uint in the ui) 2019-10-01 20:42:06 -04:00
Taha Afzal c9d8a640b6 Merge branch 'pyramid' of bitbucket.org:bluetradesys/spark into pyramid 2019-10-01 19:44:49 -04:00
John Colvin 1d97e620fd add security map to view's resources for dynamic security key param's ContractPickerPopup 2019-10-01 17:17:31 -05:00
John Colvin f6299ab5c3 clean up DynamicOrderParamVM - don't store value with the descriptor, make 'param' prop readonly 2019-10-01 17:08:32 -05:00
John Colvin eaff4774e0 refactor some Disposable.replace calls so that the prev hook is disposed before the new one is created 2019-10-01 17:08:32 -05:00
John Colvin bed52db98a dynamic order SecurityKey DataTemplate 2019-10-01 17:08:32 -05:00
John Colvin bd3ef33607 AlgoStudio dynamic order 'SecurityKey' template 2019-10-01 17:08:32 -05:00
John Colvin 25a594895e ladder/ticket/algo studio views store SecurityMap in resource dictionary 2019-10-01 17:08:31 -05:00
John Colvin 4d468c8026 DynamicOrderVM 'SecurityKey' descriptor impl 2019-10-01 17:08:31 -05:00
John Colvin 68ed90487b AlgoParamVM template key impl 2019-10-01 17:08:31 -05:00
John Colvin ddc2c67fea add SelectedSecurityKey dp to ContractPickerPopup 2019-10-01 17:08:31 -05:00
Taha Afzal 77459e9c64 price changes dont have the algo params filled in 2019-10-01 16:15:36 -04:00
John Colvin db64f2f45b migrate common ManualFills resource keys into central location 2019-09-30 18:21:06 -05:00
John Colvin 3f7ea71de7 [non-functional] normalize whitespace in AlgoContentTemplateSelector.xaml 2019-09-30 18:11:18 -05:00
John Colvin d334418655 PyramidAlgo uses 'SecurityKey' dynamic param descriptor 2019-09-30 18:09:11 -05:00
John Colvin d1844afeae server side impl for 'SecurityKey' dynamic param descriptor 2019-09-30 18:08:41 -05:00
John Colvin b6dc2bd4d4 add 'SecurityKey' dynamic param descriptor 2019-09-30 18:03:52 -05:00
Taha Afzal 58906eb3b6 Code complete 2019-09-30 16:55:35 -04:00
Kevin Darby 50e61604ba move default keycode exp to 12/31/2019 to fix unit tests 2019-09-30 11:53:44 -04:00
Kevin Darby 6bd23f106f Merged in fix_nan_pnl (pull request #361)
add temporary config to ignore nan day pnl to stop the loss limit from keeping traders out of market
2019-09-30 15:07:11 +00:00
Kevin Darby dfd8348724 add temporary config to ignore nan day pnl to stop the loss limit from keeping traders out of market 2019-09-30 11:03:03 -04:00
Taha Afzal 963a4207e2 Code complete, need cleanup and testing 2019-09-26 19:00:15 -04:00
John Colvin d2e9352e48 unit test for update.naggle fix 2019-09-25 12:01:31 -05:00
Kevin Darby da42e95754 fixed externals and docker 2019-09-25 10:59:58 -04:00
Kevin Darby a878a55ac1 moved externals 2019-09-25 10:00:20 -04:00
John Colvin 4305d560aa Merged in pnl-rounding-error (pull request #359)
RTM Pnl rounding error

Approved-by: Jake Norbut <jake.norbut@bluetradesys.com>
Approved-by: Eric Harding <eric.harding@bluetradesys.com>
2019-09-25 13:57:52 +00:00
John Colvin 055f0015e7 Update.naggle pr edit: 'TryPop' is an innappropriate name (just use 'Remove') 2019-09-24 17:28:06 -05:00
Kevin Darby a39d91ceb3 Merge branch 'pnl-rounding-error' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-24 14:38:26 -04:00
John Colvin ddc50e1fba pnl initial calc type was not being applied to data 2019-09-24 13:32:54 -05:00
John Colvin ffb571d1cf fix pnl rounding issues (use 9 decimal places) 2019-09-24 13:32:53 -05:00
John Colvin 2a36c05d75 fix PNLRowData Equals impl (was not comparing market prices) 2019-09-24 13:32:53 -05:00
John Colvin a3730eb203 Update.naggle merge maintains changes (could get into state where changes became adds/removes) 2019-09-24 13:32:53 -05:00
John Colvin d033275694 remove unused member OrdersModel.on_account_pnl 2019-09-24 13:32:53 -05:00
Taha Afzal 4e58342677 Merge branch 'master' into Pyramid 2019-09-24 13:12:56 -04:00
Taha Afzal 5eeb5a534c Adding logs 2019-09-24 13:12:16 -04:00
Jake Norbut 016ddf9b69 fixing pay less definition 2019-09-24 08:21:56 -05:00
John Colvin 0cc5817932 expand synthetic leg columns to fit name 2019-09-24 01:04:28 -05:00
Michael Harding 032836dea4 Test updates 2019-09-23 15:54:33 -04:00
Taha Afzal f20c53bced Organized the code better 2019-09-23 14:08:21 -04:00
Kevin Darby a06461eb5e Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-23 13:58:22 -04:00
Kevin Darby 34e7d6a617 remove ice bust handling 2019-09-23 13:57:43 -04:00
Kevin Darby 31e44d8c10 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-23 13:03:20 -04:00
Kevin Darby 8fdab4a510 note about expired securities in sod tests 2019-09-23 12:47:48 -04:00
Kevin Darby 385adaa1b0 Merge branch 'fix_expired_fill_crash' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-23 12:36:16 -04:00
Kevin Darby f9506bc9ad Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-23 12:36:00 -04:00
Kevin Darby 6b5b517d70 slight nit in GLBXExecutionGateway 2019-09-23 12:29:38 -04:00
John Colvin 80850146c1 TableUpdate.AggregateLatest shouldn't share seed across subscriptions 2019-09-23 00:08:12 -05:00
John Colvin 0680dddab4 normalize line endings in TickUpDown.xaml 2019-09-22 15:22:57 -05:00
John Colvin 70aa62c0cf add border to DateTimePicker 'time' part view 2019-09-22 15:22:20 -05:00
John Colvin 06165b3842 SPARK-2534 Fills Form seems to always have SOD orders in there 2019-09-22 15:06:03 -05:00
John Colvin f21902d60d remove unused files AdminModelWrapper/PermissionFilter.cs 2019-09-22 14:46:52 -05:00
John Colvin a27f383b62 remove LoginContainer MEF Export consts (replace usages with UserTuple) 2019-09-22 12:58:46 -05:00
John Colvin 35d4fcc513 make UserTuple public (it's referenced in multiple assemblies) 2019-09-22 12:58:46 -05:00
John Colvin 8a96b00f64 add 'User' column to Synthetic Management window 2019-09-22 12:58:46 -05:00
John Colvin 2d06fd3d92 [non-functional] style cop/whitespace changes to SyntheticManagementDialogVM.cs 2019-09-22 12:58:45 -05:00
John Colvin 76050e0722 SyntheticManagement vm uses 'DataGridFilterHelper.hook_all' method to eliminate risk of omitting column filters 2019-09-22 12:58:45 -05:00
John Colvin a3f0c2fbf6 pass UserTuple to SyntheticManagement row (for imminent user column), remove dependency on securitymd 2019-09-22 12:58:45 -05:00
John Colvin 1ccc4c3746 add 'ShowLadderAutoLookupTag' to eschew securitymd depependency 2019-09-22 12:58:45 -05:00
John Colvin e5d85db888 SP-151 BTS user can view/edit all synths/algos 2019-09-22 12:11:15 -05:00
John Colvin e47b1c3048 [non-functional] style cop/whitespace changes in MDSource/Daemon.cs 2019-09-22 12:11:15 -05:00
John Colvin 039791a296 simplify AdminModel, api 'permission filters' use new UserTuple.Permissions enum 2019-09-22 12:11:15 -05:00
John Colvin e6884b6654 add 'Permissions' enum to UserTuple 2019-09-22 11:39:26 -05:00
John Colvin 8cbae28dd8 move UserTuple.cs into spark_api 2019-09-22 11:39:26 -05:00
John Colvin 010a1fecb1 remove unused function 'OrderFactory.subscribe_user_tuples' 2019-09-22 11:39:26 -05:00
Kevin Darby 96bec55ee7 fix build, we will have to handle these ice cpps someplace else 2019-09-20 15:01:56 -04:00
Kevin Darby 424bb36fc7 update jakes script for ice cpps 2019-09-20 14:30:27 -04:00
Kevin Darby c24700195f fixed cpp coming from market data for ice, added the obligatory overrides 2019-09-20 14:15:27 -04:00
Jake Norbut f7184b0949 updating tests 2019-09-20 09:13:01 -05:00
Eric Harding 999973c349 upgrade websocketpp 0.7.0 to 0.8.1 (externals) 2019-09-19 14:59:09 -04:00
Eric Harding 4663ae9e4d SP-236 Disable websocketpp open_handshake timeout 2019-09-19 14:38:00 -04:00
Kevin Darby 34fc6af137 fix mview test 2019-09-19 14:17:53 -04:00
Kevin Darby 6cc25a7337 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-19 13:56:32 -04:00
Kevin Darby 48b62f1cab new externals 2019-09-19 13:40:01 -04:00
Kevin Darby 5a0ceafa66 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-19 13:28:31 -04:00
Kevin Darby d31969606e Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-19 13:27:52 -04:00
John Colvin d7d170f228 SP-181 Remove the option to enter manual fills of spreads 2019-09-19 11:23:36 -05:00
Taha Afzal cf977befd1 odds and ends 2019-09-18 17:22:09 -04:00
Eric Harding 1d538b4cb0 Code review feedback. Checked DeleteValue 2019-09-18 17:04:38 -04:00
Pedro Pinto b42febdf60 Documented OrderMatcher better. 2019-09-18 16:11:16 -04:00
Eric Harding 71915de4b0 sparkcmd CaseInsensitiveEnumValues 2019-09-18 15:47:53 -04:00
Kevin Darby facb3249d0 Merge branch 'minimal_api_tests' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-18 15:24:51 -04:00
Kevin Darby f323efc61a Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-18 15:24:14 -04:00
Eric Harding be5f54326e sparkcmd test should always respect test type (unit/system) 2019-09-18 15:16:28 -04:00
Michael Harding 65cf042639 Merge branch 'system-tests' into ice_exec3 2019-09-18 13:45:26 -04:00
Michael Harding 57526a5df5 merge system-tests into ice_exec3 2019-09-18 13:12:38 -04:00
Michael Harding 7d26ff641e more ports 2019-09-18 12:20:26 -04:00
Michael Harding a8ffe3a6ec logging ports 2019-09-18 11:20:13 -04:00
Michael Harding bda135c435 Add more logging to system tests 2019-09-18 10:12:40 -04:00
Taha Afzal c9b2ac290c payup logic implemented 2019-09-17 22:10:53 -04:00
Kevin Darby 0fa97aeb56 added a service call to clear the auth sessions list in case of keycode trouble 2019-09-17 16:43:24 -04:00
Kevin Darby d1422ddc58 fix auth tests 2019-09-17 16:36:16 -04:00
Taha Afzal 340d65a47c Merge branch 'master' into pyramid 2019-09-17 16:32:53 -04:00
Kevin Darby 51ffa7e7f7 set_mic for synthetics 2019-09-17 16:15:17 -04:00
Kevin Darby 2a89c3721b Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-17 15:20:57 -04:00
Kevin Darby 0156bbfc46 fix id corner case 2019-09-17 15:06:04 -04:00
Taha Afzal f89fb76cb2 Merge branch 'master' into SP-232 2019-09-17 14:11:26 -04:00
Taha Afzal 16adb9ee18 Fixing SP-232 2019-09-17 14:09:34 -04:00
Michael Harding ffd1835218 Manual: Add icons, hover heading links 2019-09-17 11:07:06 -04:00
BTS 18af3dce74 manual: make images floatable 2019-09-16 17:46:59 -04:00
Eric Harding 154a637ee1 Merge branch 'master' of bitbucket.org:bluetradesys/spark into SP-229-shell-crash-dumps 2019-09-16 17:34:36 -04:00
BTS 88c42ee6bd Manual: fixes for High DPI and icon short code 2019-09-16 17:13:26 -04:00
Kevin Darby 8b583fcbec Merge branch 'fix_server_bounce' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-16 17:11:00 -04:00
Kevin Darby 48dfded132 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-16 17:09:52 -04:00
Kevin Darby baaa3c4f98 Fixed case where a non-super user shell denied market data after bring left up through a server restart 2019-09-16 16:28:53 -04:00
Kevin Darby 838550d78a entitlements are tricky 2019-09-16 16:15:38 -04:00
Kevin Darby bf8323e79b fixed ice entitlements 2019-09-16 15:53:50 -04:00
Eric Harding 399e4bf654 SP-229 Detect unclean shell shutdown and automatically upload an error report 2019-09-16 13:48:12 -04:00
Eric Harding 5908b4478e Error reports should be logged on the client 2019-09-16 13:20:03 -04:00
Kevin Darby e6ab7d825a fix fs build 2019-09-16 11:15:56 -04:00
Kevin Darby c78e6e8315 rather large master -> ice merge 2019-09-16 10:43:19 -04:00
Eric Harding 44571a5af5 spark shell should dispose daemons 2019-09-16 10:41:58 -04:00
BTS ba61d5de76 Add image shorttags in the manual 2019-09-13 19:48:10 -04:00
BTS ffbdd81a9e Add Youtube lightbox to manual 2019-09-13 14:57:24 -04:00
Michael Harding 66f58e1d4b Add meta description to Manual 2019-09-13 10:14:19 -04:00
Eric Harding 62274f5129 Append windows event log and crash dumps to error reports 2019-09-12 17:18:47 -04:00
Eric Harding b5b5101faf SP-229 Allow ErrorReportService to accept an arbitrary list of files 2019-09-12 17:17:57 -04:00
Eric Harding bb232d8f1e Add easy convert to immutable function c# 2019-09-12 17:17:15 -04:00
Taha Afzal 1b3f5bc8a6 Fixed a bug with reporting 2019-09-11 13:44:37 -04:00
Taha Afzal 1b767f6e5e Cleaning up 2019-09-09 18:03:07 -04:00
Taha Afzal fe647044f8 Adding comments to SpreaderUtils 2019-09-09 15:03:52 -04:00
John Colvin aaca502500 add dispatcher thread name to assert log 2019-09-09 11:42:11 -05:00
Kevin Darby 7d2695e602 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-09-06 11:46:40 -04:00
Taha Afzal 69dcfdb2bd Delete parameter added 2019-09-03 16:57:41 -04:00
Taha Afzal e179f7e5a4 Some error handling (originating the algo from the wrong top spread) 2019-08-28 12:27:36 -04:00
Taha Afzal dba3747d98 Need more robust error checking, functionality works 2019-08-28 11:17:33 -04:00
Taha Afzal 3e7627ac24 Almost done, need to hook up hedging (cover) and parameter change 2019-08-24 13:08:26 -04:00
Taha Afzal 1b043f77cb Basic scaffolding in place for pyramid algo, shows up in the UI 2019-08-22 11:01:42 -04:00
Eric Harding 14cbd4a174 ICE: make settlement price conditional on onMarketSnapshot 2019-08-19 16:30:37 -04:00
Kevin Darby cc3353e243 messed up the externals 2019-08-14 15:42:16 -04:00
Kevin Darby 683b85c66b subrepos 2019-08-14 15:25:27 -04:00
Kevin Darby 789710d841 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-08-14 15:25:19 -04:00
Kevin Darby 1a9ff09f43 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-08-08 16:58:31 -04:00
Michael Harding 13b09ffc12 add 3 minute delay to system tests 2019-08-07 10:42:41 -04:00
Kevin Darby 83a2a01789 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-08-06 12:06:46 -04:00
Kevin Darby e1137c4e1d go back to statically linked CME 2019-08-06 11:27:38 -04:00
Kevin Darby 0a6cc0cdf1 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-08-01 15:11:04 -04:00
Kevin Darby e96d9112ef SIMICE causing some trouble sharing replay and MBO 2019-08-01 14:25:17 -04:00
Kevin Darby 72aa028bd6 ice orders works again 2019-07-04 14:31:57 -04:00
Kevin Darby f8d5b9bace bookmark initial clordid 2019-07-03 18:20:11 -04:00
Kevin Darby e861e2916f Merge branch 'ice_exec3' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-07-03 17:28:03 -04:00
Kevin Darby 23738b109d changes to use non-static onixs 2019-07-03 17:26:46 -04:00
Pedro Pinto 713e11d146 Merge branch 'ice_exec3' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-07-03 16:26:34 -04:00
Pedro Pinto 444e3154b3 Made exchange id gen asynchronous, improved concurrency. 2019-07-03 16:26:07 -04:00
Kevin Darby 270ee60df9 nonstatic cme 2019-07-03 19:39:22 +00:00
Kevin Darby 1ce041c5e5 called Pedro's new id generator 2019-07-03 15:23:38 -04:00
Pedro Pinto 50940bfd13 Merged 2019-07-03 13:46:48 -04:00
Pedro Pinto 8cb4151f63 Added id generator to order services. 2019-06-30 20:27:48 -04:00
Kevin Darby 7a47b7a85a Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-06-28 13:08:44 -04:00
Pedro Pinto a60a792dfa Ran clang-format. 2019-06-27 14:17:08 -04:00
Pedro Pinto a73a1cc4f5 CMakeDeps updates. 2019-06-27 14:16:05 -04:00
Pedro Pinto 32fbdf8a21 Better handling of unresolved securities. 2019-06-27 14:15:40 -04:00
Pedro Pinto 75c54bbe3e Refactored order factory. 2019-06-27 14:11:40 -04:00
Pedro Pinto 38575039b9 Fixed clang build. 2019-06-27 14:11:23 -04:00
Kevin Darby 43a49b9399 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-06-10 10:40:56 -04:00
Kevin Darby 618c41ce97 synthesized Pedro's cme changes for ice 2019-06-07 17:49:33 -04:00
Kevin Darby bd8c9c354b Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-06-07 17:49:11 -04:00
Kevin Darby 8f5d062a3b Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-05-21 16:58:35 -04:00
Kevin Darby e1a3950051 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-05-20 17:04:53 -04:00
Kevin Darby 7e816c1503 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-05-16 17:56:07 -04:00
Kevin Darby 15d9afb2de added a comment about ice reverse_routing_record 2019-05-16 15:26:21 -04:00
Kevin Darby b5468e5565 changes for ice certification perf testing and to recover an order from an exec report 2019-05-16 15:02:04 -04:00
Kevin Darby a4c3a61f13 fixed ice specific bug with attach detach 2019-05-14 17:55:52 -04:00
Kevin Darby 7ce101f7f7 messed up docker linux pointer 2019-05-14 16:41:49 -04:00
Kevin Darby b61cab397d Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-05-14 16:36:12 -04:00
Kevin Darby 222e1a51dc fixed SOD time for dev
fixed bugs in mview when settle/last/low/high change without a bid or offer changing
2019-05-14 15:50:53 -04:00
Kevin Darby 9fa3464188 ice busts and corrects, ugh... 2019-05-14 09:55:05 -04:00
Kevin Darby fee695d3d9 Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-05-13 16:02:56 -04:00
Kevin Darby 140f1d88ea ice entitlements 2019-05-05 16:41:13 -04:00
Kevin Darby c4eeaf2ec8 this should do it for bust / adjust 2019-05-03 16:28:37 -04:00
Kevin Darby 54dd30245f Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-05-03 15:54:07 -04:00
Kevin Darby 263ff63a37 added concept of active and busted fill to support ice busts 2019-05-03 15:31:23 -04:00
Kevin Darby f3d16502de going a new way on the busts 2019-05-03 13:39:35 -04:00
Kevin Darby 4b7db298c4 something up with settlement re-price 2019-05-03 10:39:54 -04:00
Kevin Darby 65f41452fb work around onixs assert for us financials that does not have an implieds feed 2019-05-02 18:33:54 -04:00
Kevin Darby d7a2ae4b09 added spread marker to last trade display....lotta code for an S 2019-05-02 17:55:46 -04:00
Kevin Darby 61ac626542 ice wants tag 1031 2019-05-02 12:36:14 -04:00
Michael Harding 8d7a2f342e Add Custom Order Instructions 2019-05-02 12:14:50 -04:00
Kevin Darby 0db037175f fixed ice forced logout issue 2019-05-02 12:07:09 -04:00
Kevin Darby 98aa463b4e Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-05-02 11:51:28 -04:00
Kevin Darby 0b40d3971d lining up with ice downtime 2019-05-01 14:05:02 -04:00
Kevin Darby a21a769909 cleaned up todos 2019-04-30 17:43:23 -04:00
Kevin Darby ca8e540453 volume is tricky 2019-04-30 15:09:53 -04:00
Kevin Darby 134950747f bugs found during cert 2019-04-30 14:36:54 -04:00
Kevin Darby 5abc17adf3 settles 2019-04-29 17:58:53 -04:00
Kevin Darby f3cd3a402e ice spread config, workaround for onixs bug 2019-04-29 16:53:50 -04:00
Kevin Darby c7217b8475 Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-29 16:47:26 -04:00
Kevin Darby 99c5129ea7 ice spreads are weird 2019-04-29 16:25:54 -04:00
Kevin Darby d025ee0c89 seems to be an onixs bug that exits a loop early if not provisioned for a market_type 2019-04-29 15:09:56 -04:00
Kevin Darby c24ddaa190 Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-29 10:21:39 -04:00
Kevin Darby 442aa156ac trying to get orance juice market 2019-04-29 10:20:27 -04:00
Kevin Darby e906d41cc2 Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-26 14:48:20 -04:00
Kevin Darby 6e09d9e949 small changes for ice cert 2019-04-26 14:35:36 -04:00
Kevin Darby aea02e212a cleaned up cancel / reject messages 2019-04-25 16:36:07 -04:00
Kevin Darby a94a66234a ice puids 2019-04-25 15:57:04 -04:00
Kevin Darby 4cbbf6972a add, update, remove orders work across logouts 2019-04-25 15:25:07 -04:00
Kevin Darby caa9671c96 ids... 2019-04-24 18:37:45 -04:00
Kevin Darby 20eb3ed39d matched Pedro's ICE deferred cancel / update for ice 2019-04-24 14:07:21 -04:00
Kevin Darby 772a898433 Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-24 14:07:09 -04:00
Kevin Darby b5997d326e f# 64 bit ints, maybe 2019-04-23 18:22:44 -04:00
Kevin Darby f8626f81cd throwing this back to michael for int64 2019-04-23 18:14:14 -04:00
Kevin Darby bc208d2421 Merge branch 'ice_exec3' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-23 17:22:26 -04:00
Kevin Darby 625ebcc762 got a fill 2019-04-23 17:21:52 -04:00
Michael Harding 0a163badf0 SPARK-2289: Add MIFID fields to Spark Admin 2019-04-23 15:45:11 -04:00
Kevin Darby dea95455a0 Merge branch 'ice_exec3' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-23 13:28:45 -04:00
Kevin Darby f0f5988abf almost sending orders 2019-04-23 13:27:50 -04:00
Michael Harding db5f16985c SPARK-2289: Remove IFUnset from ICEMics 2019-04-23 11:00:38 -04:00
Michael Harding f0105867be SPARK-2289: Implement Eric's Map suggestion 2019-04-23 10:03:58 -04:00
Michael Harding 2c0b314428 SPARK-2289: Additional ICE fields 2019-04-23 10:03:12 -04:00
Kevin Darby 3cd74f33f1 changed trader login per Pedro 2019-04-22 16:51:28 -04:00
Kevin Darby a6ee36f4bc typo 2019-04-22 15:16:12 -04:00
Kevin Darby 9cadf635fb Merge branch 'ice_exec3' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-22 14:42:10 -04:00
Kevin Darby 43e043b044 more ice 2019-04-22 14:41:39 -04:00
Michael Harding 6bac75d7ab SPARK-2289: Add ICE to Accounts in Spark Admin 2019-04-22 10:58:26 -04:00
Michael Harding 7ceb170c5f SPARK-2289: Add ICE User data to Spark Admin 2019-04-22 10:36:35 -04:00
Kevin Darby 47c7ee71b4 Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-18 17:46:34 -04:00
Kevin Darby 4f58452771 stop using legacy spread 2019-04-17 18:14:00 -04:00
Kevin Darby d5bf15cc36 ice secondary login 2019-04-17 17:12:25 -04:00
Kevin Darby 9736541385 logon rejected; we're going places 2019-04-16 15:59:45 -04:00
Kevin Darby 5591c8316d about to send a login message 2019-04-16 13:18:39 -04:00
Kevin Darby a44d3a2c26 Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-15 13:22:42 -04:00
Kevin Darby dceb300324 Merge branch 'SPARK-2241-add-support-for-multi-char-me' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-15 13:20:56 -04:00
Pedro Pinto 84b9ca3096 Added jetfix suppport for multi char message types. 2019-04-08 17:07:40 -04:00
Pedro Pinto 17e9f1ea96 Ran clang-format. 2019-04-08 13:43:20 -04:00
Kevin Darby 946ec36840 Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-06 22:18:21 -04:00
Kevin Darby 11425a898f honing in on simice 2019-04-05 17:58:28 -04:00
Kevin Darby d0029e7f88 sim doesn't crash, but doesn't give exec reports either 2019-04-05 17:39:04 -04:00
Kevin Darby bdbdda947f Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-05 15:51:51 -04:00
Kevin Darby f88ab57fa0 got the basic structure down, still waiting on ICE for a few things 2019-04-05 15:49:37 -04:00
Kevin Darby 36442a037e more ice 2019-04-03 17:12:52 -04:00
Kevin Darby 5969568dee ice native order 2019-04-02 17:36:12 -04:00
Kevin Darby 96265ea187 Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-02 17:34:54 -04:00
Kevin Darby 9676b1fdca Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec3 2019-04-02 16:21:51 -04:00
Kevin Darby 556132c2dd ice exec moving along 2019-04-01 18:11:48 -04:00
Kevin Darby a22b7b7189 more ice 2019-03-29 16:52:50 -04:00
Kevin Darby 8e41a42ced more ice 2019-03-28 16:18:10 -04:00
Kevin Darby e0f7bdfc13 fix conf 2019-03-27 17:42:23 -04:00
Kevin Darby ec0b96215f Merge branch 'SPARK-1944-attach/detach/update' of bitbucket.org:bluetradesys/spark into ice_exec 2019-03-27 17:29:32 -04:00
Kevin Darby e27a8be526 ICEExecutionGateway 2019-03-27 17:01:07 -04:00
Kevin Darby 70cd9f185e Merge branch 'ice_md' of bitbucket.org:bluetradesys/spark into ice_exec 2019-03-26 18:44:16 -04:00
Kevin Darby 33eaf6f86d beginnings of ICE exec and SIMICE 2019-03-26 18:38:05 -04:00
307 changed files with 9247 additions and 2384 deletions

No files matched your search

@@ -3,6 +3,10 @@ title = "Glossary of Terms"
weight = 9
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "Definitions of common terms used in BTS Spark and this manual"
+++
+7 -7
View File
@@ -3,12 +3,12 @@ title = "Help"
weight = 3
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "Report a problem or find the activity log from the Help module in BTS Spark"
+++
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/yGQfr_puT3w" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="yGQfr_puT3w") }}
## Report a Problem
If there is any issue at all, you can click here
@@ -18,14 +18,14 @@ insert_anchor_links = "right"
send, BTS will get an alert of everything you submitted and will be
in contact with you shortly.
![](image58.png)
{{ image(name="image58.png", alt="screenshot") }}
## About Spark
Upon launching this, you will see an info window
which will list what version you are running as well as who is
currently logged in.
![](about_spark.png)
{{ image(name="about_spark.png", alt="screenshot") }}
## Activity log
This is an overall log viewer which will show
@@ -34,4 +34,4 @@ insert_anchor_links = "right"
messages in a text box in the right top corner.
 
![](image39.png)
{{ image(name="image39.png", alt="screenshot") }}
@@ -1,15 +1,15 @@
+++
title = "Module Launcher"
title = "Launcher"
weight = 2
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "The basics of the BTS Spark launcher and user interface"
+++
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/OxVqQBKFIDw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="OxVqQBKFIDw") }}
- The module launcher is the first item that will come up after
logging in to Spark.
@@ -18,7 +18,7 @@ insert_anchor_links = "right"
each module
- It appears like the following:
![](image38.png)
{{ image(name="image38.png", alt="screenshot") }}
- If you right-click anywhere on the launcher you can modify
various display settings including:
@@ -29,7 +29,7 @@ insert_anchor_links = "right"
- Ability to exit the front end, this can also be done by simply clicking the “X” on the top right of this window or by clicking on exit from this options window
- These options are all displayed like the following:
![](image68.png)
{{ image(name="image68.png", alt="screenshot") }}
## Spark User interface
@@ -3,17 +3,21 @@ title = "Logging in to the system"
weight = 1
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "How to log into BTS Spark"
+++
The shortcut icon will appear on your desktop like below:
![](image64.png)
{{ image(name="image64.png", alt="BTS icon") }}
Simply double click or single click and hit enter to launch the
login screen:
![](image3.png)
{{ image(name="image3.png", alt="login screen") }}
Choose your username from the drop down, choose your initial
workspace, enter your password, and click Login
+20 -22
View File
@@ -3,22 +3,22 @@ title = "Market"
weight = 4
sort_by = "weight"
insert_anchor_links = "right"
+++
[extra]
page_description = "The BTS Spark Market module contains the Market View and Time and Sales windows"
+++
- This is one of the main items on the module launcher
- When hovering over it, it will show 2 different modules which can
be launched from it, market view and then, time and sales
- It appears like the below:
![](image53.png)
{{ image(name="image53.png", alt="screenshot") }}
## Market View
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Y54S1uscT_g" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="Y54S1uscT_g") }}
- This provides a grid of outright, spread, and synthetic products
showing real-time market data all in one place
@@ -29,7 +29,7 @@ insert_anchor_links = "right"
- You choose which products you would like to view upon launching it,
the security browser will appear as shown below:
![](image21.png)
{{ image(name="image21.png", alt="security picker") }}
- Click on individual securities that you wish to view and click add,
they will then show up in the selected securities window below.  If
@@ -45,13 +45,13 @@ insert_anchor_links = "right"
- Below is an example of an outright, spread, all futures, and
synthetic chosen:
![](image14.png)
{{ image(name="image14.png", alt="screenshot") }}
- Clicking OK will bring up the Market View with the selected
securities you have chosen, in this example, it appears like the
following:
![](market_view.png)
{{ image(name="market_view.png", alt="screenshot") }}
- Once a market view is launched and you are viewing data, you can
customize the view further by the following:
@@ -61,19 +61,19 @@ insert_anchor_links = "right"
- Filtering - by hovering over the column header, a filtering box
will appear like below:
![](image66.png)
{{ image(name="image66.png", alt="screenshot") }}
- All columns let you sort by that columns minimum and maximum
information in a box that appears like the following:
![](image24.png)
{{ image(name="image24.png", alt="screenshot") }}
- Specifically for the securities column, there is a search box that
will appear by bringing up the filtering box, which enables users to
type the security in which they are looking for.  This appears like
the following:
![](image11.png)
{{ image(name="image11.png", alt="screenshot") }}
- Besides viewing the market data, you can do a lot within the market
view by utilizing the icons to the left of the main window, these
@@ -88,7 +88,7 @@ insert_anchor_links = "right"
- Change securities
- Click on the settings icon ![](change_securities.png) which will launch the market view security selection.  You can add or remove Securities you have already selected and are shown in the market view.
- Click on the settings icon {{ image(name="change_securities.png", alt="screenshot") }} which will launch the market view security selection.  You can add or remove Securities you have already selected and are shown in the market view.
- Launch an order ticket
- This is done 1 of 3 ways:
@@ -96,7 +96,7 @@ insert_anchor_links = "right"
or Ask Qty which will bring up an order ticket pre-populated with
either the Bid or Ask price and volume.
- Highlighting a single security and clicking on the order ticket
![](image23.png) icon
{{ image(name="image23.png", alt="screenshot") }} icon
on the left-hand browser window of the market view
- Highlighting a single security and right clicking bringing up the
menu options to launch an order ticket.
@@ -121,7 +121,7 @@ insert_anchor_links = "right"
- This is done by either highlighting 1 or many securities and then
clicking on the Fills icon
![](image20.png) on
{{ image(name="image20.png", alt="screenshot") }} on
the left-hand side to bring up a fill window for the selected
securities.  
@@ -132,14 +132,14 @@ insert_anchor_links = "right"
- This is accomplished by highlighting 1 or many securities and then
clicking on the time and sales icon
![](image49.png) on
{{ image(name="image49.png", alt="screenshot") }} on
the left-hand side
- Launching the synthetic window to create a synthetic product
- This is accomplished by highlighting either 1 or 2 securities and
clicking on the Synthetic icon
![](image34.png) on
{{ image(name="image34.png", alt="screenshot") }} on
the lower left-hand side
- Please note - If only 1 security is chosen, a create synthetic
@@ -148,9 +148,7 @@ insert_anchor_links = "right"
## Time and Sales
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/nEkSGacjt0s" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="nEkSGacjt0s") }}
- Provides a display of real-time fills as they happen for 1 or many
securities
@@ -161,9 +159,9 @@ insert_anchor_links = "right"
- On launching a security browser will appear, allowing you to choose
the products you would like to view.
![](time_and_sales.png)
{{ image(name="time_and_sales.png", alt="screenshot") }}
- From time and sales, you can launch the same items as the market
view with the exception of a launching the synthetic window to
create a synthetic product
- From the settings icon ![](settings_icon.png) you can customize the time and sales modifying grid; the colors of the aggressor, status of trades coming in, as well as font sizes and which columns to see.
- From the settings icon {{ image(name="settings_icon.png", alt="screenshot") }} you can customize the time and sales modifying grid; the colors of the aggressor, status of trades coming in, as well as font sizes and which columns to see.
@@ -3,13 +3,13 @@ title = "My Windows"
weight = 7
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "Name and load windows with the My Windows module in BTS Spark"
+++
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/pjm1JJ9Q3jM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="pjm1JJ9Q3jM") }}
This is the housing of the windows that you have manually named and
creates a place where you can quickly and easily launch windows
@@ -20,18 +20,18 @@ click on any tab and the “Add to My Windows” menu will appear.  If you
click on Add to My Windows, it will give you the ability to type in a
text box on the tab itself.
![](image16.png)
{{ image(name="image16.png", alt="screenshot") }}
Once you have named the tab, click enter to get out of the editing view
of the text box.  Once that is done, it will display that name for that
tab moving forward, which will be displayed within the My Windows
section of the module launcher.
![](image15.png)
{{ image(name="image15.png", alt="screenshot") }}
Right-clicking on a tab that has already had its default title modified
will show the following which will allow you to rename the modified
title or remove it from the My Windows, which will then restore the
default standard title.
![](image37.png)
{{ image(name="image37.png", alt="screenshot") }}
@@ -3,12 +3,13 @@ title = "Settings"
weight = 8
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "The BTS Spark Settings module and workspaces management"
+++
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/yGQfr_puT3w" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="yGQfr_puT3w") }}
## Workspaces
@@ -16,7 +17,7 @@ This is where your workspaces can be saved or switched
to pre-saved ones that you have created.  If you click on the
Settings module, the Workspaces
![](image9.png)
{{ image(name="image9.png", alt="screenshot") }}
Once the Workspace menu is launched you can save your current workspace
by typing in a name in the text box and clicking save.  This will save
@@ -26,4 +27,4 @@ switching to it from the workspace launcher later on.
You can also delete workspaces by clicking on the “X” to the right of
the saved workspace from the workspace menu.
![](image51.png)
{{ image(name="image51.png", alt="screenshot") }}
+27 -43
View File
@@ -3,47 +3,33 @@ title = "Spreader"
weight = 6
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "How to create and edit synthetic spreads in BTS Spark's spreader"
+++
{{ youtube(id="RZU9Wj0cETo") }}
{{ youtube(id="XEZpuPAgMC0") }}
{{ youtube(id="EVFK2yNQFS4") }}
{{ youtube(id="d5ywlHen6yo") }}
{{ youtube(id="Mmw8PNJA0Dw") }}
{{ youtube(id="QK-bBSH6Rc0") }}
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/XEZpuPAgMC0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/EVFK2yNQFS4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/d5ywlHen6yo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Mmw8PNJA0Dw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/QK-bBSH6Rc0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
- Launching the spreader from the module launcher will bring up the
- Launching the spreader from the launcher will bring up the
synthetic management browser which appears like below:
![](image35.png)
{{ image(name="image35.png", alt="screenshot") }}
- From this window, it will show any synthetics that you have already
created as well as various other options of both managing the
synthetics and other tasks all from the left-hand side pane within
the window, including:
- Adding a new synthetic ![](image8.png)
- Removing a synthetic ![](image13.png)
- Changing a synthetic ![](image55.png)
- Cloning a synthetic ![](image28.png)
- Launching a ladder of a highlighted synthetic ![](image7.png)
- Launching an order book of selected synthetic ![](image43.png)
- Adding a new synthetic {{ image(name="image8.png", alt="screenshot") }}
- Removing a synthetic {{ image(name="image13.png", alt="screenshot") }}
- Changing a synthetic {{ image(name="image55.png", alt="screenshot") }}
- Cloning a synthetic {{ image(name="image28.png", alt="screenshot") }}
- Launching a ladder of a highlighted synthetic {{ image(name="image7.png", alt="screenshot") }}
- Launching an order book of selected synthetic {{ image(name="image43.png", alt="screenshot") }}
@@ -63,7 +49,7 @@ insert_anchor_links = "right"
- An empty synthetic browser will look like below without any legs
chosen:
![](image31.png)
{{ image(name="image31.png", alt="screenshot") }}
- Clicking on Add Leg on the top right of the window will launch the
security browser, which will allow you to choose the first leg
@@ -77,13 +63,13 @@ insert_anchor_links = "right"
name your synthetic product.  By default, it will auto-populate
based on the symbols you have chosen:
![](image29.png)
{{ image(name="image29.png", alt="screenshot") }}
- You can click into the text box to the right of the name and
customize the name to be whatever you would like, we’ll call this
ES\_CAL:
![](image19.png)
{{ image(name="image19.png", alt="screenshot") }}
- Also included on this row are what ticks you would like this to be
priced in as well as the format of the pricing
@@ -92,7 +78,7 @@ insert_anchor_links = "right"
as the option to add additional legs through the add leg box to the
right of the symbols:
![](image18.png)
{{ image(name="image18.png", alt="screenshot") }}
- The following rows are all part of the main parameters which can
all be modified according to the traders style of designing the
@@ -104,14 +90,14 @@ insert_anchor_links = "right"
details of how that parameter functions.  Below is an example of the
throttle details displayed:
![](image56.png)
{{ image(name="image56.png", alt="screenshot") }}
- Main parameters - these are the top 4 rows in the Create Synthetic
window which all synthetics will be required to have set.
 Everything below these can be customized to a trader's needs, however, the top 4 are the main foundational aspects used for the calculation of
the synthetic:
![](image10.png)
{{ image(name="image10.png", alt="screenshot") }}
- Quantity - This is the number of contracts of the security you
would like to be included in the calculation of the synthetic as
@@ -139,7 +125,7 @@ insert_anchor_links = "right"
displayed and click on such will display further details on how this
parameter is used:
![](image72.png)
{{ image(name="image72.png", alt="screenshot") }}
- Quote
@@ -148,20 +134,20 @@ insert_anchor_links = "right"
by defining a region on either side of the working quote order,
inside which quote updates will not be sent:
![](image6.png)
{{ image(name="image6.png", alt="screenshot") }}
- Pre-Hedge
- Pay Less - If enabled by checking the checkbox, the spreader will
attempt to pay less when the quantity at the level of the calculated
hedge price is more than the threshold defined.  The hedge order is
hedge price is less than the threshold defined.  The hedge order is
paid less by the “Payless Ticks” as defined per leg.
- Pay Up - If enabled by checking the checkbox, the spreader will pay
up when the quantity at the level of the calculated hedge price is
more than the threshold defined.  The hedge order will pay up by the
“Payup Ticks” as defined per leg.
![](image54.png)
{{ image(name="image54.png", alt="screenshot") }}
- Post-Hedge
@@ -172,7 +158,7 @@ insert_anchor_links = "right"
opposite inside market, it is re-priced to cross the opposite inside
market as defined by “cross ticks”
![](image70.png)
{{ image(name="image70.png", alt="screenshot") }}
- Time Based Cross - Basically the same as Ticks Away Cross,
however, this is based on time (in ms) on when to automatically cross
@@ -181,7 +167,7 @@ insert_anchor_links = "right"
away from the opposite inside market, it is re-priced to cross the
opposite inside market as defined by “cross ticks”
![](image40.png)
{{ image(name="image40.png", alt="screenshot") }}
- Size Based Cross - similar to ticks and time based cross, but based
on size instead.  If you define a threshold of the opposite inside
@@ -189,5 +175,3 @@ insert_anchor_links = "right"
the market.  If a legged hedge order’s price gets X amount of
“ticks” away from the opposite inside market, it is re-priced to
cross the opposite inside market as defined by “cross ticks”
![](image76.png)
@@ -4,6 +4,10 @@ weight = 1
sort_by = "weight"
insert_anchor_links = "right"
aliases = ["./bts_spark/Algos/"]
[extra]
page_description = "Definitions of the Algos built into BTS Spark and their parameters"
+++
## Lean
+53 -62
View File
@@ -3,6 +3,9 @@ title = "Trading"
weight = 5
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "BTS Spark's Trading module, including The Order Book, Fills, P&amp;L, Ladder, Order Ticket, and Algo Studio"
+++
@@ -10,13 +13,11 @@ insert_anchor_links = "right"
Order Book, Fills, P&L, Ladder, and Order Ticket
- It appears like below:
![](image44.png)
{{ image( name = "image44.png", alt = "screenshot") }}
## Order Book
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ygMFkjBBGeU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="ygMFkjBBGeU") }}
- This provides a list of all orders a user has placed, by default it
will display only working orders
@@ -26,7 +27,7 @@ insert_anchor_links = "right"
other windows within BTS
- Appears like the following:
![](image5.png)
{{ lightbox( name = "image5.png", alt = "screenshot") }}
- You can sort all columns by single left clicking on the column
header which will sort in either descending or ascending order, an
@@ -34,14 +35,14 @@ insert_anchor_links = "right"
 Below is a display of the security column sorting in descending
fashion.
![](image60.png)
{{ image( name = "image60.png", alt = "screenshot") }}
- Filtering can occur, by hovering over any column header which will
display a “Filter” box.  Clicking on this will then display the
available components which can be filtered, below is an example of
clicking on the securities column
![](image52.png)
{{ image( name = "image52.png", alt = "screenshot") }}
- If the column is displaying time base information, a special style
box will appear when clicking on the filtering box providing more
@@ -53,49 +54,45 @@ insert_anchor_links = "right"
- Since Open
- A specific user-defined period of time
![](image25.png)
{{ image( name = "image25.png", alt = "screenshot") }}
- The left-hand box within an order book provides users with further
functionality to quickly perform various tasks with live orders as
well as launch other modules.  It appears like the below:
well as launch other modules.
{{ image(name="spark_menu_order_book.png", alt="the spark menu in the order book", pull="right") }}
![](spark_menu_order_book.png)
- ![](image48.png)Fills -
- {{ icon(name="image48.png", alt="Fills icon") }} Fills -
clicking on this will launch a fills window
- ![](image57.png) Modify -
- {{ icon(name="image57.png", alt = "modify icon") }} Modify -
clicking on this will launch an order ticket for a live order
highlighted in the Order Book.
- ![](image73.png)Cancel
- {{ icon(name="image73.png", alt = "cancel selected icon")}} Cancel
selected - clicking on this will cancel the selected orders you have
highlighted in the order book.  You can choose more than one by
holding hold the Ctrl key when clicking on each row of orders
- ![](image74.png)Cancel
- {{ icon(name="image74.png", alt = "cancel buys icon")}} Cancel
buys - clicking on this will cancel all the buy orders you have in
the order book
- ![](image33.png)Cancel
- {{ icon(name="image33.png", alt = "cancel all icon")}} Cancel
sells - clicking on this will cancel all the sell orders you have in
the order book
- ![](image2.png)Cancel
- {{ icon(name="image2.png", alt = "cancel all icon")}} Cancel
all - clicking on this will cancel all working orders you have the
order book
- ![](recreate_icon.png) Recreate - clicking this will recreate already cancelled orders, sending them back to market with the same price and quantity as they were previously at before being cancelled.
- ![](collapse_all_icon.png) Collapse all - This will collapse all trees inside the order book to show only the top level of the order.
- ![](expand_all_icon.png) Expand all - This will expand to show everything inside the order book.
- ![](settings_icon.png) Settings - This launches the settings for the orderbook.
- Furthermore, there is a “floating” or “mini orderbook” feature as well
integrated within the ladder itself.
- To access this, you need to center click with your mouse wheel over
working orders on the ladder.
- From here, you can change the price and quantity of any working order
within the mini orderbook straight from the window
- This looks like below:
![](mini_orderbook.png)
- {{ icon(name = "recreate_icon.png", alt = "screenshot") }} Recreate - clicking this will recreate already cancelled orders, sending them back to market with the same price and quantity as they were previously at before being cancelled.
- {{ image( name = "collapse_all_icon.png", alt = "screenshot") }} Collapse all - This will collapse all trees inside the order book to show only the top level of the order.
- {{ icon( name = "expand_all_icon.png", alt = "screenshot") }} Expand all - This will expand to show everything inside the order book.
- {{ icon( name = "settings_icon.png", alt = "screenshot") }} Settings - This launches the settings for the orderbook.
- The mini orderbook is integrated into the ladder
- Middle click (click the mouse wheel) on a working order to display the mini orderbook
- From here, you can change the price and quantity of any working order
{{ image( name = "mini_orderbook.png", alt = "screenshot") }}
## Fills
- This provides a list of all fills a user has had for a given time
period, by default it will open up with “since open” timeframe
period, by default it will open up with “since open” time frame
selected showing you fills on the day thus far
- You can create multiple fill windows, filtered however you
like
@@ -106,9 +103,7 @@ insert_anchor_links = "right"
## P&amp;L
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/xj6cEQ6By34" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="xj6cEQ6By34") }}
- This provides a running ledger of a users account(s) profit and
loss, broken down per symbol
@@ -125,20 +120,18 @@ insert_anchor_links = "right"
- This is accomplished on the top bar, which when clicked on, displays
the choices for calculation, this appears like below:
![](pnl_calculation.png)
{{ image( name = "pnl_calculation.png", alt = "screenshot") }}
- Below is an example P&L window showing a user’s multiple accounts and
various positions in each:
![](pnl_window.png)
{{ image( name = "pnl_window.png", alt = "screenshot") }}
## Ladder
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Q0qsyc1nvYo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="Q0qsyc1nvYo") }}
- The ladder was designed to be the most logically produced ladder on
the market, engineered and designed by professional traders for
@@ -149,12 +142,12 @@ insert_anchor_links = "right"
market with a single click
- Below is an example ladder:
![](ladder.png)
{{ image( name = "ladder.png", alt = "screenshot") }}
- The ladder consists of 2 major parts, the Ladder itself and the
information and control section on the left-hand side
- The information section on the left contains the following: &nbsp; ![](image1.png)
- The information section on the left contains the following: &nbsp; {{ image( name = "image1.png", alt = "screenshot") }}
- Day - showing the current price of the security on the day
- High - showing the high price of the security on the day
- Low - showing the low price of the security on the day
@@ -167,7 +160,7 @@ insert_anchor_links = "right"
- The control section right underneath the information section on the
left-hand side offers the following:
![](image62.png)
{{ image( name = "image62.png", alt = "screenshot") }}
- The account in which the orders will flow into when trading this
security
@@ -202,7 +195,7 @@ insert_anchor_links = "right"
the stop price, by clicking on the “&lt;” to bring up the stop price
option:
![](image61.png)
{{ image( name = "image61.png", alt = "screenshot") }}
- Iceberg
@@ -213,7 +206,7 @@ insert_anchor_links = "right"
quantity.  You will need to define what type of order that will
be used for the child order to be sent.
![](image47.png)
{{ image( name = "image47.png", alt = "screenshot") }}
- Time Box
@@ -233,9 +226,9 @@ insert_anchor_links = "right"
- Below are images of the type of time frame that can be used within
the time box
![](image42.png)
{{ image( name = "image42.png", alt = "screenshot") }}
         
![](image50.png)
{{ image( name = "image50.png", alt = "screenshot") }}
- Lean
- This is a specialized algo order which allows the user to
@@ -244,14 +237,14 @@ insert_anchor_links = "right"
- “Cross” means to take an order working on the bid and 'cross' by
buying into the asks.  This is often referred to as “paying up” as well
![](lean_algo_control.png)
{{ image( name = "lean_algo_control.png", alt = "screenshot") }}
- Join
- This is a specialized algo order which allows the user to enter an
order which will watch the opposite-inside market and join when the
market flips and has at least threshold size as defined.
![](join_algo_control.png)
{{ image( name = "join_algo_control.png", alt = "screenshot") }}
- Top
- This is a specialized algo order which allows the user to
@@ -259,14 +252,14 @@ insert_anchor_links = "right"
- If the order is on the market (current bid price) and the quantity
on that bid price is below the top threshold defined the order will
cancel and do nothing else
![](top_algo_control.png)
{{ image( name = "top_algo_control.png", alt = "screenshot") }}
- Offset
- The goal of the offset order is to send your order X amount of ticks
from where you actually place it on the ladder. This is sometimes
known as a "fat finger" safety.
![](offset_algo_control.png)
{{ image( name = "offset_algo_control.png", alt = "screenshot") }}
- OCO
@@ -276,26 +269,26 @@ insert_anchor_links = "right"
of the fill. Composing this order with Cover simulates scalping
functionality.
![](oco_algo_control.png)
{{ image( name = "oco_algo_control.png", alt = "screenshot") }}
- Cover
- A Cover order’s purpose is to fire a hedge order (of any algo-type) in response to fills from it’s child order on the opposite side of the market N ticks away.
![](cover_algo_control.png)
{{ image( name = "cover_algo_control.png", alt = "screenshot") }}
- Trigger
- The Trigger order is exactly as it sounds, where it will trigger an order based on conditions defined.
- This order also has exit strategy built in where a user can define when the trigger order can auto-cancel based on time as well as price conditional.
![](trigger_algo_control.png)
{{ image( name = "trigger_algo_control.png", alt = "screenshot") }}
- The middle of the control section is where you can click on
predefined values to quickly populate the volume at which you wish
to enter the market.
![](image17.png)
{{ image( name = "image17.png", alt = "screenshot") }}
- You can manually type in a quantity here as well
- Furthermore, if you have a value in the volume bar, you can
@@ -305,7 +298,7 @@ insert_anchor_links = "right"
- By having the auto clear box checked, it will bring the value back
to zero after placing an order at the size chosen.
![](image59.png)
{{ image( name = "image59.png", alt = "screenshot") }}
-  The bottom section of the control area of a ladder has 4 aspects
to it
@@ -317,7 +310,7 @@ insert_anchor_links = "right"
- Cancel All, which will cancel all orders on the ladder
- Settings, which will launch the ladder settings window which
appears like below
![](ladder_settings.png)
{{ image( name = "ladder_settings.PNG", alt = "screenshot") }}
- Fonts and Colors - This is where you can customize the overall main
aspects of the ladder.
- Market Break Lines - These are where can control the viewing of what
@@ -339,7 +332,7 @@ insert_anchor_links = "right"
- The other, main part of the ladder, is the ladder itself as
displayed below
![](ladder_main_part.png)
{{ image( name = "ladder_main_part.png", alt = "screenshot") }}
- There are 5 main columns
@@ -356,7 +349,7 @@ insert_anchor_links = "right"
- To enter an order directly by clicking in the ladder, left click on either the bid or ask volume with a volume greater than 0 on the predefined value box on the left-hand section
- A badge will be displayed within the orders column of the value you have chosen and the quantity filled as displayed below
![](ladder_badges.png)
{{ image( name = "ladder_badges.png", alt = "screenshot") }}
- To change the price level you wish to work the order, you can right-click and hold on the badge to move it up or down the ladder for the
desired price
@@ -367,9 +360,7 @@ insert_anchor_links = "right"
## Order Ticket
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/bdC5pZ6T35I" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{ youtube(id="bdC5pZ6T35I") }}
- The order ticket was designed to provide another means other than
the ladder to enter orders into the market
@@ -378,7 +369,7 @@ insert_anchor_links = "right"
which security to populate
- The order ticket appears like below
![](image27.png)
{{ image( name = "image27.png", alt = "screenshot") }}
- On the top left, you have the price for the order as well as the
volume
@@ -416,7 +407,7 @@ insert_anchor_links = "right"
- This is all in place in a very user friendly GUI as shown below:
![](algo_studio.png)
{{ image( name = "algo_studio.png", alt = "screenshot") }}
- There are 3 main areas of the Algo Studio:
+3
View File
@@ -3,6 +3,9 @@ title = "BTS Spark"
weight = 1
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "Documentation for Blue Trading Systems' BTS Spark"
+++
Click on the headings on the left to expand their contents. If you need specific information quickly use the Search button in the top right of this page.
+83 -50
View File
@@ -3,18 +3,51 @@ title = "Release notes"
weight = 3
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "Release notes for BTS Spark"
+++
## 2.13.0
### User Visible Changes
- Added the name of the spreader to the parent algo badge (for spreader child orders), in the fills, orderbook and floating orderbook windows
- Added support for sounds for new orders
- Added a new quoting throttle parameter for the spreader, that throttles quotes that are moving toward the inside market but are still a configurable number of ticks away
- Enabled the ladder to remember the left panel scroll position across front end restarts
### Bug Fixes
- Fixed the local fills window so that it does not show the admin fills
- Removed the deleted accounts from the ladder accounts dropdown
- Fixed the orderbook price for iceberg of spreaders
## 2.12.0
### User Visible Changes
- Added support for ICE market data and order execution
### Internal Changes
- Lots of permission / admin changes to facilitate ICE
## 2.11.0
### User Visible Changes
- Fixed fills form time filter to also apply to SOD fills
- Addressed an issue that could prevent the web Admin UI from displaying over slow HTTP connections
- Removed the option to enter manual spread fills
- Fixed an issue that could cause erroneous fill account attribution in the event of a crash
### Internal Changes
- Added support for tag 1031. Currently defaults to Y, can it be override through config.
- To facilitate support, allowed the bts user to view and edit algos from all other users
- Improved system tests
- Improved log messages in UI to include dispatcher thread name
- Added support for Windows core dumps in the UI
## 2.10.0
### User Visible Changes
- Fills now include information about the algo that originated the fill
- A new, more powerful PnL form is now available
### API Changes
- Added security state information (pre open, halted, normal, closed, etc)
- Added security state information (pre open, halted, normal, closed, etc)
### Bug Fixes
- Brought back the "select all" check box in the mini order book
- Fixed an issue in the market data subsystem that on rare occasions could result in a startup crash
### Internal Changes
- Fixed an issue that was stopping us from interpreting SOD times as local rather than GMT
- Fixed an issue that was stopping us from interpreting SOD times as local rather than GMT
## 2.9.3
### Internal Changes
- Fixed system test scripts
@@ -30,7 +63,7 @@ insert_anchor_links = "right"
- Avoided shipping production configuration defaults that lead to trying to download a position file for the development sftp server.
### Api
- C# API sample now uses synchronous calls.
## 2.9.0
### User Visible Changes
- Improved Workspace management User Interface
@@ -38,11 +71,11 @@ insert_anchor_links = "right"
- The Spark UI Window group now has a title in the Windows task bar
- Added sound alerts for trade events, see Launcher -> Settings -> Alerts
- Allowed composite algos that are attached to existing orders to identify fills that were already present prior to attachment
- Added import facilities for GMI position files
- Added import facilities for GMI position files
- Added the ability for risk managers to enter manual fills
- Added "raw" P&L columns, that is columns that *do not* include spread legs in their accounting
### Bug Fixes
- Fixed the settings action menu (Load/Save/Reset to Factory)
- Fixed the settings action menu (Load/Save/Reset to Factory)
- Fixed the method used to determine if a security is expired to take into account the start of day time
### API Changes
- Fixed an issue in the Client SDK that could lead to occasional failures to connect to the spark server as well as excessive memory usage.
@@ -79,10 +112,10 @@ insert_anchor_links = "right"
- Made it easier to generate simple UI's for new order types
### API Changes
- Dynamic orders can now use QuantityMeasure parameter types
## 2.7.2
### User Visible Changes
- Changed the login dialog to avoid leaking workspace names from other users.
- Changed the login dialog to avoid leaking workspace names from other users.
- Added new Splitter algo. From the manual: The splitter is useful
for pro-rata markets where you want to vary your exposure
independent of the order quantity that you want to fill. The
@@ -90,13 +123,13 @@ insert_anchor_links = "right"
the order quantity but it will put exposed_qty total size on the
market. Splitter favors order size over queue position.
### Internal Changes
- Made spark more resilient to lack of connectivity to the CME web site for downloading of templates.
- Made spark more resilient to lack of connectivity to the CME web site for downloading of templates.
## 2.7.1
### User Visible Changes
- Fixed some issues with the Cover algo, where in some circumstances
it would erroneously cancel launched hedges on completion.
## 2.7.0
### User Visible Changes
- Allowed algos to process "in-flight" fills while shutting down
@@ -115,36 +148,36 @@ insert_anchor_links = "right"
### User Visible Changes
- Fixed an issue in the ladder where in some cases the mini order book could not be brought up from a badge
- Fixed a rare race condition that could lead to erroneous limit enforcement
- Fixed an issue with the margin limits where an error could occur if an account name with more than 12 chars was used
- Fixed an issue with the margin limits where an error could occur if an account name with more than 12 chars was used
## 2.6.1
### User Visible Changes
- Fixed an issue in the ladder where an error could occur when trying to change ladder settings for the first time
## 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 made last trade more distinctive when overlaid on the volume 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
- Added an option for the Top Algo to delete itself if within N ticks from top of book
- Address a rare issue that could lead to an error report on UI exit
- Added margin risk limits
- Added the "Offset" algo. Offset prices a child algo at a parameterizable distance from the top of the book
- Avoided switching the current account and order type on open ladders when limits are changed
- Avoided switching the current account and order type on open ladders when limits are changed
### 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
- Made algos, synthetics and user names private so that multiple users can share a single system privately.
- Allowed the mini order book defaults for column widths to be changed from the mini order book
- Allowed the mini order book to shrink to the minimum size that will be needed to display the selected columns
- Improved accuracy of the directional arrow when displaying last trades in the volumn column
- Improved accuracy of the directional arrow when displaying last trades in the volume column
## 2.4.0
### User Visible Settings
- In the ladder, changed the last trade column to accumulate successive trades at the same price
- Fixed a bug in the order book where the right side ladder would display the top leve order's security rather then current row's
- Fixed a bug in the order book where the right side ladder would display the top level order's security rather then current row's
- Added OK, Cancel buttons to the security picker for ladder profiles or sounds
- Added ladder settings for the mini order book
- Added a safety check to guard against unintentional market crosses
@@ -160,16 +193,16 @@ insert_anchor_links = "right"
### User Visible Changes
- Introduced multiple settings profiles for the ladder
- This allows multiple standard configuration for the ladder, optionally with security specific variations
- Made Cover order more independent from its hedging chidren:
- Made Cover order more independent from its hedging children:
- Cover continues to operate even if an hedging child is canceled
- When a cover is canceled it will detach from any running hedging children, instead of canceling them
- Changed Lean, Join and Cover algos to hide themselves in the ladder once they have completed their work
- Changed Lean, Join and Cover algos to hide themselves in the ladder once they have completed their work
- Changed manual fills to appear in day PnL rather than in the SOD records
- Add buy/sell coloring to fill rows in fills window
- Streamlined the mini order book:
- Display of the mini order book popup is quicker
- Only exchange orders are displayed
- Update buttons are only displayed for orders that are under control of an algo with the update applying to the entire algo, not just the exchange order
- Update buttons are only displayed for orders that are under control of an algo with the update applying to the entire algo, not just the exchange order
- We can now select multiple rows to attach, detach, update or cancel multiple orders in a batch
- A checkbox column has been added to make clearer which rows are selected
### API Changes
@@ -179,7 +212,7 @@ insert_anchor_links = "right"
- Added system requirements to Spark documentation
- Implemented keycodes
- Temporarily rejected stop and stop limit orders, pending bug fixes
## 2.2.0
### User Visible Changes
- Made our orders easier to spot in MBO display
@@ -190,41 +223,41 @@ insert_anchor_links = "right"
- Improved handling of orders with undiscovered securities
- Added feedback to the ladder when the user attempts to middle click on bid/ask columns using an order that does not have parameters
- Fixed display of algo studio algo types in order book
- Hid net change setting in synthetic ladders
- Hid net change setting in synthetic ladders
- Fixed a number of problems with filtering on the Fills form
- On the Lean algo, OnToward and Away are now calculated with respect to the opposite inside market at time of the order launch
- Iceberg Spreaders with queue holders are not erroneously cancelled after the first fill
- Added security symbol column to fills window
- Re-organized ladder settings dialog to make it clearer and easier to use
## 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
- Fixed a simulator bug in the handling of 0 sized orders
## 2.2.1
### User Visible Changes
- Fixed order book form exception when display a spreader order for whichs the legs were not present yet
- Fixed order book form exception when display a spreader order for which the legs were not present yet
## 2.1.1
### User Visible Changes
- Added PIQ to GLBX Iceberg orders
- Corrected handling of stop limit orders
## 2.1.0
### User Visible Changes
- Added support for the GLBX Iceberg order type
- Allowed quick algo param edits by middle-clicking on either the bid/ask columns or a "favorite" button
- Added support for manual fills, either entered manually or imported from file. Manual fills are used only for P&L purposes, they have no impact on limits
- Allowed the LTQ and VAP values to be overlayed on the same ladder column
- Allowed the LTQ and VAP values to be overlaid on the same ladder column
- Added day position information to the ladder
- Added PIQ to the mini order book
- Fixed a rare bug that could lead to server failure when requesting market data
- Fixed a bug that could cause incorrect price displays for certain types of synthetic securities
## 2.0.5
### User Visible Changes
- Fixed a bug in the handling of rejected QHO orders
@@ -234,19 +267,19 @@ insert_anchor_links = "right"
## 2.0.4
### User Visible Changes
- Fixed performance regression in order manager
### Internal changes
- Improved market data diagnostics for bad configurations
- Changed market data default buffer size
## 2.0.3
### Internal changes
- Improved backwards compatibility in UI settings
## 2.0.2
### User Visible Changes
- Middle click the ladder price column to show the orders for that price level
- Middle click the ladder price column to show the orders for that price level
- Middle click the bid or ask column in the ladder no longer sends an order
### Internal changes
@@ -274,8 +307,8 @@ insert_anchor_links = "right"
- Improved settings manager tool output
- Added diagnostics in the event MD memory corruption is detected
- Added systems tests for join,lean, iceberg and spreader orders
- Made exchange order recovery more resilient in the presence of database loss
- Made exchange order recovery more resilient in the presence of database loss
## 1.6.2
### User Visible Changes
### Exchange simulator
@@ -300,7 +333,7 @@ insert_anchor_links = "right"
- Integrated stunnel into UI to make VPN setup unnecessary in unsecured environments.
## 1.5.7
### User Visible Changes
- New videos have been added to the manual describing the [Algo Studio](./bts_spark/Trading/_index.md#algo-studio) and [Spreader](./bts_spark/Spreader/_index.md)
- New videos have been added to the manual describing the [Algo Studio](@/bts_spark/Trading/_index.md#algo-studio) and [Spreader](@/bts_spark/Spreader/_index.md)
- Fixed a bug that occasionally would cause windows to be position outside the visible screen on startup
- Fixed a bug in the order book form that would occasionally cause the Recreate Order option to be unavailable
- Added a confirmation step to Cancel All, Cancel Buys and Cancel Sells commands
@@ -314,21 +347,21 @@ insert_anchor_links = "right"
- These columns can be restored by toggling their visibility within the PnL's Settings form
- A new Traded Today column has been added to the PnL
- Filtering on this column will allow a user to restrict the report to only show today's position
### Internal changes
- Improved organization of the shell notification architecture
### Internal changes
- Improved organization of the shell notification architecture
- Added logging to help troubleshoot shell exit hang
## 1.5.6
### User Visible Changes
- Fixed a bug that could cause limits to be erroneously enforced
- Fixed a bug that could cause limits to be erroneously enforced
- Improved algo documentation
- Changed how the spreader uses net change
- Simplified trigger algo user interface
### Internal changes
### Internal changes
- Defaulted to not recording sim market data
- Improved documentation build
- Improved documentation build
- Added additional performance tracing
## 1.5.5
- Fixed Market View 'stale working orders' bug
@@ -336,11 +369,11 @@ insert_anchor_links = "right"
- Avoided logging when warming up cache
## 1.5.3
- Fixed sounds startup issue
- Fixed sounds startup issue
## 1.5.2
- Added better logging to AlgoDefinitionService
## 1.5.1
- Fixed missing securities in the Fills and P&L windows.
@@ -361,7 +394,7 @@ insert_anchor_links = "right"
#### Bug Fixes
- Fixed the "Since Open" time filter to use the exchange open time rather than 8:30 AM
- Fixed a bug in the order book where sometimes parent orders would not update their last message column.
#### Algos
- Added OCO Algo
- An OCO order creates a relationship between a child order and a 'stop' or 'other' order such that 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
@@ -369,14 +402,14 @@ insert_anchor_links = "right"
- Improved SDK documentation and usability
- Dynamic orders are now properly identified in the order book
#### Documentation
- Information on the Spark API has been added to the Spark manual
- Information on the Spark API has been added to the Spark manual
- The documentation has been updated and reorganized to make information easier to find
### Internal Changes
- Improved robustness of limit system test
- Fixed a bug in handling of built-in bts to user that could lead to failure to login as bts in old systems
- Improved market data subsystem to support security definition updates
- Fixed a startup race in market data that could lead to data corruption on startup
- Increased default order price precision to 8 digis as required by some CME products
- Increased default order price precision to 8 digits as required by some CME products
## 1.4.11
### New Features
@@ -444,7 +477,7 @@ insert_anchor_links = "right"
### Ladder Usability Improvements
- Controls found in Left Pane of the ladder can now be hidden via the checkboxes found under Ladder Form -> Settings button -> Left Pane tab
- The Left Pane is now scrollable with the mouse wheel when there isn't enough vertical space to accomodate the entire form
- The Left Pane is now scrollable with the mouse wheel when there isn't enough vertical space to accommodate the entire form
- The Left Pane can now grown and shrunk horizontally via the splitter between the left pane and the main ladder area
### Performance Improvements
- Requoting and hedging latency has been reduced by up to 30%
@@ -3,6 +3,9 @@ title = "System Requirements"
weight = 4
sort_by = "weight"
insert_anchor_links = "right"
[extra]
page_description = "Recommended and minimum systems requirements for BTS Spark"
+++
+7 -2
View File
@@ -1,15 +1,20 @@
#/bin/bash
#python -m mkdocs build -d site
./run_zola.sh build
ssh bts@bluetradesys.com "rm -r /home/bts/bts_website/zola/content/docs"
scp -r ./content bts@bluetradesys.com:/home/bts/bts_website/zola/content/docs
scp -r ./public bts@bluetradesys.com:/home/bts/doc/
ssh bts@bluetradesys.com << EOF
cd doc
cd /home/bts/doc/
sudo rm -r /var/www/documentation/*
sudo mv ./public/* /var/www/documentation/
cd /home/bts/bts_website/zola/
./fix_links.sh
./deploy.sh
EOF
rm -r public
+18 -9
View File
@@ -1,4 +1,4 @@
.page {
.page, .menu-open .page {
position: absolute;
width: calc(100% - #{$sidebar-width});
height: 100%;
@@ -7,15 +7,24 @@
background: #f6f6f6;
padding-bottom: 20px;
transition: 0.5s;
left: $sidebar-width;
h1:hover .zola-anchor, h2:hover .zola-anchor, h3:hover .zola-anchor, h4:hover .zola-anchor, h5:hover .zola-anchor, h6:hover .zola-anchor {
visibility: visible;
}
.zola-anchor {
color: #4183c4;
padding-left: 10px;
padding-right: .5em;
margin-left: -1.5em;
text-decoration: none;
font-weight: initial;
float: left;
visibility: hidden;
&:hover {
text-decoration: underline;
text-decoration: none;
visibility: visible;
}
}
@@ -155,13 +164,13 @@
}
}
@include min-screen(600px) {
.page {
left: $sidebar-width;
}
}
// @include min-screen(600px) {
// .page {
// left: $sidebar-width;
// }
// }
.page-without-menu {
.menu-closed .page {
width: 100%;
left: 0;
+46 -19
View File
@@ -123,27 +123,9 @@
.page__header {
height: 50px;
position: fixed;
.menu-icon {
height: 50px;
width: 50px;
font-size: 24px;
text-align: center;
float: left;
position: relative;
transition: background .5s;
cursor: pointer;
@include menu-icon();
&:hover {
span {
background-color: black;
}
}
}
.search-icon {
height: 50px;
width: 50px;
display: inline-block;
@@ -156,5 +138,50 @@
&:hover {
color: black
}
@include menu-icon();
&:hover {
span {
background-color: black;
}
}
}
.search-icon, .font-icon {
height: 40px;
width: 40px;
display: inline-block;
text-align: center;
line-height: 40px;
color: rgba(0, 0, 0, 0.5);
cursor: pointer;
font-size: 2rem;
&:hover {
color: #eee;
background-color:#666;
border-radius: .2ex;
}
}
.font-icon{
display: inline-block;
// padding:0.6ex 1ex;
margin-left:1rem;
background:#333;
color:#eee;
border-radius: .2ex;
&:hover {
background:#666;
}
}
}
.dark-mode .font-icon{
background:#aaa;
color:#333;
}
+17 -2
View File
@@ -1,4 +1,4 @@
.menu {
.menu, .menu-open .menu {
height: 100%;
position: absolute;
left: 0;
@@ -39,7 +39,7 @@
}
}
.menu-hidden {
.menu-closed .menu {
width: 0;
}
@@ -47,4 +47,19 @@
.menu {
width: 0;
}
.menu-close-icon {
display: block;
padding:1ex;
font-size: 1.5em;
float:right;
}
}
@include min-screen(600px) {
.menu-close-icon {
display: none;
}
}
+98 -3
View File
@@ -1,6 +1,7 @@
@charset "utf-8";
@import "normalize";
@import "colorbox";
* {
box-sizing: border-box;
@@ -21,6 +22,10 @@ body {
letter-spacing: 0.2px;
}
body.dark-mode .page{
background:#444;
color:#eee;
}
@mixin min-screen($min-width: $body-width) {
@media screen and (min-width: $min-width) {
@@ -40,9 +45,21 @@ $sidebar-width: 300px;
@import "content";
@import "header";
img {
transform: scale(0.666);
transform-origin: top left;
@media screen and (min-width: 1920px)
{
// img.scaled-image {
// transform: scale(0.666);
// transform-origin: top left;
// }
}
.colorbox-inline img {
max-width: 100%;
}
.icon-image {
display:inline;
max-height: 1.4em;
}
.back-button {
@@ -58,4 +75,82 @@ img {
iframe {
width:560px;
height:315px;
}
.youtube-thumb {
margin-top:2em;
position:relative;
max-width:500px;
}
.youtube-overlay {
position:absolute;
width:8rem;
height:4.5rem;
line-height:4.5rem;
font-size: 2.5rem;
left:calc(50% - 4rem);
top:calc(50% - 2.25rem);
text-align:center;
opacity:.8;
background:#f68a28;
color:white;
border-radius: .3rem;
}
.youtube-overlay:hover {
background:#f68a28;
opacity:1;
}
.video-parent {
position: relative;
width: fit-content;
}
.video-parent:hover .play-pause, .video-parent.paused .play-pause {
display: block;
}
.play-pause {
display:none;
opacity:.7;
position:absolute;
width:8rem;
height:4.5rem;
line-height:4.5rem;
font-size: 2.5rem;
left:calc(50% - 4rem);
top:calc(50% - 2.25rem);
text-align:center;
background:#f68a28;
color:#fff;
border-radius: .3rem;
z-index:1000;
}
.play-pause:hover {
opacity: 0.9;
}
@media (hover: none) {
.play-pause {
display:block;
}
.video-parent.playing:hover .play-pause {
display:none;
}
}
.is-clearfix {
clear:both;
}
.is-pulled-left {
float: left;
}
.is-pulled-right {
float: right;
}
+42
View File
@@ -0,0 +1,42 @@
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute;top:0;left:0;z-index:9999;overflow:hidden;-webkit-transform:translate3d(0,0,0);}
#cboxWrapper{max-width:none;}
#cboxOverlay{position:fixed;width:100%;height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto;-webkit-overflow-scrolling:touch;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute;top:0;left:0;width:100%;height:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
.cboxPhoto{float:left;margin:auto;border:0;display:block;max-width:none;-ms-interpolation-mode:bicubic;}
.cboxIframe{width:100%;height:100%;display:block;border:0;padding:0;margin:0;}
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;}
#cboxOverlay{background:#000;opacity:0.9;filter:alpha(opacity = 90);}
#colorbox{outline:0;}
#cboxTopLeft{width:14px;height:14px;background:url(colorbox-images/controls.png) no-repeat 0 0;}
#cboxTopCenter{height:14px;background:url(colorbox-images/border.png) repeat-x top left;}
#cboxTopRight{width:14px;height:14px;background:url(colorbox-images/controls.png) no-repeat -36px 0;}
#cboxBottomLeft{width:14px;height:43px;background:url(colorbox-images/controls.png) no-repeat 0 -32px;}
#cboxBottomCenter{height:43px;background:url(colorbox-images/border.png) repeat-x bottom left;}
#cboxBottomRight{width:14px;height:43px;background:url(colorbox-images/controls.png) no-repeat -36px -32px;}
#cboxMiddleLeft{width:14px;background:url(colorbox-images/controls.png) repeat-y -175px 0;}
#cboxMiddleRight{width:14px;background:url(colorbox-images/controls.png) repeat-y -211px 0;}
#cboxContent{background:#fff;overflow:visible;}
.cboxIframe{background:#fff;}
#cboxError{padding:50px;border:1px solid #ccc;}
#cboxLoadedContent{margin-bottom:5px;}
#cboxLoadingOverlay{background:url(colorbox-images/loading_background.png) no-repeat center center;}
#cboxLoadingGraphic{background:url(colorbox-images/loading.gif) no-repeat center center;}
#cboxTitle{position:absolute;bottom:-25px;left:0;text-align:center;width:100%;font-weight:bold;color:#7C7C7C;}
#cboxCurrent{position:absolute;bottom:-25px;left:58px;font-weight:bold;color:#7C7C7C;}
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose{border:0;padding:0;margin:0;overflow:visible;position:absolute;bottom:-29px;background:url(colorbox-images/controls.png) no-repeat 0px 0px;width:23px;height:23px;text-indent:-9999px;}
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active{outline:0;}
#cboxPrevious{left:0px;background-position:-51px -25px;}
#cboxPrevious:hover{background-position:-51px 0px;}
#cboxNext{left:27px;background-position:-75px -25px;}
#cboxNext:hover{background-position:-75px 0px;}
#cboxClose{right:0;background-position:-100px -25px;}
#cboxClose:hover{background-position:-100px 0px;}
.cboxSlideshow_on #cboxSlideshow{background-position:-125px 0px;right:27px;}
.cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0px;}
.cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px;right:27px;}
.cboxSlideshow_off #cboxSlideshow:hover{background-position:-125px 0px;}
+15 -6
View File
@@ -1,10 +1,19 @@
function initToggleMenu() {
var $menu = document.querySelector(".menu");
var $menuIcon = document.querySelector(".menu-icon");
var $page = document.querySelector(".page");
$menuIcon.addEventListener("click", function () {
$menu.classList.toggle("menu-hidden");
$page.classList.toggle("page-without-menu");
$(".menu-icon").click(function (e) {
let body = $("body");
let mobile = window.innerWidth < 600;
let menu_closed = body.hasClass("menu-closed");
let menu_open = body.hasClass("menu-open");
let new_page = !(menu_closed || menu_open);
if((!mobile && (new_page || menu_open)) || mobile && menu_open) {
body.addClass("menu-closed");
body.removeClass("menu-open");
}
else {
body.removeClass("menu-closed");
body.addClass("menu-open");
}
});
}
function debounce(func, wait) {
Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

+58 -4
View File
@@ -1,11 +1,40 @@
$(document).ready(function() {
$("img").each(function(idx, elm){
$(elm).css("margin-bottom", elm.height * -0.333);
}).on("load", function(e){
$(e.target).css("margin-bottom", e.target.height * -0.333);
jQuery('a.thumbnail').colorbox({rel:'gal'});
jQuery('a.gallery_image').colorbox({rel:'gal'});
jQuery(".youtube").colorbox({iframe:true, innerWidth:'75%', innerHeight:'75%'});
jQuery(".font-icon").click(function (){
jQuery("body").toggleClass("dark-mode");
if(getCookie("dark-mode") === "true") {
setCookie("dark-mode", "false", 365);
}
else {
setCookie("dark-mode", "true", 365);
}
});
if(getCookie("dark-mode") === "true") {
jQuery("body").toggleClass("dark-mode");
}
if(window.innerWidth >= 1920) {
// $("img.scaled-image").each(function(idx, elm){
// $(elm).css("margin-bottom", elm.height * -0.333);
// }).on("load", function(e){
// $(e.target).css("margin-bottom", e.target.height * -0.333);
// });
$("a.colorbox-inline").each(function(idx, elm){
let child = $(elm).children("img")[0];
let w = (child.naturalWidth * 0.666) + 1
let h = (child.naturalHeight * 0.666) + 1
$(elm).colorbox({inline: true, innerWidth: w, innerHeight: h, scrolling: false});
});
}
else {
jQuery("a.colorbox-inline").colorbox({inline:true});
}
$(".back-button")
.html("Go Back")
.click(function(_) { window.history.back()});
@@ -14,4 +43,29 @@ $(document).ready(function() {
console.log(navigator.userAgent);
$(".search-icon").css("display", "none");
}
});
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
+6
View File
@@ -0,0 +1,6 @@
/*!
Colorbox 1.6.3
license: MIT
http://www.jacklmoore.com/colorbox
*/
(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!$){$=q=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),S=n("button","Slideshow"),L),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;$&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),$&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if(q=!0,U=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),U=_.get("createImg"),t(U).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(U.height=U.height/i.devicePixelRatio,U.width=U.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){U.height-Line truncated
+131
View File
@@ -0,0 +1,131 @@
jQuery(function($)
{
// Default time delay before checking location
var call_back_delay = 500;
// Set some flags for tracking & execution
var scroll_timer = null;
var scroller = false; // indicate the user has begun scrolling
scroll_points_in_page = jQuery(".scroll_point");
video_screenshots = jQuery(".video-screenshot");
video_parents = jQuery(".video-parent");
var apply_video_click = function (video) {
$(video).click(function (e) {
var v = $(this)[0];
if(v.paused) {
v.play();
$(v).attr("data-paused", "false");
}
else {
v.pause();
$(v).attr("data-paused", "true");
}
});
}
for(var i = 0; i < video_parents.length; i++) {
let video_with_event = $(video_parents[i]).children("video")[0];
let play_icon = $($(video_parents[i]).children(".play-pause")[0]).children("i");
let parent = $(video_parents[i]);
parent.addClass("playing");
video_with_event.onpause = function () {
parent.addClass("paused");
parent.removeClass("playing");
play_icon.addClass("fa-play");
play_icon.removeClass("fa-pause");
}
video_with_event.onplay = function () {
parent.removeClass("paused");
parent.addClass("playing");
play_icon.removeClass("fa-play");
play_icon.addClass("fa-pause");
}
}
for(var i = 0; i < video_screenshots.length; i++) {
apply_video_click(video_screenshots[i]);
}
$(".play-pause").click(function (e) { $(this).next("video").click();});
// Check the location and track user
function track_location()
{
view_bottom = $(window).height() + $(window).scrollTop();// the bottom of the visible area
// loop through the scroll points and send events for any within the visible part of the page
for(var i = 0; i < scroll_points_in_page.length; i++)
{
check_scroll_point(scroll_points_in_page[i]);
}
for(var i = 0; i < video_screenshots.length; i++)
{
video_screenshots_play_pause(video_screenshots[i]);
}
}
var check_scroll_point = function(current_value)
{
var current_object = $(current_value);
if (view_bottom >= current_object.offset().top && $(window).scrollTop() <= current_object.offset().top && (current_object.attr("hit") === undefined || current_object.attr("hit") === null))
{
if (!debug_mode)
{
ga('send', 'event', current_object.attr("data-eventCategory") + "_scroll_points", "in_view", current_object.attr("data-eventLabel"));
}
else
{
console.log(current_object.attr("data-eventCategory") + "_scroll_points, " + current_object.attr("data-eventLabel"));
}
$("[data-eventLabel='" + current_object.attr("data-eventLabel")+ "']").attr("hit", "1"); // after the point has been hit don't count it again
}
}
var video_screenshots_play_pause = function(current_value)
{
var current_object = $(current_value);
var video_middle = current_object.offset().top + (current_object.height() / 2);
var video_on_screen = view_bottom > video_middle && video_middle > $(window).scrollTop();
if (
window.innerWidth > 600
&& video_on_screen
&& current_value.paused
&& current_object.attr("data-paused") === "false"
)
{
current_value.play();
}
else if (!current_value.paused && !video_on_screen) {
current_value.pause();
}
}
// Track the scrolling and track location
$(".page").scroll(function()
{
if (scroll_timer) {
clearTimeout(scroll_timer);
}
// Use a buffer so we don't call track_location too often.
scroll_timer = setTimeout(track_location, call_back_delay);
});
});
+1
View File
@@ -0,0 +1 @@
<a class="zola-anchor" href="#{{ id }}" aria-label="Anchor link for: {{ id }}"><i class="fas fa-link"></i></a>
+23 -13
View File
@@ -5,9 +5,12 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="keywords" content="Futures, Options, Derivatives, Trade, Trading, Professional, options trading, futures trading, Software" />
<meta name="rights" content="© Blue Trading Systems" />
<meta name="description" content="Documentation for Blue Trading Systems' BTS Spark" />
<!-- <meta name="keywords" content="Futures, Derivatives, Trade, Trading, Trader, Professional, futures trading, Software" />
<meta name="description" content="Documentation for Blue Trading Systems' BTS Spark" /> -->
{% block meta %}
{% endblock meta %}
<title>{% block title %}{{ config.title }}{% endblock title %}</title>
@@ -36,12 +39,8 @@
}
</script>
<script src="https://kit.fontawesome.com/93aca32d82.js"></script>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script type="text/javascript" src="{{ get_url(path="image.js") | safe }}"></script>
{% block js %}
{% endblock js %}
@@ -60,6 +59,9 @@
{% block before_menu %}
{% endblock before_menu %}
<nav role="navigation">
<div class="menu-icon menu-close-icon">
<i class="fas fa-arrow-left"></i>
</div>
<ul>
{% block menu %}
{% set index = get_section(path="_index.md") %}
@@ -116,14 +118,14 @@
<div class="page">
<div class="page__header">
<div class="menu-icon">
<span></span>
<span></span>
<span></span>
</div>
<span class="menu-icon">
<i class="fas fa-bars"></i>
</span>
{% if config.build_search_index %}
<span class="search-icon">🔎</span>
<span class="search-icon"><i class="fas fa-search"></i></span>
{% endif %}
<span class="font-icon"><i class="fas fa-font"></i></span>
</div>
<div class="page__content">
@@ -154,11 +156,19 @@
</div>
{% block js_body %}
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script type="text/javascript" src="{{ get_url(path="jquery.colorbox-min.js") | safe }}"></script>
<script type="text/javascript" src="{{ get_url(path="image.js") | safe }}"></script>
<script type="text/javascript" src="{{ get_url(path="scroll_actions.js") | safe }}"></script>
{% if config.build_search_index %}
<script type="text/javascript" src="{{ get_url(path="elasticlunr.min.js") | safe }}"></script>
<script type="text/javascript" src="{{ get_url(path="search_index.en.js") | safe }}"></script>
{% endif %}
<script type="text/javascript" src="{{ get_url(path="book.js") | safe }}"></script>
{% endblock js_body %}
</body>
+8
View File
@@ -1,5 +1,13 @@
{% extends "index.html" %}
{% block meta %}
{% if page.extra.page_description %}
<meta name="description" content="{{ page.extra.page_description }}" />
{% else %}
<meta name="description" content="{{ page.title }} Documentation for Blue Trading Systems' BTS Spark" />
{% endif %}
{% endblock meta %}
{% block title %}{{ page.title }} &bull; {{ config.title }}{% endblock title %}
{% block content %}
+8
View File
@@ -1,5 +1,13 @@
{% extends "index.html" %}
{% block meta %}
{% if section.extra.page_description %}
<meta name="description" content="{{ section.extra.page_description }}" />
{% else %}
<meta name="description" content="{{ section.title }} Documentation for Blue Trading Systems' BTS Spark" />
{% endif %}
{% endblock meta %}
{% block title %}{{ section.title }} &bull; {{ config.title }}{% endblock title %}
{% block content %}
+1
View File
@@ -0,0 +1 @@
<div style="clear:both;"></div>
+17
View File
@@ -0,0 +1,17 @@
{% if class %}
{% set cls = class %}
{% else %}
{% set cls = "" %}
{% endif %}
{% if page %}
{% set context = page %}
{% elif section %}
{% set context = section %}
{% endif %}
<img
class="icon-image {{cls}}"
src="{{name}}"
alt="{{alt}}"
/>
+34
View File
@@ -0,0 +1,34 @@
{% if pull %}
{% if pull == "left" %}
{% set float = "is-pulled-left" %}
{% elif pull == "right" %}
{% set float = "is-pulled-right" %}
{% else %}
{% set float = "is-pulled-over-there" %}
{% endif %}
{% else %}
{% set float = " " %}
{% endif %}
{% if class %}
{% set cls = class %}
{% else %}
{% set cls = "" %}
{% endif %}
{% if page %}
{% set context = page %}
{% elif section %}
{% set context = section %}
{% endif %}
{% set image_path = context.path ~ name %}
{% set meta = get_image_metadata(path = image_path) %}
{% set image_width = (meta.width * 0.666)%}
<img
class="{{cls}} {{float}}"
style="width:{{image_width}}px;"
src="{{name}}"
alt="{{alt}}"
/>
@@ -0,0 +1,52 @@
{% if pull %}
{% if pull == "left" %}
{% set float = "is-pulled-left" %}
{% elif pull == "right" %}
{% set float = "is-pulled-right" %}
{% else %}
{% set float = "is-pulled-over-there" %}
{% endif %}
{% else %}
{% set float = " " %}
{% endif %}
{% if class %}
{% set cls = class %}
{% else %}
{% set cls = "" %}
{% endif %}
{% if width %}
{% set wdth = width %}
{% else %}
{% set wdth = "100%" %}
{% endif %}
{% if page %}
{% set context = page %}
{% elif section %}
{% set context = section %}
{% endif %}
{% set image_path = context.path ~ name %}
{% set meta = get_image_metadata(path = image_path) %}
{% set image_width = (meta.width * 0.666)%}
{% set id = name | replace(from=".", to="-") %}
<a class="colorbox-inline" href="#{{id}}">
<img
class="{{cls}} {{float}}"
style="width: {{wdth}}; max-width:{{image_width}}"
src="{{name}}"
alt="{{alt}}"
/>
</a>
<div id="colorbox-inline-content" style="display: none;">
<div id="{{id}}">
<img class = "" style="width:{{image_width}}; max-width:95vw; max-height:95vh; object-fit: scale-down"
src="{{name}}"
alt="{{alt}}"
/>
</div>
</div>
@@ -0,0 +1,6 @@
<div class="video-parent">
<div class="play-pause"><i class="fas fa-play"></i></div>
<video class="video-screenshot" style="width: {{width}}; max-width:100%;" muted loop data-paused="false">
<source src="{{name}}" type="video/mp4">
</video>
</div>
@@ -0,0 +1,8 @@
<div {% if class %}class="{{class}}"{% endif %}>
<div class="embed-responsive embed-responsive-16by9 youtube-thumb">
<a class="gallery_image youtube cboxElement" href="https://www.youtube.com/embed/{{id}}" style="display:block;">
<img class="video_thumb" style="width:100%;" src="https://img.youtube.com/vi/{{id}}/0.jpg" alt="Video Thumbnail" />
<div class="youtube-overlay"><i class="fas fa-play"></i></div>
</a>
</div>
</div>
+53 -62
View File
@@ -1,83 +1,74 @@
using bts;
using bts.api.admin;
using bts.api.core;
using bts.utils;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using bts.api.core;
using mbts.ui.shell;
namespace mbts.spark {
[Export]
class AdminModel : IDisposable {
public readonly UserTuple user;
readonly BehaviorSubject<IReadOnlyDictionary<uint, string>>
_accounts_subject = new BehaviorSubject<IReadOnlyDictionary<uint, string>>(new Dictionary<uint, string>()),
_users_subject = new BehaviorSubject<IReadOnlyDictionary<uint, string>>(new Dictionary<uint, string>());
IReadOnlyDictionary<uint, string>
_account_map = new Dictionary<uint, string>(),
_user_map = new Dictionary<uint, string>();
readonly BehaviorSubject<AdminModelWrapper> _wrapper_subject = new BehaviorSubject<AdminModelWrapper>(new AdminModelWrapper());
IDisposable _dispose;
IDisposable _dispose;
IReadOnlyDictionary<uint, string> _account_map = DictionaryHelper.empty<uint, string>();
[ImportingConstructor]
AdminModel(AdminService service, [Import]UserTuple user) {
AdminModel(AdminService service, UserTuple user) {
this.user = user;
_dispose = service.subscribei_admin_data().Select(update => {
_wrapper_subject.OnNext(new AdminModelWrapper(update.all.TryFirst(), user.name));
IEnumerable<BTSUserImmutable> active_users =
from admin_data in update.all
from bts_user in admin_data.Users
where bts_user.Name == user.name && bts_user.HasUserData && bts_user.UserData.HasAccountPermissions
select bts_user;
IEnumerable<BTSAccountImmutable> active_accounts =
from admin_data in update.all
from bts_account in admin_data.Accounts
where bts_account.IsPresent && _wrapper_subject.Value.can_view_account(bts_account.Name)
join account_id in (
from bts_user in active_users
from account_id in bts_user.UserData.AccountPermissions.AccountPermissions.Keys
select account_id
) on bts_account.Id equals account_id
select bts_account;
var users = active_users.ToDictionary(u => u.Id, u => u.Name);
var accounts = active_accounts.ToDictionary(a => a.Id, a => a.Name);
return (users, accounts);
}).Subscribe(t => {
_account_map = t.accounts;
_user_map = t.users;
_users_subject.OnNext(_user_map = t.users);
_accounts_subject.OnNext(_account_map = t.accounts);
});
// accounts
on_accounts = service.subscribei_admin_data()
.Select(up => up.all.TryGetFirst(out var ad) && ad.Users.Where(u => u.Name == user.name).TryGetSingle(out var usr) && usr.HasUserData && usr.UserData.HasAccountPermissions ?
usr.UserData.AccountPermissions.AccountPermissions
.Where(kv => (kv.Value.TradingPermission != null && kv.Value.TradingPermission.HasPermissions) || kv.Value.AdminPermission.HasPermissions)
.Select(kv => ad.Accounts.Where(a => a.Id == kv.Key).TryGetSingle(out var acc) ? acc : (BTSAccountImmutable?)null)
.Where(acc => acc.HasValue && acc.Value.IsPresent)
.Select(acc => acc.Value)
.ToDictionary(acc => acc.Id, acc => acc.Name) :
new Dictionary<uint, string>(0))
.Replay(1)
.RefCount();
// users
on_users = Observable.Return(DictionaryHelper.wrap_value(user.id, user.name));
all_user_tuples = user.permissions == UserTuple.Permissions.Admin ?
service.subscribei_admin_data()
.Select(u => u.all.TryFirst())
.Where(ad => ad.HasValue)
.Select(ad => ad.Value.Users
.Where(u => user.can_access_user_data(u.Id))
.Select(u => new UserTuple(u.Id, u.Name))
.ToDictionary(UserTuple.key_fn))
.Table(UserTuple.key_fn)
.Cache() :
Observable.Return(TableUpdate<UserTuple, uint>.mk_empty(UserTuple.key_fn).with_added(new[] { user }));
_dispose = on_accounts.Subscribe(map => _account_map = map);
}
public IObservable<IReadOnlyDictionary<uint, string>> on_users => _users_subject.AsObservable();
public IObservable<IReadOnlyDictionary<uint, string>> on_accounts => _accounts_subject.AsObservable();
public IObservable<IReadOnlyList<UserTuple>> on_user_tuples => on_users.Select(d => d.Select(kv => new UserTuple(kv.Key, kv.Value)).ToList());
public IObservable<IReadOnlyList<AccountTuple>> on_account_tuples => on_accounts.Select(d => d.Select(kv => new AccountTuple(kv.Key, kv.Value)).ToList());
public IObservable<AdminModelWrapper> on_admin_data => _wrapper_subject.AsObservable();
public IObservable<IReadOnlyDictionary<uint, string>> on_users { get; }
public IObservable<IReadOnlyDictionary<uint, string>> on_accounts { get; }
public IObservable<TableUpdate<UserTuple, uint>> all_user_tuples { get; }
public IObservable<IReadOnlyList<AccountTuple>> on_account_tuples => on_accounts.Select(d => d.Select(kv => new AccountTuple(kv.Key, kv.Value)).ToListSorted(a => a.name));
public AccountTuple? get_default_account() {
foreach (var kv in _account_map) {
return new AccountTuple(kv.Key, kv.Value);
}
return null;
}
public uint? get_user_id(string user) => _id_for_name(user, _user_map);
public uint? get_account_id(string account) => _id_for_name(account, _account_map);
public void Dispose() => Disposable.dispose(ref _dispose);
public IObservable<Update<T, TKey>> permission_filter<T, TKey>(IObservable<Update<T, TKey>> positions, Func<T, uint> get_account_id) where TKey : IEquatable<TKey> =>
user.permissions == UserTuple.Permissions.Admin ?
positions :
positions.Filter(on_accounts.Select(map => new Func<T, bool>(p => map.ContainsKey(get_account_id(p)))));
static uint? _id_for_name(string name, IReadOnlyDictionary<uint, string> map) {
foreach (var kv in map) {
if (kv.Value == name)
return kv.Key;
}
return null;
}
public IObservable<Update<T, TKey>> permission_filter<T, TKey>(IObservable<Update<T, TKey>> positions, Func<T, string> get_account_name) where TKey : IEquatable<TKey> =>
user.permissions == UserTuple.Permissions.Admin ?
positions :
positions.Filter(on_accounts.Select(map => {
var hash = new HashSet<string>(map.Values);
return new Func<T, bool>(v => hash.Contains(get_account_name(v)));
}));
public AccountTuple? get_default_account() =>
_account_map.Select(kv => new AccountTuple(kv.Key, kv.Value)).TryFirst();
public void Dispose() =>
Disposable.dispose(ref _dispose);
}
}
+3 -8
View File
@@ -3,15 +3,10 @@ using mbts;
using mbts.config;
using mbts.spark;
using mbts.ui;
using mbts.ui.shell;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
@@ -23,8 +18,8 @@ namespace bts.ui {
IDisposable _dispose;
[ImportingConstructor]
public AboutDaemon(IBus bus, [Import(LoginContainer.Exports.UserName)]string username) {
_user = username;
public AboutDaemon(IBus bus, UserTuple user) {
_user = user.name;
_bus = bus;
_dispose = bus.subscribe(SparkTags.About).OnDispatcher().Subscribe(_ => show_about());
}
@@ -63,4 +58,4 @@ namespace bts.ui {
Disposable.dispose(ref _dispose);
}
}
}
}
+44 -7
View File
@@ -7,13 +7,11 @@ using mbts.ui;
using System;
using System.ComponentModel.Composition;
using System.Reactive.Linq;
using System.Windows.Threading;
using System.Windows;
using System.Threading.Tasks;
using mbts.ui.shell;
using System.Windows;
using System.Windows.Threading;
namespace bts.spark
{
namespace bts.spark {
[Export, Export(typeof(IShellDaemon))]
public class ErrorReporter : IShellDaemon, IDisposable {
readonly ErrorReportService _svc;
@@ -21,9 +19,9 @@ namespace bts.spark
IDisposable _dispose;
[ImportingConstructor]
public ErrorReporter(ErrorReportService svc, IBus bus, [Import(LoginContainer.Exports.UserName)] string username) {
public ErrorReporter(ErrorReportService svc, IBus bus, UserTuple user) {
_svc = svc;
_username = username;
_username = user.name;
_dispose = bus.subscribe(SparkTags.Support).OnDispatcher().Subscribe(msg => show_support_window(msg, "Report a problem"));
}
@@ -48,6 +46,45 @@ namespace bts.spark
ErrorMessage = message,
});
}
public async Task report_silently(string contact, string description, string userdata) {
var request = append_logs(new ErrorReport {
User = _username,
ErrorMessage = description,
UserDescription = userdata,
Contact = contact
}.immutable());
var reply = await _svc.send_report_async(request);
}
public static ErrorReportImmutable append_logs(ErrorReportImmutable src) {
var result = src.CloneToMutable();
var windows_log = LogUtil.read_windows_event_log();
if (!windows_log.IsEmpty) {
result.Files.Add(new FileData {
Name = "Application.evtx.gz",
Contents = windows_log
});
}
var (data,date) = LogUtil.read_latest_crash_dump();
if (!data.IsEmpty) {
result.Files.Add(new FileData {
Name = $"spark-{date.ToString("s")}.dmp.gz",
Contents = data
});
}
var spark_log = LogUtil.read_logs_compressed();
if (!spark_log.IsEmpty) {
result.Files.Add(new FileData {
Name = "log.gz",
Contents = spark_log
});
}
return result.immutable();
}
}
static class ErrorReporterExtensions {
+13 -21
View File
@@ -1,5 +1,6 @@
using bts.api;
using bts.api.synthetic;
using bts.md;
using mbts;
using mbts.co2;
using mbts.spark;
@@ -7,15 +8,10 @@ using mbts.ui;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Reactive.Linq;
using System.Threading.Tasks;
using System.Linq;
using SecurityKey = System.UInt32;
using System.Collections.Concurrent;
using System.Threading;
using bts.api.user;
using bts.md;
using mbts.ui.shell;
namespace bts {
[Export(typeof(IInitializable))]
@@ -25,17 +21,21 @@ namespace bts {
readonly Lazy<SyntheticSecurityService> _ss;
readonly Dictionary<SecurityKey, SecurityMD> _deleted_synthetics = new Dictionary<SecurityKey, SecurityMD>();
static uint get_naggle() => mbts.config.Configuration.get<md.RelayOptions>().naggle_ms;
[ImportingConstructor]
public MDDaemon(Lazy<IBus> bus, Lazy<AuthTokenImmutable> token, Lazy<SyntheticSecurityService> ss, [Import(LoginContainer.Exports.UserID)]uint user_id) :
base(get_naggle(), MDSourceOptions.DeferInit, user_id) {
public MDDaemon(Lazy<IBus> bus, Lazy<AuthTokenImmutable> token, Lazy<SyntheticSecurityService> ss, UserTuple user)
: base(mbts.config.Configuration.get<md.RelayOptions>().naggle_ms, MDSourceOptions.DeferInit, user) {
_bus = bus;
_token = token;
_ss = ss;
_ss = ss;
}
override public void initialize() {
public int priority => 55;
[Export]
MDConsumer consumer => _consumer;
IBus bus => _bus.Value;
public override void initialize() {
_relay.set_token(_token.Value);
_dispose.Add(
_ss.Value.subscribei_metadata()
@@ -60,16 +60,8 @@ namespace bts {
// Post full dictionary of syntheics here
bus.post(SparkTags.SyntheticstrategiesTag, t);
}));
_dispose.Add( this.on_securities.Subscribe( (md) => {
bus.post(SparkTags.SecuritiesTag, md);
}));
_dispose.Add(on_securities.Subscribe(md => bus.post(SparkTags.SecuritiesTag, md)));
Task.Run(run);
}
[Export]
MDConsumer consumer => _consumer;
public int priority => 55;
IBus bus => _bus.Value;
}
}
+55
View File
@@ -0,0 +1,55 @@
using System;
using System.ComponentModel.Composition;
using mbts.ui;
using mbts;
using Newtonsoft.Json;
using System.Threading.Tasks;
namespace bts.spark {
[Export(typeof(IShellDaemon))]
class OopsDaemon : IShellDaemon, IDisposable {
[ImportingConstructor]
public OopsDaemon(ErrorReporter e) {
var pid = get_pid();
if (pid.HasValue) {
handle_unclean_shutdown(e, pid.Value);
}
save_pid();
}
public void Dispose() {
clear_pid();
}
void handle_unclean_shutdown(ErrorReporter e, int oldpid) {
string extra = "";
try {
var conf = mbts.config.Configuration.get<bts.config.System>();
extra = JsonConvert.SerializeObject(conf, Formatting.Indented);
}
catch { }
Task.Run(() => e.report_silently(
$"Host: {Environment.MachineName}",
$"pid: {oldpid}\n{extra}",
"Automated crash report")
);
}
const string _subkey = @"Software\BTS";
private void save_pid() {
using (var key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(_subkey)) {
key.SetValue("pid", System.Diagnostics.Process.GetCurrentProcess().Id, Microsoft.Win32.RegistryValueKind.DWord);
}
}
private void clear_pid() {
using (var key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(_subkey)) {
key.DeleteValue("pid",false);
}
}
private int? get_pid() {
using (var key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(_subkey)) {
return key.GetValue("pid") as int?;
}
}
}
}
@@ -43,6 +43,11 @@ namespace bts.shell {
void _show_order_window(Window window) {
foreach (var kv in AlgoStudioModelUtils.get_dynamic_resources(_model.algo_model.ui_configuration))
window.Resources[kv.Key] = kv.Value;
// the dynamic algo 'SecurityKey' template has a ContractPickerPopup that expects the security map to be available as a DynamicResource.
var sub = _bus.subscribe(SparkTags.SecuritiesTag)
.OnDispatcher()
.Subscribe(sec_map => window.Resources[ResourceKeys.Securities] = sec_map);
window.Closed += (s, e) => Disposable.dispose(ref sub);
window.Show(-200, -160, true);
}
@@ -3,17 +3,13 @@ using bts.metrics;
using mbts;
using mbts.config;
using mbts.ui;
using mbts.ui.shell;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
namespace bts.perf {
[Export, Export(typeof(IShellDaemon))]
class ShellLatencyDaemon : IShellDaemon, IDisposable {
readonly ShellLatencyService _service;
@@ -24,10 +20,10 @@ namespace bts.perf {
Ping _pinger = new Ping();
[ImportingConstructor]
public ShellLatencyDaemon(ShellLatencyService service, [Import(LoginContainer.Exports.UserName)] string user) {
public ShellLatencyDaemon(ShellLatencyService service, UserTuple user) {
_service = service;
_version = Configuration.get<bts.config.System>().version;
_username = user;
_username = user.name;
_hostname = Environment.MachineName;
_forever_ping_host(_pinger);
@@ -105,4 +101,4 @@ namespace bts.perf {
Disposable.dispose(ref _subs);
}
}
}
}
@@ -5,7 +5,6 @@ using mbts.co2;
using mbts.persist;
using mbts.spark;
using mbts.ui;
using mbts.ui.shell;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
@@ -13,13 +12,11 @@ using System.Threading.Tasks;
using System.Windows.Media;
using static mbts.ui.shell.ProtoBufSerializationHelper;
namespace bts.shell
{
namespace bts.shell {
[Export(typeof(IShellModule))]
class MarketShellModule : IShellModule
{
class MarketShellModule : IShellModule {
[ImportingConstructor]
public MarketShellModule(IBus bus, MDConsumer consumer, UserSettingsHub settings_hub, OrdersModel orders_model, [Import(LoginContainer.Exports.UserName)]string user_name) {
public MarketShellModule(IBus bus, MDConsumer consumer, UserSettingsHub settings_hub, OrdersModel orders_model) {
_tsf = new TimeAndSalesWindowFactory(this, bus, consumer, settings_hub);
_mvf = new MarketViewWindowFactory(this, bus, settings_hub, orders_model);
}
@@ -26,6 +26,7 @@ namespace mbts.spark {
readonly ObservableFilterCollection<OrderRecordImmutable> _working_orders, _working_bids, _working_asks;
readonly string _security_text, _security_key_text;
readonly Property<double> _bid_price, _ask_price, _last_price, _day_change, _settlement, _session_high, _session_low;
readonly Property<bool> _last_price_from_spread;
readonly CellProperty<int> _position;
readonly CellProperty<uint> _last_size;
readonly CellProperty<ulong> _volume;
@@ -54,6 +55,7 @@ namespace mbts.spark {
_day_change = backing(nameof(day_change), double.NaN);
_session_low = backing(nameof(session_low), double.NaN);
_session_high = backing(nameof(session_high), double.NaN);
_last_price_from_spread = backing(nameof(last_price_from_spread), false);
_settlement = backing(nameof(settlement), double.NaN);
_volume = new CellProperty<ulong>(this, nameof(volume), 0);
_inside_bids = new CellProperty<bool>(this, nameof(inside_bids));
@@ -109,6 +111,7 @@ namespace mbts.spark {
public int position => _position.value;
public double raw_day_position => _raw_day_position;
public double last_price => _last_price.Value;
public bool last_price_from_spread => _last_price_from_spread.Value;
public uint last_size => _last_size.value;
public double bid_price => _bid_price.Value;
public uint bid_direct_size => _bid_direct_size.Value;
@@ -167,15 +170,17 @@ namespace mbts.spark {
_inside_bids.on_next_distinct(_bid_price.Value >= _working_best_bid.value, ref dirty);
_inside_asks.on_next_distinct(_ask_price.Value <= _working_best_ask.value, ref dirty);
}
if (md.md.get_last_trade(ref _last_ref, out NativePriceSize ps, out DateTime ts, out ulong v)) {
if (md.md.get_last_trade(ref _last_ref, out NativePriceSize ps, out DateTime ts, out ulong v, out bool from_spread)) {
_last_price.set(ps.price);
_last_price_from_spread.set(from_spread);
_last_size.on_next_distinct(ps.size, ref dirty);
_volume.on_next_distinct(v, ref dirty);
}
_settlement.set(md.md.settlement_price);
_session_low.set(md.md.session_low);
_session_high.set(md.md.session_high);
_day_change.set(last_price - settlement);
dirty |= _settlement.set_new(md.md.settlement_price);
dirty |= _session_low.set_new(md.md.session_low);
dirty |= _session_high.set_new(md.md.session_high);
dirty |= _day_change.set_new(last_price - settlement);
_volume.on_next_distinct(md.md.total_volume, ref dirty);
if (dirty)
invalidated?.Invoke();
@@ -38,7 +38,8 @@ namespace mbts.spark {
IMultiValueConverter price_converter = new ui.spark.converters.TickDisplayConverter();
add_col(Columns.Security, "Security", r => r.security.ToString(), nameof(Row.security), DefaultColumnWidths.Security, security_filter, DataGridFilterKnownTemplates.Regex);
add_col(Columns.Volume, "Volume", r => r.volume.ToString(), nameof(Row.volume), DefaultColumnWidths.Volume, volume_filter, DataGridFilterKnownTemplates.ULongMinMax);
add_col(Columns.Last, "Last", r => r.format_price(r.last_price), nameof(Row.last_price), DefaultColumnWidths.Price, last_price_filter, DataGridFilterKnownTemplates.DoubleMinMax);
add_col(Columns.LastSpd, "Spd", r => r.last_price_from_spread ? "S" : "", nameof(Row.last_price_from_spread), DefaultColumnWidths.Side, last_price_from_spread_filter, DataGridFilterKnownTemplates.Regex);
add_col(Columns.Last, "Last", r => r.format_price(r.last_price), nameof(Row.last_price), DefaultColumnWidths.Price, last_price_filter, DataGridFilterKnownTemplates.DoubleMinMax);
add_col(Columns.LastSize, merged_size_col_header, r => r.last_size.ToString(), nameof(Row.last_size), DefaultColumnWidths.Size, last_size_filter, DataGridFilterKnownTemplates.UIntMinMax, h_alignment: System.Windows.HorizontalAlignment.Right);
add_col(Columns.Position, "Pos", r => r.position.ToString(), nameof(Row.position), DefaultColumnWidths.Size, position_filter, DataGridFilterKnownTemplates.IntMinMax, true, h_alignment: System.Windows.HorizontalAlignment.Right);
add_col(Columns.RawDayPosition, "Raw Day Pos", r => SparkUtils.fmt_position(r.raw_day_position), nameof(Row.raw_day_position), DefaultColumnWidths.Size, raw_day_position_filter, DataGridFilterKnownTemplates.DoubleMinMax, true, h_alignment: System.Windows.HorizontalAlignment.Right);
@@ -138,6 +139,7 @@ namespace mbts.spark {
ask_direct_size_filter.load_state(filters.ask_direct_size);
ask_implied_size_filter.load_state(filters.ask_implied_size);
last_price_filter.load_state(filters.last_price);
last_price_from_spread_filter.load_state(filters.last_price_from_spread);
last_size_filter.load_state(filters.last_size);
day_change_filter.load_state(filters.day_change);
settlement_filter.load_state(filters.settlement);
@@ -155,7 +157,7 @@ namespace mbts.spark {
}), DataGridFilterHelper.hook_filters(rows_view, security_filter,
bid_price_filter, bid_merged_size_filter, bid_direct_size_filter, bid_implied_size_filter,
ask_price_filter, ask_merged_size_filter, ask_direct_size_filter, ask_implied_size_filter,
last_price_filter, last_size_filter, day_change_filter, settlement_filter,
last_price_filter, last_price_from_spread_filter, last_size_filter, day_change_filter, settlement_filter,
session_low_filter, session_high_filter, position_filter, raw_day_position_filter, working_bid_volume_filter, working_ask_volume_filter, volume_filter, security_key_filter),
settings_manager.subscribe_current().OnDispatcher().Subscribe(grid_settings_manager),
WorkLoop.Start("MarketView", _refresh)
@@ -218,6 +220,7 @@ namespace mbts.spark {
public IDataGridColumnPersistentFilter<Row, UIntMinMaxState> ask_direct_size_filter { get; } = new UIntMinMax<Row>(r => r.ask_direct_size, nameof(Row.ask_direct_size));
public IDataGridColumnPersistentFilter<Row, UIntMinMaxState> ask_implied_size_filter { get; } = new UIntMinMax<Row>(r => r.ask_implied_size, nameof(Row.ask_implied_size));
public IDataGridColumnPersistentFilter<Row, DoubleMinMaxState> last_price_filter { get; } = new DoubleMinMax<Row>(r => r.last_price, nameof(Row.last_price));
public IDataGridColumnPersistentFilter<Row, string> last_price_from_spread_filter { get; } = new RegexFilterVM<Row>(r => r.last_price_from_spread.ToString(), nameof(Row.last_price_from_spread));
public IDataGridColumnPersistentFilter<Row, UIntMinMaxState> last_size_filter { get; } = new UIntMinMax<Row>(r => r.last_size, nameof(Row.last_size));
public IDataGridColumnPersistentFilter<Row, DoubleMinMaxState> day_change_filter { get; } = new DoubleMinMax<Row>(r => r.day_change, nameof(Row.day_change));
public IDataGridColumnPersistentFilter<Row, DoubleMinMaxState> settlement_filter { get; } = new DoubleMinMax<Row>(r => r.settlement, nameof(Row.settlement));
@@ -250,6 +253,7 @@ namespace mbts.spark {
ask_direct_size = ask_direct_size_filter.get_state(),
ask_implied_size = ask_implied_size_filter.get_state(),
last_price = last_price_filter.get_state(),
last_price_from_spread = last_price_from_spread_filter.get_state(),
last_size = last_size_filter.get_state(),
day_change = day_change_filter.get_state(),
settlement = settlement_filter.get_state(),
@@ -12,6 +12,7 @@ namespace mbts.ui.spark {
Security,
Volume,
Last,
LastSpd,
LastSize,
Position,
RawDayPosition,
@@ -100,6 +100,7 @@ namespace bts.shell {
public static GridColumnSettings security => new GridColumnSettings(col_id(Columns.Security), DefaultColumnHeaders.Security, width: DefaultColumnWidths.Security);
public static GridColumnSettings volume => new GridColumnSettings(col_id(Columns.Volume), DefaultColumnHeaders.Volume, width: DefaultColumnWidths.Volume);
public static GridColumnSettings last => new GridColumnSettings(col_id(Columns.Last), DefaultColumnHeaders.Last, width: DefaultColumnWidths.Price);
public static GridColumnSettings last_from_spread => new GridColumnSettings(col_id(Columns.LastSpd), DefaultColumnHeaders.S, width: DefaultColumnWidths.Price, is_visible: false);
public static GridColumnSettings last_size => new GridColumnSettings(col_id(Columns.LastSize), DefaultColumnHeaders.Size, width: DefaultColumnWidths.Size, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings position => new GridColumnSettings(col_id(Columns.Position), DefaultColumnHeaders.Pos, width: DefaultColumnWidths.Size, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings raw_day_position => new GridColumnSettings(col_id(Columns.RawDayPosition), DefaultColumnHeaders.RawDayPos, width: DefaultColumnWidths.Size, horizontal_alignment: System.Windows.HorizontalAlignment.Right, is_visible: false);
@@ -138,6 +139,7 @@ namespace bts.shell {
yield return security;
yield return volume;
yield return last;
yield return last_from_spread;
yield return last_size;
yield return position;
yield return raw_day_position;
@@ -224,6 +226,8 @@ namespace bts.shell {
[ProtoMember(25)]
public string strip_name;
[ProtoMember(26)]
public string last_price_from_spread;
[ProtoMember(28)]
public string mic_code;
}
@@ -227,7 +227,7 @@ namespace mbts.ui.spark {
}
DataGridColumn _column_factory(LegSpreaderParamsTuple l) {
var col = new DataGridColumnInternal(l.leg.Security, ParameterCellTemplateConverter, ParameterCellEditingTemplateConverter) { Width = 75, };
var col = new DataGridColumnInternal(l.leg.Security, ParameterCellTemplateConverter, ParameterCellEditingTemplateConverter);
col.HeaderTemplate = (DataTemplate)FindResource(IsNew ? RemovableColumnHeaderTemplateKey : NonRemovableColumnHeaderTemplateKey);
DataGridEx.SetRightBorder(col, new DataGridExVerticalLine(false, true, Colors.DarkGray, 1));
return col;
@@ -1,7 +1,9 @@
using bts.api;
using bts;
using bts.api;
using bts.api.core;
using bts.api.synthetic;
using bts.collections;
using bts.spark;
using mbts.ui.shell;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
@@ -18,11 +20,36 @@ namespace mbts.spark {
readonly uint _user_id;
[ImportingConstructor]
public SpreaderModel(IBus bus, SyntheticSecurityService service, ErrorReporter error, [Import(LoginContainer.Exports.UserID)]uint user_id) {
public SpreaderModel(IBus bus, SyntheticSecurityService service, AdminModel admin_model, ErrorReporter error, UserTuple user) {
_bus = bus;
_service = service;
_error = error;
_user_id = user_id;
_user_id = user.id;
// synthetic tuples
var strategy_source = _bus.subscribe(SparkTags.SyntheticstrategiesTag)
.Select(map => MappedDictionary.create<uint, ExecutionStrategyImmutable, (uint security_id, ExecutionStrategyImmutable strategy)>(map, (k, v) => (k, v)))
.Table(tup => tup.security_id);
var synthetic_source = _bus.subscribe(SparkTags.SecuritiesTag)
.Select(map => new FilteredDictionary<uint, SecurityMD>(map, smd => smd.security.ContractCase == Security.ContractOneofCase.Synthetic))
.Table(smd => smd.security.Id);
var synthetic_user_join = synthetic_source.LeftJoin(
admin_model.all_user_tuples,
SecurityMD.key_fn,
UserTuple.key_fn,
smd => smd.security.Synthetic.UserId,
(smd, sid, ut, uid) => new SyntheticTuple(smd.security, ut.name, null),
(smd, sid, uid) => new SyntheticTuple(smd.security, null, null),
SyntheticTuple.key_fn);
synthetic_tuples = synthetic_user_join.LeftJoin(
strategy_source,
SyntheticTuple.key_fn,
tup => tup.security_id,
(synth_tup, id, strat_tup) => new SyntheticTuple(synth_tup.security, synth_tup.user_name, strat_tup.strategy),
(synth_tup, id) => synth_tup,
SyntheticTuple.key_fn);
}
public IObservable<IReadOnlyDictionary<uint, ExecutionStrategyImmutable>> strategy => _bus.subscribe(SparkTags.SyntheticstrategiesTag);
@@ -36,6 +63,8 @@ namespace mbts.spark {
.LeftJoin(strategies, (security, strategy) => (new ExecutionStrategyImmutable?(strategy), security), security => (new ExecutionStrategyImmutable?(), security))
);
public IObservable<TableUpdate<SyntheticTuple, uint>> synthetic_tuples { get; }
public IObservable<ExecutionStrategyImmutable> security_strategy(uint security_key) =>
strategy.TrySelect(s => {
bool success = s.TryGetValue(security_key, out ExecutionStrategyImmutable result);
@@ -81,9 +81,9 @@ namespace bts.shell {
#region QuoteParams
public static QuoteParams QuoteParams => new QuoteParams {
LeanQuantityRatio = 1,
QuoteInsideMarketDistance = QuoteInsideMarketDistance,
//QuoteInsideMarketDistance = QuoteInsideMarketDistance,
QuoteMaxOrderMove = QuoteMaxOrderMove,
QuoteMuteZone = QuoteMuteZone,
//QuoteMuteZone = QuoteMuteZone,
QuoteRepriceThrottle = QuoteRepriceThrottle,
QuoteInsideMarketDistanceWithTravel = QuoteInsideMarketDistanceWithTravel,
};
@@ -113,6 +113,7 @@ namespace bts.shell {
};
public static QuoteInsideMarketDistanceWithTravel QuoteInsideMarketDistanceWithTravel => new QuoteInsideMarketDistanceWithTravel { Priority = RulePriority };
public static QuoteInsideMarketDistance QuoteInsideMarketDistance => new QuoteInsideMarketDistance { Priority = RulePriority };
public static QuoteInsideMarketDistanceThrottle QuoteInsideMarketDistanceThrottle => new QuoteInsideMarketDistanceThrottle();
#endregion
#region PreHedge
@@ -7,8 +7,15 @@ namespace mbts.ui.spark {
/// Interaction logic for SyntheticManagementView.xaml
/// </summary>
partial class SyntheticManagementView : UserControl {
public enum Columns {
Name,
Description,
n_legs,
n_working_orders,
SecurityKey,
User
}
public enum Columns { Name, Description, n_legs, n_working_orders, SecurityKey}
public SyntheticManagementView() =>
InitializeComponent();
}
@@ -10,6 +10,7 @@ using mbts.ui.utility;
using mbts.utils;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Reactive.Linq;
using System.Windows;
@@ -27,7 +28,7 @@ namespace mbts.spark {
readonly IWindowSettingsManager<GridSettings> _settings_manager;
public SyntheticManagementWindow(SyntheticManagementWindowFactory factory, IBus bus, OrdersModel orders_model, StartupData state, WindowSettingsManager<GridSettings> settings_manager)
public SyntheticManagementWindow(SyntheticManagementWindowFactory factory, IBus bus, OrdersModel orders_model, StartupData state, IWindowSettingsManager<GridSettings> settings_manager)
: base("Synthetic Management", bus, factory, SparkCommands.ShowSyntheticManagement.icon) {
_orders_model = orders_model;
_state = state;
@@ -66,8 +67,8 @@ namespace mbts.spark {
), SparkCommand.create("Clone", Icons.CloneSynthetic, SparkTags.ShowSyntheticCloneTag).complete(
current_row_connectable_builder.create(observe_row_strategy),
rs => rs.HasValue, select_row_strategy_tuple
), SparkCommands.ShowLadder(SparkCommands.KeyGestures.ShowLadder).complete(
vm_connectable_builder.create(vm => vm.current_security_md), md => md.HasValue, ConvertUtils.ValueOrDefault
), SparkCommands.ShowLadderAutoLookup(SparkCommands.KeyGestures.ShowLadder).complete(
vm_connectable_builder.create(vm => vm.current_security_observable.Select(s => s.HasValue ? ImmutableHashSet<uint>.Empty.Add(s.Value.Id) : null)), id => id != null
), SparkCommands.ShowOrders.complete(() => {
var ob_settings = bts.shell.orderbook.OrderBookStartupData.Default;
ob_settings.filters = new bts.shell.orderbook.FilterStates {
@@ -1,4 +1,5 @@
using bts.api;
using bts.settings;
using mbts.persist;
using mbts.spark;
using mbts.spark.filters;
@@ -7,6 +8,7 @@ using mbts.ui.settings;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Reactive.Linq;
using System.Threading.Tasks;
using static mbts.ui.controls.DIYGrid;
@@ -33,13 +35,8 @@ namespace bts.shell {
public async void show(SparkTags.Nothing nothing) =>
_bus.post(SparkTags.ShowWindow, await load(new StartupData()));
IShellWindow _create(StartupData state) {
var settings_manager = new WindowSettingsManager<GridSettings>(_settings_hub,
state.grid,
get: us => us.synthetic_management_grid,
set: (us, gs) => us.with(provided_synthetic_management_gridsettings: gs));
return new SyntheticManagementWindow(this, _bus, _orders_model, state, settings_manager);
}
IShellWindow _create(StartupData state) =>
new SyntheticManagementWindow(this, _bus, _orders_model, state, _settings_hub.create_synth_settings_manager(state.grid));
[ProtoContract]
public class StartupData {
@@ -67,6 +64,7 @@ namespace bts.shell {
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, is_visible: false, width: DefaultColumnWidths.SecurityKey);
public static GridColumnSettings user => new GridColumnSettings(col_id(Columns.User), DefaultColumnHeaders.User, is_visible: false, width: DefaultColumnWidths.User);
public static IEnumerable<SortingCriteria> default_sorting_criterion {
get {
@@ -81,6 +79,7 @@ namespace bts.shell {
yield return n_legs;
yield return n_working_orders;
yield return security_key;
yield return user;
}
}
@@ -101,6 +100,15 @@ namespace bts.shell {
public UIntMinMaxState n_working_orders;
[ProtoMember(6)]
public string security_key;
[ProtoMember(7)]
public uint[] user;
}
// migration rules
[Export(typeof(ISyntheticManagementMigrationRule))]
class AddMissingColumnsMigrationRule : ISyntheticManagementMigrationRule {
public bool apply(GridSettings settings, out GridSettings new_settings) =>
settings.add_missing_columns(StartupData.DefaultGridSettings.columns, out new_settings);
}
}
}
}
@@ -0,0 +1,33 @@
using bts.shell;
using mbts.ui.spark;
namespace mbts.spark {
partial class SyntheticEditorVM {
class QuoteInsideMarketDistanceEnabledModel : RowModelBase<bool> {
readonly QuoteInsideMarketDistanceTowardModel _toward;
public QuoteInsideMarketDistanceEnabledModel(QuoteInsideMarketDistanceTowardModel toward) =>
_toward = toward;
public override string display_name { get; } = string.Empty;
public override string help_text { get; } = string.Empty;
public override string man_page { get; } = string.Empty;
public override ParameterSection[] section_path { get; } = new[] { Sections.Quote, Subsections.InsideMarketDistance };
public override bool get_value(LegSpreaderParamsTuple leg_tup) =>
leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceThrottle != null;
public override void set_value(LegSpreaderParamsTuple leg_tup, bool value) {
if (value) {
if (leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceThrottle == null) {
leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceThrottle = SyntheticDataHelper.Defaults.QuoteInsideMarketDistanceThrottle;
_toward.apply_value(leg_tup);
}
} else {
leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceThrottle = null;
}
_toward.set_enabled(leg_tup, value);
}
}
}
}
@@ -0,0 +1,39 @@
using bts.spark;
using mbts.ui.spark;
using System.Collections.Generic;
namespace mbts.spark {
partial class SyntheticEditorVM {
class QuoteInsideMarketDistanceTowardModel : RowModelBase<uint> {
IDictionary<uint, uint> _value_store = new Dictionary<uint, uint>();
public override string display_name { get; } = "Toward Distance";
public override string help_text { get; } = string.Empty;
public override string man_page { get; } = string.Empty;
public override ParameterSection[] section_path { get; } = new[] { Sections.Quote, Subsections.InsideMarketDistance };
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
_get_inside_market_distance(leg_tup).OnTowardDistance = _value_from_store(leg_tup);
public override uint get_value(LegSpreaderParamsTuple leg_tup) =>
_get_inside_market_distance(leg_tup) is QuoteInsideMarketDistanceThrottle inside_market_distance ?
inside_market_distance.OnTowardDistance :
_value_from_store(leg_tup);
public override void set_value(LegSpreaderParamsTuple leg_tup, uint value) {
_value_store[leg_tup.SecurityKey] = value;
if (_get_inside_market_distance(leg_tup) is QuoteInsideMarketDistanceThrottle inside_market_distance)
inside_market_distance.OnTowardDistance = value;
}
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
_get_inside_market_distance(leg_tup) != null;
QuoteInsideMarketDistanceThrottle _get_inside_market_distance(LegSpreaderParamsTuple leg_tup) =>
leg_tup.leg_params.QuoteParams.QuoteInsideMarketDistanceThrottle;
uint _value_from_store(LegSpreaderParamsTuple leg_tup) =>
_value_store.GetValueOrDefault(leg_tup.SecurityKey);
}
}
}
@@ -115,6 +115,11 @@ namespace mbts.spark {
"dictates if this logic applies to the quoting market or to the synthetic spread " +
"market");
public static ParameterSection InsideMarketDistance =>
new ParameterSection("Inside Market Distance", true,
"Reduces re-quoting by throttling quotes that are moving toward the inside market " +
"but are more than 'Toward Distance' away from the inside market");
public static ParameterSection InsideMarketThrottleThresholds =>
new ParameterSection("Inside Market Throttle Thresholds", true,
"Reduces re-quoting for quotes that are moving toward the inside market. " +
@@ -190,6 +190,8 @@ namespace mbts.spark {
var quote_inside_market_throttle_ticks = new QuoteInsideMarketThrottleTicksModel();
var quote_inside_market_throttle_min_move = new QuoteInsideMarketThrottleMinMoveModel();
var quote_inside_market_distance_toward = new QuoteInsideMarketDistanceTowardModel();
var pre_hedge_payless_threshold = new PreHedgePaylessThresholdModel();
var pre_hedge_payless_ticks = new PreHedgePaylessTicksModel();
@@ -227,6 +229,8 @@ namespace mbts.spark {
//quote_inside_market_throttle_ticks,
//quote_inside_market_throttle_min_move,
//new MaxTicksInsideMarketModel(),
new QuoteInsideMarketDistanceEnabledModel(quote_inside_market_distance_toward),
quote_inside_market_distance_toward,
new PreHedgePaylessEnabledModel(pre_hedge_payless_threshold, pre_hedge_payless_ticks),
pre_hedge_payless_threshold,
pre_hedge_payless_ticks,
@@ -1,12 +1,15 @@
using bts.api;
using bts;
using bts.api;
using bts.collections;
using bts.spark;
using bts.utils;
using mbts.persist;
using mbts.spark.filters;
using mbts.ui;
using mbts.ui.settings;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
@@ -17,43 +20,45 @@ using static mbts.ui.controls.DIYGrid;
using static mbts.ui.spark.SyntheticManagementView;
namespace mbts.spark {
class SyntheticManagementDialogVM : SecurityMDGrid<SyntheticManagementDialogVM.Row, (ExecutionStrategyImmutable? strategy, SecurityMD md)> {
class SyntheticManagementDialogVM : SecurityGrid<SyntheticManagementDialogVM.Row, SyntheticTuple> {
readonly IBus _bus;
readonly OrdersModel _orders_model;
IWindowSettingsManager<GridSettings> _settings_manager;
readonly IWindowSettingsManager<GridSettings> _settings_manager;
public SyntheticManagementDialogVM(IBus bus, OrdersModel orders_model, IWindowSettingsManager<GridSettings> settings_manager) : this(bus, orders_model, settings_manager, null, null) { }
public SyntheticManagementDialogVM(IBus bus, OrdersModel orders_model, IWindowSettingsManager<GridSettings> settings_manager, IReadOnlyCollection<SortingCriteria> sorting, FilterStates filters)
: base(orders_model.spreader.strategy_tuple.Select(map => map.Values), sorting) {
: base(orders_model.spreader.synthetic_tuples.Select(t => t.state.Values), sorting) {
_bus = bus;
_orders_model = orders_model;
_settings_manager = settings_manager;
// init filters
user_filter = DiscreteValuesFilterVM.CreateTableUpdate<Row, UserTuple, uint>(r => r.user_tuple, UserTuple.key_fn, out var user_filter_items_observer, out var user_filter_items_view, nameof(Row.user_tuple));
user_filter_items_view.CustomSort = Comparer<string>.Default.wrap<string, UserTuple>(ut => ut.name).to_non_generic();
if (filters != null) {
create_time_filter.load_state(filters.create_time);
name_filter.load_state(filters.name);
description_filter.load_state(filters.description);
n_legs_filter.load_state(filters.n_legs);
n_working_orders_filter.load_state(filters.n_working_orders);
security_key_filter.load_state(filters.security_key);
security_key_filter.load_state(filters.security_key);
user_filter.load_state(filters.user);
}
_settings_manager = settings_manager;
// columns
add_col(Columns.Name, DefaultColumnHeaders.Name, r => r.name, nameof(Row.name), name_filter, DataGridFilterKnownTemplates.Regex, DefaultColumnWidths.Security);
add_col(Columns.Description, DefaultColumnHeaders.Description, r => r.description, nameof(Row.description), description_filter, DataGridFilterKnownTemplates.Regex, DefaultColumnWidths.Description);
add_col(Columns.n_legs, DefaultColumnHeaders.N_Legs, r => r.n_legs.ToString(), nameof(Row.n_legs), n_legs_filter, DataGridFilterKnownTemplates.IntMinMax, DefaultColumnWidths.N_Legs);
columns.Add(new HyperlinkElementColumn<Row, Columns>(
Columns.n_working_orders,
new Binding(nameof(Row.n_working_orders)),
Columns.n_working_orders,
new Binding(nameof(Row.n_working_orders)),
new Binding(nameof(Row.show_order_book)),
n_working_orders_filter,
DataGridFilterKnownTemplates.UIntMinMax) {
id = col_id(Columns.n_working_orders),
Header = DefaultColumnHeaders.N_Working_Orders,
Width = DefaultColumnWidths.N_Working_Orders
}
);
});
add_col(Columns.SecurityKey, DefaultColumnHeaders.SecurityKey, r => r.security_key.ToString(), nameof(Row.security_key), security_key_filter, DataGridFilterKnownTemplates.Regex, DefaultColumnWidths.SecurityKey);
add_col(Columns.User, DefaultColumnHeaders.User, r => r.user_name, nameof(Row.user_name), user_filter, DataGridFilterKnownTemplates.DiscreteValues, DefaultColumnWidths.User);
//
void add_col(Columns col_key, string header, Func<Row, string> get_text, string prop, IDataGridColumnFilter filter, string filter_template, double width) =>
columns.Add(new RenderTextColumn<Row, Columns>(col_key, get_text, filter, filter_template) {
@@ -63,42 +68,39 @@ namespace mbts.spark {
Width = width
});
//
grid_settings_manager = new SimpleGridSettingsManager<Row>(columns, new Dictionary<string, GridColumnSettingsFeatureFlags> { }, row_vms);
grid_settings_manager = new SimpleGridSettingsManager<Row>(columns, DictionaryHelper.empty<string, GridColumnSettingsFeatureFlags>(), row_vms);
// this will initialize the immutable properties that correspond to the col_settings_flags above (e.g. Bid/Ask font_color_override, etc.)
grid_settings_manager.load_from(settings_manager.current_settings());
_resources.AddRange(
DataGridFilterHelper.hook_filters(rows_view, create_time_filter, name_filter, description_filter, n_legs_filter, n_working_orders_filter, security_key_filter),
orders_model.admin_model.all_user_tuples.OnDispatcher().Subscribe(user_filter_items_observer),
DataGridFilterHelper.hook_all<SyntheticManagementDialogVM, Row>(this, rows_view),
settings_manager.subscribe_current().OnDispatcher().Subscribe(grid_settings_manager)
);
}
protected override Row row_factory((ExecutionStrategyImmutable? strategy, SecurityMD md) row_model) =>
new Row(_bus, row_model.md, row_model.strategy, _orders_model);
protected override void on_row_removed(Row row) => row.Dispose();
public ObservableCollection<ColumnBase> columns { get; } = new ObservableCollection<ColumnBase>();
public ObservableCollection<ColumnBase> columns { get; } = new ObservableCollection<ColumnBase>();
public SimpleGridSettingsManager<Row> grid_settings_manager { get; }
public GridSettings get_grid_save_state() {
if (_settings_manager.instance_settings == null)
return null;
else
return grid_settings_manager.create();
}
public StartupData create() =>
new StartupData(rows_view.get_sorting_criteria(columns), _get_filter_states(), get_grid_save_state());
#region Filters
public IDataGridColumnPersistentFilter<Row, TimeFilterTuple> create_time_filter { get; } = new TimeFilterVM<Row>(r => r.create_time, nameof(Row.create_time));
public IDataGridColumnPersistentFilter<Row, string> name_filter { get; } = new RegexFilterVM<Row>(r => r.name, nameof(Row.name));
public IDataGridColumnPersistentFilter<Row, string> description_filter { get; } = new RegexFilterVM<Row>(r => r.description, nameof(Row.description));
public IDataGridColumnPersistentFilter<Row, IntMinMaxState> n_legs_filter { get; } = new IntMinMax<Row>(r => r.n_legs, nameof(Row.n_legs));
public IDataGridColumnPersistentFilter<Row, UIntMinMaxState> n_working_orders_filter { get; } = new UIntMinMax<Row>(r => r.n_working_orders, nameof(Row.n_legs));
public IDataGridColumnPersistentFilter<Row, string> security_key_filter { get; } = new RegexFilterVM<Row>(r => r.security_key.ToString(), nameof(Row.security_key));
public IDataGridColumnPersistentFilter<Row, uint[]> user_filter { get; }
public GridSettings get_grid_save_state() =>
_settings_manager.instance_settings == null ? null : grid_settings_manager.create();
public StartupData create() =>
new StartupData(rows_view.get_sorting_criteria(columns), _get_filter_states(), get_grid_save_state());
protected override Row row_factory(SyntheticTuple row_model) =>
new Row(_bus, row_model, _orders_model);
protected override void on_row_removed(Row row) =>
row.Dispose();
FilterStates _get_filter_states() =>
new FilterStates {
@@ -107,19 +109,19 @@ namespace mbts.spark {
name = name_filter.get_state(),
n_legs = n_legs_filter.get_state(),
n_working_orders = n_working_orders_filter.get_state(),
security_key = security_key_filter.get_state()
security_key = security_key_filter.get_state(),
user = user_filter.get_state()
};
#endregion
public class Row : SecurityMDRow, IEquatable<Row>, IRowVM, IActionableRowVM {
public readonly ExecutionStrategyImmutable? strategy;
public class Row : SecurityRow, IEquatable<Row>, IRowVM, IActionableRowVM {
public readonly SyntheticTuple synthetic_tuple;
readonly IBus _bus;
readonly Property<uint> _n_working_orders;
public Row(IBus bus, SecurityMD security_md, ExecutionStrategyImmutable? strategy, OrdersModel orders_model) : base(security_md) {
public Row(IBus bus, SyntheticTuple synthetic_tuple, OrdersModel orders_model) : base(synthetic_tuple.security) {
_bus = bus;
this.strategy = strategy;
this.synthetic_tuple = synthetic_tuple;
_n_working_orders = backing(nameof(n_working_orders),
orders_model.on_security_orders(security_key)
.Select(t => (uint)(t.state
@@ -133,25 +135,23 @@ namespace mbts.spark {
show_order_book = new DelegateCommand(_show_order_book);
}
public event Action invalidated;
public DateTime create_time => DateTime.MinValue; //TODO
public string name { get; }
public string user_name => synthetic_tuple.user_name;
public UserTuple user_tuple => new UserTuple(synthetic_tuple.security.Synthetic.UserId, user_name);
public int n_legs { get; }
public string description { get; }
public ExecutionStrategyImmutable? strategy => synthetic_tuple.strategy;
public bool strategy_present => strategy.HasValue;
public uint n_working_orders => _n_working_orders.Value;
public ICommand show_ladder { get; }
public ICommand show_order_book { get; }
public ICommand default_command => show_ladder;
public ObservableCollection<RowAnimation> row_animations => new ObservableCollection<RowAnimation>();
public IReadOnlyList<IGridCellStore> cell_stores => new IGridCellStore[0];
public event Action invalidated;
public void raise_invalidated() => invalidated?.Invoke();
public void raise_invalidated() =>
invalidated?.Invoke();
public bool Equals(Row other) =>
other != null &&
@@ -163,10 +163,8 @@ namespace mbts.spark {
public override int GetHashCode() =>
security_key.GetHashCode();
void _show_ladder() =>
_bus.post(SparkTags.ShowLadderTag, md);
_bus.post(SparkTags.ShowLadderAutoLookupTag, ImmutableHashSet<uint>.Empty.Add(security.Id));
void _show_order_book() {
var ob_settings = bts.shell.orderbook.OrderBookStartupData.Default;
@@ -177,4 +175,4 @@ namespace mbts.spark {
}
}
}
}
}
@@ -62,7 +62,10 @@ namespace mbts.spark {
_vm = new AlgoStudioVM(_model);
_vm.load_from(_state);
_view = new AlgoStudioView { DataContext = _vm };
_resources = new CompositeDisposable();
_resources = new CompositeDisposable(
_bus.subscribe(SparkTags.SecuritiesTag)
.OnDispatcher()
.Subscribe(sec_map => _view.Resources[ResourceKeys.Securities] = sec_map));
// add definition
_commands.Add(new SparkCommandCommand("Add Algo", Icons.AddBoxes, _vm.add_definition_cmd));
// clone definition
@@ -27,7 +27,7 @@ namespace mbts.spark {
_error_reporter = error_reporter;
definitions =
service.subscribei_algo_definitions()
.Filter(r => r.Metadata.IsActive && r.Metadata.CreatorUserId == _admin_model.user.id)
.Filter(r => r.Metadata.IsActive && _admin_model.user.can_access_user_data(r.Metadata.CreatorUserId))
.SelectKeyValue(_definition_data, d => d.key)
.Table()
.Cache();
@@ -13,6 +13,9 @@ namespace mbts.spark {
string _template_key;
ICommand _set_value_cmd;
public AlgoParamRowVM(IAlgoVM algo, IAlgoParamVM param, AlgoParamRowVM parent)
: this(algo, param, parent, (param as ITemplateSelectorKey)?.key) { }
public AlgoParamRowVM(IAlgoVM algo, IAlgoParamVM param, AlgoParamRowVM parent, string template_key = null) {
this.param = param;
this.algo = algo;
@@ -247,6 +247,31 @@
</TextBlock>
</DataTemplate>
</u:TemplateSelectorKeyValue>
<u:TemplateSelectorKeyValue Key="{x:Static u:TemplateKeys.SecurityKey}">
<DataTemplate>
<Grid>
<!--Note: Ideally, this 'securities BindingProxy' would be a static resource, but it only seems to detect the dynamic securities when it is in the visual tree.-->
<!--<Grid.Resources>
<u:BindingProxy x:Key="SecuritiesBindingProxy" x:Shared="False" Value="{DynamicResource {x:Static u:ResourceKeys.Securities}}"/>
</Grid.Resources>-->
<u:BindingProxy x:Name="SecuritiesBindingProxy" Value="{DynamicResource {x:Static u:ResourceKeys.Securities}}"/>
<TextBlock>
<TextBlock.Text>
<MultiBinding>
<MultiBinding.Converter>
<cv:MultiValueConverterPipe>
<cv:DictionaryLookupConverter/>
<x:Static MemberType="cv:ValueConverters" Member="SecuritySelectorText"/>
</cv:MultiValueConverterPipe>
</MultiBinding.Converter>
<Binding Path="Value" ElementName="SecuritiesBindingProxy"/>
<Binding Path="param.value"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Grid>
</DataTemplate>
</u:TemplateSelectorKeyValue>
</usp:AlgoParamTemplateSelector.KeyedTemplates>
<!--Bool-->
<usp:AlgoParamTemplateSelector.BoolTemplate>
@@ -320,6 +345,21 @@
</usp:PriceEntryControl>
</DataTemplate>
</u:TemplateSelectorKeyValue>
<u:TemplateSelectorKeyValue Key="{x:Static u:TemplateKeys.SecurityKey}">
<DataTemplate>
<c:ContractPickerPopup
CloseOnCancel="True"
CloseOnOK="True"
Header="{Binding SelectedSecurity, RelativeSource={RelativeSource Self}, Converter={x:Static cv:ValueConverters.SecuritySelectorText}}"
IsEditMode="False"
IsLazy="True"
SecurityMap="{DynamicResource {x:Static u:ResourceKeys.Securities}}"
SelectedSecurityKey="{Binding param.value}"
ShowDialogSkirt="True"
OKClick="{x:Static c:ContractPickerPopup.FlushSelectedSecurityKeyHandler}"
/>
</DataTemplate>
</u:TemplateSelectorKeyValue>
</usp:AlgoParamTemplateSelector.KeyedTemplates>
<!--Bool-->
<usp:AlgoParamTemplateSelector.BoolTemplate>
@@ -118,13 +118,14 @@ namespace mbts.spark {
add_col_expl(Columns.Side, new SideColumn<Row, Columns>(Columns.Side, r => r.side, side_filter) { id = col_id(Columns.Side) }, side_filter);
// all others (easily identified by the enum 'Columns.Foo')
add_col(Columns.FillTime, DefaultColumnHeaders.FillTime, r => r.fill_time.ToString("M/d h:mm:ss tt"), new TimeFilterVM<FillTuple>(r => r.fill.Timestamp.ToDateTimeOffset().LocalDateTime), DataGridFilterKnownTemplates.TimeFilter, DefaultColumnWidths.Time);
add_col(Columns.User, DefaultColumnHeaders.User, r => r.user, dv_filter_rx(_model.factory.subscribe_users().Select(d => d.Values), r => r.order?.user() ?? string.Empty), DataGridFilterKnownTemplates.DiscreteValues, DefaultColumnWidths.User);
add_col(Columns.Account, DefaultColumnHeaders.Account, r => r.account, dv_filter_rx(_model.factory.subscribe_accounts().Select(d => d.Values), r => r.account), DataGridFilterKnownTemplates.DiscreteValues, DefaultColumnWidths.Account);
add_col(Columns.User, DefaultColumnHeaders.User, r => r.user, dv_filter_rx(_model.factory.subscribe_users().Select(d => d.Values.Ordered()), r => r.order?.user() ?? string.Empty), DataGridFilterKnownTemplates.DiscreteValues, DefaultColumnWidths.User);
add_col(Columns.Account, DefaultColumnHeaders.Account, r => r.account, dv_filter_rx(_model.factory.subscribe_accounts().Select(d => d.Values.Ordered()), r => r.account), DataGridFilterKnownTemplates.DiscreteValues, DefaultColumnWidths.Account);
add_col(Columns.Exchange, DefaultColumnHeaders.Exchange, r => r.exchange.ToString(), dv_filter(EnumHelper.get_values<Venue>().ToArray(), r => r.security.exchange_or_default()), DataGridFilterKnownTemplates.DiscreteValues, DefaultColumnWidths.Exchange);
add_col(Columns.TimeInForce, DefaultColumnHeaders.TimeInForce, r => r.time_in_force.ToString(), dv_filter(EnumHelper.get_values<TimeInForce>().ToArray(), r => r.order?.time_in_force() ?? TimeInForce.Undefined), DataGridFilterKnownTemplates.DiscreteValues, DefaultColumnWidths.TimeInForce);
add_col(Columns.Size, DefaultColumnHeaders.Size, r => r.size.ToString(), new DoubleMinMax<FillTuple>(r => r.fill.LastShares), DataGridFilterKnownTemplates.UIntMinMax, DefaultColumnWidths.Size);
add_col(Columns.Price, DefaultColumnHeaders.Price, r => r.format_price(r.price), new DoubleMinMax<FillTuple>(r => r.fill.LastPrice), DataGridFilterKnownTemplates.DoubleMinMax, DefaultColumnWidths.Price);
add_col(Columns.FillKind, DefaultColumnHeaders.FillKind, r => r.fill_kind.ToString(), dv_filter(EnumHelper.get_values<FillKind>().ToArray(), r => r.fill.FillKind), DataGridFilterKnownTemplates.DiscreteValues, DefaultColumnWidths.FillKind);
add_col(Columns.FillStatus, DefaultColumnHeaders.FillStatus, r => r.fill_status.ToString(), dv_filter(EnumHelper.get_values<FillStatus>().ToArray(), r => r.fill.FillStatus), DataGridFilterKnownTemplates.DiscreteValues, DefaultColumnWidths.FillKind);
add_col(Columns.FillKey, DefaultColumnHeaders.FillKey, r => r.fill_key.ToString(), new RegexFilterVM<FillTuple>(r => r.fill.FillKey), DataGridFilterKnownTemplates.Regex, DefaultColumnWidths.FillKey);
add_col(Columns.OrderKey, DefaultColumnHeaders.OrderKey, r => r.order_key.ToString(), new RegexFilterVM<FillTuple>(r => r.fill.OrderKey.ToString()), DataGridFilterKnownTemplates.Regex, DefaultColumnWidths.OrderKey);
add_col(Columns.SecurityKey, DefaultColumnHeaders.SecurityKey, r => r.security_key.ToString(), new RegexFilterVM<FillTuple>(r => r.fill.SecurityKey.ToString()), DataGridFilterKnownTemplates.Regex, DefaultColumnWidths.SecurityKey);
@@ -146,6 +147,7 @@ namespace mbts.spark {
});
_dispose = new CompositeDisposable(
ObservableAutoWrapper.connect(col_tups, columns, ct => ct.col),
ObservableAutoWrapper.connect_item_hooks(col_tups, ct => ct.filter as IDisposable),
RXCollection.connect(rows, fills_buffer.Filter(filter_src, FillTuple.key_fn), comp_src, ft => new Row(ft, model), r => r.fill_tuple),
fills_source.OnDispatcher().Subscribe(t => {
last_unfiltered_fills = t;
@@ -227,6 +229,7 @@ namespace mbts.spark {
case Columns.Exchange: return wrap_default(ft => ft.security.exchange_or_default());
case Columns.FillKey: return wrap(ft => ft.fill.FillKey);
case Columns.FillKind: return wrap_default(ft => ft.fill.FillKind);
case Columns.FillStatus: return wrap_default(ft => ft.fill.FillStatus);
case Columns.FillTime: return wrap(ft => ft.fill.Timestamp.to_local_time());
case Columns.OrderKey: return wrap(ft => ft.fill.OrderKey);
case Columns.OrderType: return wrap_default(ft => ft.order?.order_type() ?? OrderType.None);
@@ -282,7 +285,6 @@ namespace mbts.spark {
public DateTime fill_time => _fill.Timestamp.to_local_time();
public TimeInForce time_in_force => _order.time_in_force();
public OrderType order_type => _order.order_type();
//public OrderType root_algo_type => _or
public string display_name => OrderUtils.display_name(_order, fill_tuple.algo);
public OrderMetadata order_metadata => _order_metadata ?? (_order_metadata = _model.factory.get_metadata(_order.Def.CustomDef.CustomCase));
public Brush badge_fill => _badge_fill ?? (_badge_fill = OrderUtils.badge_fill(fill_tuple.algo_meta, order_metadata));
@@ -293,6 +295,7 @@ namespace mbts.spark {
public double price => _fill.LastPrice;
public double size => _fill.LastShares;
public FillKind fill_kind => _fill.FillKind;
public FillStatus fill_status => _fill.FillStatus;
public string fill_key => _fill.FillKey;
public string order_key => _order.Key.ToString();
@@ -300,7 +303,7 @@ namespace mbts.spark {
public OrderType root_algo_order_type => _root_algo.HasValue ? _root_algo.Value.value.CustomCase : OrderType.None;
public OrderMetadata root_algo_order_metadata => _model.factory.get_metadata(root_algo_order_type);
public Color root_algo_badge_color => _root_algo_badge_color ?? (_root_algo_badge_color = OrderUtils.badge_color(_root_algo_meta, root_algo_order_metadata)).Value;
public string root_algo_display_name => _root_algo?.name ?? root_algo_order_type.display_name();
public string root_algo_display_name => fill_tuple.root_order_security?.display_name() ?? OrderType.None.display_name();
public bool Equals(Row other) => other != null && other._fill.Equals(_fill) && other._order.Equals(_order);
public override bool Equals(object obj) => Equals(obj as Row);
@@ -21,6 +21,7 @@ namespace mbts.ui.spark {
Price,
Size,
FillKind,
FillStatus,
FillKey,
OrderKey,
SecurityKey
@@ -37,7 +37,8 @@ namespace bts.shell {
{ nameof(FillsVM.Row.side), Columns.Side },
{ nameof(FillsVM.Row.size), Columns.Size },
{ nameof(FillsVM.Row.time_in_force), Columns.TimeInForce },
{ nameof(FillsVM.Row.user), Columns.User }
{ nameof(FillsVM.Row.user), Columns.User },
{ nameof(FillsVM.Row.fill_status ), Columns.FillStatus },
};
public FillsWindowFactory(TradingShellModule module, IBus bus, UserSettingsHub settings_hub, OrdersModel orders_model)
@@ -74,6 +74,10 @@ namespace bts.shell.fills {
[ProtoMember(15)]
[DIYGridColumnID(nameof(Columns.Symbol))]
public string[] symbol { get; set; }
[ProtoMember(17)]
[DIYGridColumnID(nameof(Columns.FillStatus))]
public Fill.Types.FillStatus[] fill_status { get; set; }
}
static class FillsFilterStatesExtensions {
@@ -96,6 +100,7 @@ namespace bts.shell.fills {
pb.add_discrete_values(fs.side, ft => ft.fill.Side);
pb.add_discrete_values(fs.fill_kind, ft => ft.fill.FillKind);
pb.add_discrete_values(fs.symbol, ft => ft.security?.Symbol ?? string.Empty);
pb.add_discrete_values(fs.fill_status, ft => ft.fill.FillStatus);
// numeric
pb.add_numeric(fs.size, ft => ft.fill.LastShares);
pb.add_numeric(fs.price, ft => ft.fill.LastPrice);
@@ -23,6 +23,10 @@ namespace mbts.spark {
// TODO: somehow allow windows that are using the default settings to still have individual column widths.
[ProtoContract]
class LadderColumnSettings : IEquatable<LadderColumnSettings> {
// this class is 100% mutable (there are literally 0 readonly members),
// so GetHashCode must return the same hash for every instance.
static readonly int _type_hash = typeof(LadderColumnSettings).GetHashCode();
public static LadderColumnSettings Default => new LadderColumnSettings {
show = true,
width = 50,
@@ -74,14 +78,7 @@ namespace mbts.spark {
other.show == show;
public override bool Equals(object obj) => Equals(obj as LadderColumnSettings);
public override int GetHashCode() =>
width.GetHashCode() +
background.GetHashCode() +
foreground.GetHashCode() +
font_family.GetHashCode() +
font_size.GetHashCode() +
font_weight.GetHashCode();
public override int GetHashCode() => _type_hash;
public static bool operator ==(LadderColumnSettings x, LadderColumnSettings y) => x.safe_equals(y);
public static bool operator !=(LadderColumnSettings x, LadderColumnSettings y) => !(x == y);
@@ -89,6 +86,9 @@ namespace mbts.spark {
[ProtoContract]
class HistogramBarAnimation : IEquatable<HistogramBarAnimation> {
// this class is 100% mutable (there are literally 0 readonly members),
// so GetHashCode must return the same hash for every instance.
static readonly int _type_hash = typeof(HistogramBarAnimation).GetHashCode();
[ProtoMember(1)]
public ColorShowProto bars { get; set; }
[ProtoMember(2)]
@@ -102,14 +102,14 @@ namespace mbts.spark {
show_numbers == other.show_numbers;
public override bool Equals(object obj) => Equals(obj as HistogramBarAnimation);
public override int GetHashCode() =>
EqualityComparer.aggregate_hash(
bars.GetHashCode(),
show_numbers.GetHashCode());
public override int GetHashCode() => _type_hash;
}
[ProtoContract]
class VolumeColumnSettings : IEquatable<VolumeColumnSettings> {
// this class is 100% mutable (there are literally 0 readonly members),
// so GetHashCode must return the same hash for every instance.
static readonly int _type_hash = typeof(VolumeColumnSettings).GetHashCode();
public static VolumeColumnSettings Default {
get {
var gen = LadderColumnSettings.Default;
@@ -149,19 +149,14 @@ namespace mbts.spark {
show_ltq.Equals(other.show_ltq);
public override bool Equals(object obj) => Equals(obj as VolumeColumnSettings);
public override int GetHashCode() =>
EqualityComparer.aggregate_hash(
general.GetHashCode(),
buy.GetHashCode(),
sell.GetHashCode(),
passive.GetHashCode(),
total.GetHashCode(),
show_ltq.GetHashCode());
public override int GetHashCode() => _type_hash;
}
[ProtoContract]
class LadderMarketBreakLine : IEquatable<LadderMarketBreakLine> {
// this class is 100% mutable (there are literally 0 readonly members),
// so GetHashCode must return the same hash for every instance.
static readonly int _type_hash = typeof(LadderMarketBreakLine).GetHashCode();
[ProtoMember(1)]
public bool show { get; set; }
[ProtoMember(2)]
@@ -184,8 +179,7 @@ namespace mbts.spark {
Equals(obj as LadderMarketBreakLine);
public override int GetHashCode() =>
show.GetHashCode() +
(int)color;
_type_hash;
}
[ProtoContract]
@@ -255,6 +249,11 @@ namespace mbts.spark {
const double _default_order_entry_panel_width = 110.0;
const double _default_zoom_factor = 1.0;
const bool _default_show_warn_on_cross = true;
public static readonly IEqualityComparer<LadderSettings> profile_equality_comparer =
EqualityComparer.Create<LadderSettings>(profile_equals);
// this class is 100% mutable (there are literally 0 readonly members),
// so GetHashCode must return the same hash for every instance.
static readonly int _type_hash = typeof(LadderSettings).GetHashCode();
// Default proto constructor
// Added this so that when clients upgrade to a version with new settings,
@@ -497,6 +496,9 @@ namespace mbts.spark {
[ProtoMember(55)]
public LadderMiniOrderBookSettings mini_ob { get; set; }
[ProtoMember(57)]
public double left_panel_scroll_position { get; set; }
public void sanitize() =>
sanitize(this);
@@ -533,112 +535,81 @@ namespace mbts.spark {
return s;
}
/// <summary>
/// Determines whether or not the specified LadderSettings are 'profile equivalent.'
/// This means that 2 ladders, each with a different one of the specified settings, could share the same profile.
/// </summary>
///
/// Note: the impetus for this version of equality is to avoid disconnecting a ladder from its profile due to 'trivial' settings changes.
/// Consider the '<see cref="default_algo"/>' property:
/// If a ladder is using a settings profile with Limit as the default algo, and the user decides to send a 'Market' order,
/// the ladder would suddenly be disconnected from the profile, because it's settings state would no longer be equal to the profile's settings,
/// since they changed the selected algo type to 'Market.'
/// To avoid such travesties, a separate equals logic is needed: this is called 'profile-equivalent' and is implemented in <see cref="profile_equals)"/>.
/// Devs: be sure to account for properties that are excluded in the 'profile-equals' logic in the [regular]'equals' logic.
public static bool profile_equals(LadderSettings a, LadderSettings b) =>
a == null ? b == null :
b != null &&
a.row_height == b.row_height &&
a.grid_line_color == b.grid_line_color &&
a.orders_column.safe_equals(b.orders_column) &&
a.bid_column.safe_equals(b.bid_column) &&
a.ask_column.safe_equals(b.ask_column) &&
a.price_column.safe_equals(b.price_column) &&
a.last_column.safe_equals(b.last_column) &&
a.piq_column.safe_equals(b.piq_column) &&
a.calculator_buttons.safe_equals(b.calculator_buttons, Enumerable.SequenceEqual) &&
a.scroll_bar_visible == b.scroll_bar_visible &&
a.default_account == b.default_account &&
a.default_time_in_force == b.default_time_in_force &&
a.size == b.size &&
a.animate_recenter == b.animate_recenter &&
a.badge_style == b.badge_style &&
a.auto_clear == b.auto_clear &&
a.bid_break_line.safe_equals(b.bid_break_line) &&
a.ask_break_line.safe_equals(b.ask_break_line) &&
a.mid_break_line.safe_equals(b.mid_break_line) &&
a.alternate_order_size == b.alternate_order_size &&
a.session_low_line.safe_equals(b.session_low_line) &&
a.session_high_line.safe_equals(b.session_high_line) &&
a.session_range_fill.safe_equals(b.session_range_fill) &&
a.volume_column.safe_equals(b.volume_column) &&
a.size_display.safe_equals(b.size_display) &&
a.day_visible == b.day_visible &&
a.high_visible == b.high_visible &&
a.low_visible == b.low_visible &&
a.open_visible == b.open_visible &&
a.settle_visible == b.settle_visible &&
a.volume_visible == b.volume_visible &&
a.account_visible == b.account_visible &&
a.tif_visible == b.tif_visible &&
a.order_type_visible == b.order_type_visible &&
a.account_position_visible == b.account_position_visible &&
a.day_position_visible == b.day_position_visible &&
a.raw_day_position_visible == b.raw_day_position_visible &&
a.size_presets_visible == b.size_presets_visible &&
a.cancel_buys_visible == b.cancel_buys_visible &&
a.cancel_sells_visible == b.cancel_sells_visible &&
a.cancel_all_visible == b.cancel_all_visible &&
a.auto_clear_visible == b.auto_clear_visible &&
a.clear_visible == b.clear_visible &&
a.order_entry_panel_initial_width == b.order_entry_panel_initial_width &&
a.zoom_slider_visible == b.zoom_slider_visible &&
a.zoom_factor == b.zoom_factor &&
a.use_defaults == b.use_defaults &&
a.favorite_algos == b.favorite_algos &&
a.net_change == b.net_change &&
a.show_warn_on_cross == b.show_warn_on_cross &&
a.mini_ob == b.mini_ob;
public bool Equals(LadderSettings other) =>
other != null &&
row_height == other.row_height &&
grid_line_color == other.grid_line_color &&
orders_column.safe_equals(other.orders_column) &&
bid_column.safe_equals(other.bid_column) &&
ask_column.safe_equals(other.ask_column) &&
price_column.safe_equals(other.price_column) &&
last_column.safe_equals(other.last_column) &&
piq_column.safe_equals(other.piq_column) &&
calculator_buttons.safe_equals(other.calculator_buttons, (a, b) => a.SequenceEqual(b)) &&
scroll_bar_visible == other.scroll_bar_visible &&
default_account == other.default_account &&
profile_equals(this, other) &&
default_algo == other.default_algo &&
default_time_in_force == other.default_time_in_force &&
size == other.size &&
animate_recenter == other.animate_recenter &&
badge_style == other.badge_style &&
auto_clear == other.auto_clear &&
bid_break_line.safe_equals(other.bid_break_line) &&
ask_break_line.safe_equals(other.ask_break_line) &&
mid_break_line.safe_equals(other.mid_break_line) &&
alternate_order_size == other.alternate_order_size &&
session_low_line.safe_equals(other.session_low_line) &&
session_high_line.safe_equals(other.session_high_line) &&
session_range_fill.safe_equals(other.session_range_fill) &&
volume_column.safe_equals(other.volume_column) &&
size_display.safe_equals(other.size_display) &&
day_visible == other.day_visible &&
high_visible == other.high_visible &&
low_visible == other.low_visible &&
open_visible == other.open_visible &&
settle_visible == other.settle_visible &&
volume_visible == other.volume_visible &&
account_visible == other.account_visible &&
tif_visible == other.tif_visible &&
order_type_visible == other.order_type_visible &&
account_position_visible == other.account_position_visible &&
day_position_visible == other.day_position_visible &&
raw_day_position_visible == other.raw_day_position_visible &&
size_presets_visible == other.size_presets_visible &&
cancel_buys_visible == other.cancel_buys_visible &&
cancel_sells_visible == other.cancel_sells_visible &&
cancel_all_visible == other.cancel_all_visible &&
auto_clear_visible == other.auto_clear_visible &&
clear_visible == other.clear_visible &&
order_entry_panel_initial_width == other.order_entry_panel_initial_width &&
zoom_slider_visible == other.zoom_slider_visible &&
zoom_factor == other.zoom_factor &&
use_defaults == other.use_defaults &&
favorite_algos == other.favorite_algos &&
net_change == other.net_change &&
show_warn_on_cross == other.show_warn_on_cross &&
mini_ob == other.mini_ob;
left_panel_scroll_position == other.left_panel_scroll_position;
public override bool Equals(object obj) => Equals(obj as LadderSettings);
// TODO: remove mutable props from hash logic (or conversely, make them immutable).
public override int GetHashCode() =>
EqualityComparer.aggregate_hash(
row_height.GetHashCode(),
grid_line_color.GetHashCode(),
EqualityComparer.safe_get_hash_code(orders_column),
EqualityComparer.safe_get_hash_code(bid_column),
EqualityComparer.safe_get_hash_code(ask_column),
EqualityComparer.safe_get_hash_code(price_column),
EqualityComparer.safe_get_hash_code(last_column),
EqualityComparer.safe_get_hash_code(piq_column),
EqualityComparer.safe_get_hash_code(calculator_buttons),
scroll_bar_visible.GetHashCode(),
default_time_in_force.GetHashCode(),
size.GetHashCode(),
animate_recenter.GetHashCode(),
badge_style.GetHashCode(),
EqualityComparer.safe_get_hash_code(bid_break_line),
EqualityComparer.safe_get_hash_code(ask_break_line),
EqualityComparer.safe_get_hash_code(mid_break_line),
alternate_order_size.GetHashCode(),
EqualityComparer.safe_get_hash_code(session_low_line),
EqualityComparer.safe_get_hash_code(session_high_line),
EqualityComparer.safe_get_hash_code(session_range_fill),
EqualityComparer.safe_get_hash_code(volume_column),
EqualityComparer.safe_get_hash_code(size_display),
day_visible.GetHashCode(),
high_visible.GetHashCode(),
low_visible.GetHashCode(),
open_visible.GetHashCode(),
settle_visible.GetHashCode(),
volume_visible.GetHashCode(),
account_visible.GetHashCode(),
tif_visible.GetHashCode(),
order_type_visible.GetHashCode(),
account_position_visible.GetHashCode(),
size_presets_visible.GetHashCode(),
cancel_buys_visible.GetHashCode(),
cancel_sells_visible.GetHashCode(),
cancel_all_visible.GetHashCode(),
auto_clear_visible.GetHashCode(),
clear_visible.GetHashCode(),
order_entry_panel_initial_width.GetHashCode(),
zoom_slider_visible.GetHashCode(),
zoom_factor.GetHashCode(),
use_defaults.GetHashCode(),
favorite_algos.GetHashCode(),
net_change.GetHashCode(),
show_warn_on_cross.GetHashCode());
public override int GetHashCode() => _type_hash;
public struct WindowSpecifics {
public readonly double order_entry_panel_width, zoom_factor;
@@ -1,4 +1,5 @@
using bts.api;
using bts.collections;
using bts.md;
using mbts;
using mbts.config;
@@ -50,6 +51,7 @@ namespace bts.shell {
_mbo = mbo;
_dispose = Disposable.Create(
bus.subscribe(SparkTags.SecuritiesTag).Subscribe(s => _securities = s),
bus.subscribe(SparkTags.ShowLadderAutoLookupTag).Subscribe(_show_windows),
bus.subscribe(SparkTags.ShowLadderTag).OnDispatcher().Subscribe(s => show_windows(new[] { s })),
bus.subscribe(SparkTags.ShowLaddersTag).OnDispatcher().Subscribe(show_windows)
);
@@ -79,11 +81,9 @@ namespace bts.shell {
if (!_settings_hub.current.ladder_profiles.TryGetFirst(lp => lp.id == id, out var result)) {
// profile was deleted
id = 0;
} else {
if (!s.Equals(result.value)) {
// ladder's settings diverged from the profile (this happens when the user changes settings outside of the settings dialog, such as column widths, left panel width, etc.)
id = 0;
}
} else if (!LadderSettings.profile_equals(s, result.value)) {
// ladder's settings diverged from the profile (this happens when the user changes settings outside of the settings dialog, such as column widths, left panel width, etc.)
id = 0;
}
}
return new LadderSaveState { security_key = vm.security.Id, settings = s, settings_id = id };
@@ -147,7 +147,7 @@ namespace bts.shell {
var curr = vm.get_save_state();
if (settings_id == 0) {
last_value = curr;
} else if (!curr.Equals(last_value)) {
} else if (!LadderSettings.profile_equals(curr, last_value)) {
settings_id = 0;
last_value = curr;
}
@@ -161,7 +161,7 @@ namespace bts.shell {
// not on a profile, don't respond to default settings changes
return;
} else if (us.ladder_profiles.TryGetFirst(p => p.id == settings_id, out var profile)) {
if (!last_value.Equals(vm.get_save_state())) {
if (!LadderSettings.profile_equals(last_value, vm.get_save_state())) {
settings_id = 0;
} else {
settings_subject.OnNext(last_value = profile.value);
@@ -209,6 +209,7 @@ namespace bts.shell {
_ => _,
vm.get_save_state(),
UserSettings.FileExtensions.LADDER,
LadderSettings.profile_equals,
settings_id);
dialog_vm.applied += apply;
// dialog
@@ -273,7 +274,21 @@ namespace bts.shell {
});
}
void show_windows(IReadOnlyCollection<SecurityMD> securities) {
async void _show_windows(IImmutableSet<uint> securities) {
if (securities == null)
return;
var start_time = DateTime.Now;
do {
var found = securities.KeyJoin(_securities).ToList();
securities = securities.RemoveRange(found.Select(SecurityMD.key_fn));
show_windows(found);
if (securities.Count == 0)
break;
await Task.Delay(500);
} while ((DateTime.Now - start_time) < _ladder_conf.security_timeout);
}
void show_windows(IEnumerable<SecurityMD> securities) {
int n_allowed = (int)_ladder_conf.max_open_ladders - _wm.list_windows().Where(w => w.window_type == _window_type).Count();
int n_opened = 0;
foreach (var s in securities) {
@@ -35,7 +35,14 @@ namespace mbts.spark {
_show_cancel_sells, _show_cancel_all, _show_zoom;
readonly PropertyAutoWrapper<LadderSettings, Brush> _bid_background, _bid_foreground, _ask_background, _ask_foreground;
readonly HashSet<AlgoKey> _sticky_algos = new HashSet<AlgoKey>();
double _position, _day_position, _raw_day_position;
double
_position,
_day_position,
_raw_day_position,
_left_panel_extent_height,
_left_panel_view_port_height,
_left_panel_scroll_position,
_left_panel_scroll_position_target;
bool _show_account_position, _show_day_position, _show_raw_day_position;
ulong _misc_time = 0;
ulong _last_trade_time = 0;
@@ -76,6 +83,7 @@ namespace mbts.spark {
_volume_column_width = backing(nameof(volume_column_width), ws.volume_column_width);
_left_panel_width = backing(nameof(left_panel_width), ws.order_entry_panel_width);
_zoom_factor = backing(nameof(zoom_factor), ws.zoom_factor);
_left_panel_scroll_position_target = init.left_panel_scroll_position;
// remember: account_positions needs to subscribe to selected_account; both the sub and account_positions need to be disposed
_volume = backing(nameof(volume), 0ul);
_auto_clear = backing(nameof(auto_clear), init.auto_clear);
@@ -333,6 +341,33 @@ namespace mbts.spark {
public bool show_cancel_sells => _show_cancel_sells.view;
public bool show_cancel_all => _show_cancel_all.view;
public bool show_zoom => _show_zoom.view;
// left panel scroll props
public double left_panel_view_port_height {
get => _left_panel_view_port_height;
set {
using (detect_property_changes(nameof(left_panel_scroll_position)))
_left_panel_view_port_height = value;
}
}
public double left_panel_scroll_position {
get {
if (!_left_panel_scroll_position_target.is_nan()) {
if (_left_panel_scroll_position_target < _max_left_panel_scroll_position) {
_left_panel_scroll_position = _left_panel_scroll_position_target;
_left_panel_scroll_position_target = double.NaN;
}
}
return Math.Min(_left_panel_scroll_position, _left_panel_extent_height);
}
set => Set(ref _left_panel_scroll_position, value);
}
public double left_panel_extent_height {
get => _left_panel_extent_height;
set {
using (detect_property_changes(nameof(left_panel_scroll_position)))
Set(ref _left_panel_extent_height, value);
}
}
public double left_panel_width { get => _left_panel_width.Value; set => _left_panel_width.set(value); }
public double zoom_factor { get => _zoom_factor.Value; set => _zoom_factor.set(value); }
public string position_display_text {
@@ -364,6 +399,10 @@ namespace mbts.spark {
public bool show_warn_on_cross_from_settings => current_settings.show_warn_on_cross;
internal LadderModel model => _model;
internal IObservable<LadderSettings> settings { get; }
double _max_left_panel_scroll_position =>
Math.Max(0, _left_panel_extent_height - _left_panel_view_port_height);
internal OrderRecordImmutable get_root_at_price((OrderRecordImmutable order, uint? _, AlgoData? __, AlgoDefinitionMetadata? meta) op) {
var order = op.order;
double p = order.price();
@@ -394,6 +433,7 @@ namespace mbts.spark {
zoom_factor,
piq_column_width));
rv.auto_clear = auto_clear;
rv.left_panel_scroll_position = left_panel_scroll_position;
if (order_properties_vm != null) {
rv.default_time_in_force = order_properties_vm.selected_time_in_force;
if (order_properties_vm.selected_account.HasValue)
@@ -301,7 +301,14 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="0" Grid.RowSpan="2" VerticalScrollBarVisibility="Hidden">
<ScrollViewer
x:Name="_left_panel_scroll"
Grid.Row="0"
Grid.RowSpan="2"
mbts:ScrollViewerBehavior.VerticalOffset="{Binding left_panel_scroll_position, Mode=TwoWay}"
mbts:ScrollViewerBehavior.EnableTwoWayVerticalOffsetBinding="True"
VerticalScrollBarVisibility="Hidden"
>
<Grid RowSpan="2" Background="{mbts:BTSColor UI.spark_menu_background}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
@@ -1,11 +1,17 @@
using bts;
using bts.collections;
using bts.utils;
using mbts.ui;
using mbts.ui.converters;
using mbts.ui.extensions;
using mbts.utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
@@ -80,6 +86,8 @@ namespace mbts.spark {
_ladder.visible_columns_changed += () => _column_headers_presenter.Columns.SetItems(
_ladder.visible_column_types.Select(t => ColumnFactory.create(_ladder, t)));
this.vm = vm;
this.ConnectDataContext<LadderVM>(lvm => lvm.bus.subscribe(SparkTags.SecuritiesTag).OnDispatcher().Subscribe(sec_map => Resources[ResourceKeys.Securities] = sec_map));
vm.SubscribeDisposed(_connect_left_panel_scroll());
DataContext = vm;
DataContextChanged += datacontext_changed;
_ui_scaler.MouseDoubleClick += _ui_scaler_MouseDoubleClick;
@@ -87,7 +95,39 @@ namespace mbts.spark {
this.PreviewMouseDown += LadderView_PreviewMouseDown;
}
IDisposable _connect_left_panel_scroll() {
// extent height
bool busy = false;
var extent_height_hook = _left_panel_scroll.ObserveProperty(ScrollViewer.ExtentHeightProperty, (s, e) => {
if (!busy) {
double scroll_pos = vm.left_panel_scroll_position;
busy = true;
Dispatcher.InvokeAsync(() => {
vm.left_panel_extent_height = _left_panel_scroll.ExtentHeight;
if (_left_panel_scroll.VerticalOffset != scroll_pos)
_left_panel_scroll.TryScrollToVerticalOffset(scroll_pos);
busy = false;
}, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
}
});
// view port height
_left_panel_scroll.Loaded += on_loaded;
var dispose = Disposable.CreateDisposeOnce(dispose_impl);
return Disposable.Create(dispose, vm.SubscribeDisposed(dispose));
// local methods
void on_loaded(object sender, RoutedEventArgs e) {
if (_left_panel_scroll.descendants_of_type<ScrollBar>().TryGetFirst(sb => sb.Orientation == Orientation.Vertical, out var vscroll)) {
vscroll.SetBinding(ScrollBar.ViewportSizeProperty, new Binding(nameof(LadderVM.left_panel_view_port_height)) {
Converter = ValueConverter.create<double, Size>(d => new Size(0, d), sz => sz.Height),
Mode = BindingMode.OneWayToSource
});
}
}
void dispose_impl() {
Disposable.dispose(ref extent_height_hook);
_left_panel_scroll.Loaded -= on_loaded;
}
}
// (Left|Right) CTRL + Wheel to zoom
// This is neat b/c the user doesn't even need to have the slider visible to zoom
@@ -62,15 +62,15 @@
Header="{Binding security}"
IsEditMode="False"
IsLazy="True"
SecurityMap="{DynamicResource ResourceKey={x:Static usp:ManualFillRowEditor.SecuritiesKey}}"
SecurityMap="{DynamicResource ResourceKey={x:Static u:ResourceKeys.Securities}}"
SelectedSecurity="{Binding security, UpdateSourceTrigger=Explicit}"
ShowDialogSkirt="True"
ToolTip="{Binding SelectedCriteria, RelativeSource={RelativeSource Self}, Converter={x:Static c:ContractPickerPopup.SecurityCriteriaTextConverter}, Mode=OneWay}"
OKClick="{x:Static c:ContractPickerPopup.FlushSelectedSecurityHandler}"
/>
<ComboBox Grid.Row="2" Grid.Column="2" ItemsSource="{DynamicResource ResourceKey={x:Static usp:ManualFillRowEditor.AccountsKey}}" SelectedItem="{Binding account}"/>
<ComboBox Grid.Row="2" Grid.Column="4" ItemsSource="{DynamicResource ResourceKey={x:Static usp:ManualFillRowEditor.UsersKey}}" SelectedItem="{Binding user}"/>
<ComboBox Grid.Row="2" Grid.Column="6" ItemsSource="{DynamicResource ResourceKey={x:Static usp:ManualFillRowEditor.SidesKey}}" SelectedItem="{Binding side}" Width="48"/>
<ComboBox Grid.Row="2" Grid.Column="2" ItemsSource="{DynamicResource ResourceKey={x:Static u:ResourceKeys.Accounts}}" SelectedItem="{Binding account}"/>
<ComboBox Grid.Row="2" Grid.Column="4" ItemsSource="{DynamicResource ResourceKey={x:Static u:ResourceKeys.Users}}" SelectedItem="{Binding user}"/>
<ComboBox Grid.Row="2" Grid.Column="6" ItemsSource="{DynamicResource ResourceKey={x:Static u:ResourceKeys.Sides}}" SelectedItem="{Binding side}" Width="48"/>
<c:TickUpDownUInt Grid.Row="2" Grid.Column="8" MinWidth="40" Value="{Binding size}"/>
<usp:PriceEntryControl Grid.Row="2" Grid.Column="10" MinWidth="55" Value="{Binding price}" ContractSpec="{Binding spec}"/>
</Grid>
@@ -6,12 +6,6 @@ namespace mbts.ui.spark {
/// Interaction logic for ManualFillRowEditor.xaml
/// </summary>
partial class ManualFillRowEditor : UserControl {
public const string
SecuritiesKey = nameof(SecuritiesKey),
AccountsKey = nameof(AccountsKey),
UsersKey = nameof(UsersKey),
SidesKey = nameof(SidesKey);
public static readonly RoutedCommand
CommitCommand = new RoutedCommand(),
CancelCommand = new RoutedCommand();
@@ -70,7 +70,7 @@ namespace bts.shell.manual_fills {
mfd => new ManualFillRow(mfd),
mfr => mfr.data),
_bus.subscribe(SparkTags.SecuritiesTag).OnDispatcher().Subscribe(m => {
security_map = m;
security_map = new FilteredDictionary<uint, SecurityMD>(m, smd => smd.security.ContractCase == Security.ContractOneofCase.Future);
RaisePropertyChanged(nameof(security_map));
}),
ObservableAutoWrapper.connect_item_hooks(_persisted_rows, r => Disposable.Create(dirty_mon.join(r), selection_mon.join(r))),
@@ -50,11 +50,11 @@ namespace mbts.ui.spark {
row_editor.CommandBindings.Add(new CommandBinding(ManualFillRowEditor.CommitCommand, commit_executed));
row_editor.CommandBindings.Add(new CommandBinding(ManualFillRowEditor.CancelCommand, cancel_executed));
// dynamic resources
row_editor.Resources[ManualFillRowEditor.AccountsKey] = vm.accounts;
row_editor.Resources[ManualFillRowEditor.UsersKey] = vm.users;
row_editor.Resources[ManualFillRowEditor.SidesKey] = vm.sides;
row_editor.Resources[ResourceKeys.Accounts] = vm.accounts;
row_editor.Resources[ResourceKeys.Users] = vm.users;
row_editor.Resources[ResourceKeys.Sides] = vm.sides;
FocusManager.SetIsFocusScope(row_editor, true);
var sec_hook = vm.as_demuxer().subscribe(nameof(ManualFillsVM.security_map)).OnDispatcher().Subscribe(v => row_editor.Resources[ManualFillRowEditor.SecuritiesKey] = v);
var sec_hook = vm.as_demuxer().subscribe(nameof(ManualFillsVM.security_map)).OnDispatcher().Subscribe(v => row_editor.Resources[ResourceKeys.Securities] = v);
// popup adorner
var popup_adorner = new PopupAdorner(
data_grid, data_grid,
@@ -121,7 +121,7 @@ namespace mbts.spark {
r => r.user,
DefaultColumnWidths.User,
DiscreteValuesFilterVM.Create<OrderSecurityRootPair, string>(
model.factory.subscribe_users().Select(d => d.Values),
model.factory.subscribe_users().Select(d => d.Values.Ordered()),
ort => ort.order.order.user(),
nameof(OrderBookRowVM.user)),
DataGridFilterKnownTemplates.DiscreteValues,
@@ -133,7 +133,7 @@ namespace mbts.spark {
r => r.account,
DefaultColumnWidths.Account,
DiscreteValuesFilterVM.Create<OrderSecurityRootPair, string, string[]>(
model.factory.subscribe_accounts().Select(d => d.Values),
model.factory.subscribe_accounts().Select(d => d.Values.Ordered()),
ort => ort.order.order.account(),
vals => vals.ToArray(),
vals => Observable.Return(vals),
@@ -108,7 +108,7 @@ namespace mbts.spark {
public CustomOrderDefinition.CustomOneofCase root_algo_order_type => order_tuple.root.algo.value.CustomCase;
public OrderMetadata root_algo_order_metadata => _owner.get_metadata(root_algo_order_type);
public Brush root_algo_badge_fill => _root_algo_badge_fill ?? (_root_algo_badge_fill = new SolidColorBrush(_root_algo_badge_color));
public string root_algo_display_name => order_tuple.root.algo.name;
public string root_algo_display_name => order_tuple.root.display_name();
// Tree
public bool is_parent { get => _is_parent; set => Set(ref _is_parent, value); }
@@ -239,7 +239,7 @@ namespace mbts.spark {
grid_settings_manager,
order_mod_vm.algo_vm.connect_data(Observable.Return(model)),
order_mod_vm.algo_vm.connect_data(_selected_params_mon.subscribe_spreader_security()),
order_mod_vm.algo_vm,
order_mod_vm,
attach_vm,
_show_fills.observe_current(true)
.Subscribe(is_visible => {
@@ -735,17 +735,13 @@ namespace mbts.spark {
_size_permissions = AlgoParamPermissions.ReadOnly | AlgoParamPermissions.Write;
SecurityMD? _security_md;
public OrderParamsVM(OrderBookVM owner, AlgoFormats init_format, AlgoEditingPermissions init_permissions)
: this(owner,
AlgoDefinitionVM.create(
owner._model,
AlgoData.create_unpersisted(OrderDataHelper.Defaults.CustomOrderDefinitionImmutable(CustomOrderDefinition.CustomOneofCase.Iceberg), CustomOrderDefinition.CustomOneofCase.Iceberg.display_name()),
init_format: init_format,
editing_permissions: init_permissions)) { }
OrderParamsVM(OrderBookVM owner, AlgoDefinitionVM algo_vm) {
public OrderParamsVM(OrderBookVM owner, AlgoFormats init_format, AlgoEditingPermissions init_permissions) {
_owner = owner;
this.algo_vm = algo_vm;
algo_vm = AlgoDefinitionVM.create(
owner._model,
AlgoData.create_unpersisted(OrderDataHelper.Defaults.CustomOrderDefinitionImmutable(CustomOrderDefinition.CustomOneofCase.Iceberg), CustomOrderDefinition.CustomOneofCase.Iceberg.display_name()),
init_format: init_format,
editing_permissions: init_permissions);
_accounts = backing(
nameof(selected_account),
_model.factory.subscribe_account_tuples(),
@@ -784,7 +780,8 @@ namespace mbts.spark {
appended_param_rows.insert_front(new AlgoParamRowVM(root, _price_param, null, AlgoParamTemplateKeys.Price));
}
}),
ObservableAutoWrapper.connect_item_hooks(param_rows, dirty_params_mon.join));
ObservableAutoWrapper.connect_item_hooks(param_rows, dirty_params_mon.join),
algo_vm);
// payup methods
void payup_bid(int ticks) => payup(bbo.bid, -ticks);
void payup_ask(int ticks) => payup(bbo.ask, ticks);
@@ -66,6 +66,10 @@ namespace mbts.spark {
_vm = new OrderBookVM(_bus, _notification_service, _model, _settings_manager);
_vm.load_from(_state);
_view = new OrderBookView(_vm);
_vm.SubscribeDisposed(
_bus.subscribe(SparkTags.SecuritiesTag)
.OnDispatcher()
.Subscribe(sec_map => _view.Resources[ResourceKeys.Securities] = sec_map));
var show_fills_command = SparkCommands.ShowFills(SparkCommands.KeyGestures.ShowFills).complete(() => new FillsSettings(_vm.selected_orders.Select(r => r.Key).ToArray()));
@@ -501,6 +501,12 @@ namespace bts.shell.pnl {
account_name == other.account_name &&
sod == other.sod &&
day == other.day &&
bid_price.Equals(other.bid_price) &&
ask_price.Equals(other.ask_price) &&
last_price.Equals(other.last_price) &&
mid_price.Equals(other.mid_price) &&
settlement_price.Equals(other.settlement_price) &&
calc_type.Equals(other.calc_type) &&
raw_day == other.raw_day &&
working.summary == other.working.summary;
@@ -97,22 +97,22 @@ namespace bts.shell.pnl {
if (security.HasValue && security.Value.ContractCase != Security.ContractOneofCase.Future) {
day_long = day_short = sod_long = sod_short = 0;
} else {
day_long = (decimal)DoubleUtil.nan_to_zero(data.day.long_pos);
day_short = (decimal)DoubleUtil.nan_to_zero(data.day.short_pos);
sod_long = (decimal)DoubleUtil.nan_to_zero(data.sod.long_pos);
sod_short = (decimal)DoubleUtil.nan_to_zero(data.sod.short_pos);
day_long = DoubleUtil.round_to_decimal(data.day.long_pos);
day_short = DoubleUtil.round_to_decimal(data.day.short_pos);
sod_long = DoubleUtil.round_to_decimal(data.sod.long_pos);
sod_short = DoubleUtil.round_to_decimal(data.sod.short_pos);
}
var nd = new PNLNormalizedData(
(decimal)DoubleUtil.nan_to_zero(day_pnl.value),
DoubleUtil.round_to_decimal(day_pnl.value),
day_long,
day_short,
(decimal)DoubleUtil.nan_to_zero(data.raw_day.long_pos),
(decimal)DoubleUtil.nan_to_zero(data.raw_day.short_pos),
(decimal)DoubleUtil.nan_to_zero(sod_pnl.value),
DoubleUtil.round_to_decimal(data.raw_day.long_pos),
DoubleUtil.round_to_decimal(data.raw_day.short_pos),
DoubleUtil.round_to_decimal(sod_pnl.value),
sod_long,
sod_short,
(decimal)DoubleUtil.nan_to_zero(data.working_long_pos),
(decimal)DoubleUtil.nan_to_zero(data.working_short_pos));
DoubleUtil.round_to_decimal(data.working_long_pos),
DoubleUtil.round_to_decimal(data.working_short_pos));
if (_normalized_data != nd) {
_normalized_data = nd;
updated?.Invoke(nd);
@@ -103,7 +103,7 @@ namespace bts.shell.pnl {
load_from(settings);
_dispose = Disposable.Create(
pnl_source.Operate(
_calculation_type.observe_current(),
_calculation_type.observe_current(true),
(data, calc) => data.with(calc_type: calc)
).FilterWithRaw(filter_src, PNLRowData.key_fn, null)
.OnDispatcher()
+11 -6
View File
@@ -1,4 +1,5 @@
using mbts.ui.shell;
using mbts.ui;
using mbts.ui.shell;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -6,8 +7,9 @@ using System.Reactive.Linq;
using System.Runtime.CompilerServices;
namespace mbts.spark {
class AlgoParamVM<T> : IAlgoParamVM<T>, INotifyPropertyChanged {
class AlgoParamVM<T> : IAlgoParamVM<T>, INotifyPropertyChanged, ITemplateSelectorKey {
readonly IEqualityComparer<T> _comparer;
readonly string _template_key;
AlgoParamPermissions _permissions;
bool _is_enabled, _has_value;
T _committed_value, _value;
@@ -15,15 +17,16 @@ namespace mbts.spark {
public AlgoParamVM(string id, string display_name)
: this(id, display_name, default, EqualityComparer<T>.Default) { }
public AlgoParamVM(string id, string display_name, T value)
: this(id, display_name, value, EqualityComparer<T>.Default) { }
public AlgoParamVM(string id, string display_name, T value, string template_key = null)
: this(id, display_name, value, EqualityComparer<T>.Default, template_key) { }
public AlgoParamVM(string id, string display_name, T value, IEqualityComparer<T> comparer) {
public AlgoParamVM(string id, string display_name, T value, IEqualityComparer<T> comparer, string template_key = null) {
this.id = id;
this.display_name = display_name;
_value = value;
_committed_value = value;
_comparer = comparer;
_template_key = template_key;
}
public event PropertyChangedEventHandler PropertyChanged;
@@ -50,7 +53,9 @@ namespace mbts.spark {
public bool is_enabled { get => _is_enabled; set => _set(ref _is_enabled, value); }
public bool has_value { get => _has_value; set => _set(ref _has_value, value); }
public bool is_dirty { get; private set; }
object IAlgoParamVM.value { get => value; set => this.value = (T)value; }
object IAlgoParamVM.value { get => value; set => this.value = (T)value; }
string ITemplateSelectorKey.key => _template_key;
public void revert() {
if (is_dirty) {
+3 -1
View File
@@ -36,6 +36,8 @@ namespace mbts.spark {
public AlgoDefinitionMetadata? root_algo_meta =>
_order_tuple.HasValue ? _order_tuple.Value.root.meta : null;
public OrderSecurityAlgo? root_order_security => _order_tuple?.root;
public string account {
get {
var account_string = string.Empty;
@@ -85,4 +87,4 @@ namespace mbts.spark {
public static string user(this FillTuple fill_tuple) =>
fill_tuple.order.HasValue ? fill_tuple.order.Value.user() : string.Empty;
}
}
}
@@ -67,7 +67,6 @@ namespace mbts.spark.utilities {
public IObservable<IReadOnlyDictionary<uint, string>> subscribe_accounts() => _admin_model.on_accounts;
public IObservable<IReadOnlyDictionary<uint, string>> subscribe_users() => _admin_model.on_users;
public IObservable<IReadOnlyList<UserTuple>> subscribe_user_tuples() => _admin_model.on_user_tuples;
public IObservable<IReadOnlyList<AccountTuple>> subscribe_account_tuples() => _admin_model.on_account_tuples;
#region Defaults
@@ -62,6 +62,7 @@ namespace mbts.spark {
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveInt: param.AsInt32 = 0; break;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveOrderDef: param.AsOrderDef = new CustomOrderDefinition(); break;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveString: param.AsString = string.Empty; break;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveSecurityKey:
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveUint: param.AsUint32 = 0u; break;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveQuantity: param.AsQuantity = new bts.spark.QuantityMeasure(); break;
}
@@ -12,7 +12,7 @@ using System.Reactive.Linq;
namespace mbts.spark {
interface IDynamicOrderParamVM {
DynamicOrderParamDescriptor descriptor { get; }
DynamicOrderParam param { get; set; }
DynamicOrderParam param { get; }
}
interface IDynamicOrderParamVM<T> : IDynamicOrderParamVM {
@@ -21,26 +21,16 @@ namespace mbts.spark {
}
abstract class DynamicOrderParamVM : DisposableViewModelBase, IDynamicOrderParamVM {
DynamicOrderParam _param;
protected DynamicOrderParamVM(DynamicOrderParamDescriptor descriptor)
: this(descriptor, DynamicOrderHelper.init_param(descriptor)) { }
private DynamicOrderParamVM(DynamicOrderParamDescriptor descriptor, DynamicOrderParam param) {
this.descriptor = descriptor;
_param = param;
this.param = param;
}
public DynamicOrderParamDescriptor descriptor { get; set; }
public DynamicOrderParam param {
get => _param;
set {
_param = value;
on_param_changed();
}
}
protected abstract void on_param_changed();
public DynamicOrderParam param { get; }
}
class DynamicOrderParamVM<TView, TModel> : DynamicOrderParamVM, IDynamicOrderParamVM<TView> {
@@ -53,14 +43,12 @@ namespace mbts.spark {
_field_desc = field_descriptor;
_convert = convert;
_convert_back = convert_back;
value = _convert(ConvertUtils.try_convert<TModel>(_field_desc.Accessor.GetValue(param)));
}
public TView value {
get => _value;
set {
_field_desc.Accessor.SetValue(param, _convert_back(_value = value));
RaisePropertyChanged();
}
set => Set(ref _value, value);
}
public IObservable<TView> subscribe_value() =>
@@ -70,11 +58,6 @@ namespace mbts.spark {
void on_prop_changed(object sender, PropertyChangedEventArgs e) =>
o.OnNext(value);
});
protected override void on_param_changed() {
_value = _convert(ConvertUtils.try_convert<TModel>(_field_desc.Accessor.GetValue(param)));
RaisePropertyChanged(nameof(value));
}
}
class DynamicOrderEnumeratedVM : DynamicOrderParamVM, IDynamicOrderParamVM<string> {
@@ -105,11 +88,6 @@ namespace mbts.spark {
o.OnNext(selected_element);
});
protected override void on_param_changed() {
_sync_elements();
RaisePropertyChanged(nameof(selected_element));
}
static IEnumerable<string> _get_elements(DynamicOrderParamDescriptor descriptor) =>
descriptor.ParamType?.DescriptorCase == DynamicOrderTypeDescriptor.DescriptorOneofCase.Enumerated ?
descriptor.ParamType.Enumerated.Element : Enumerable.Empty<string>();
@@ -148,10 +126,5 @@ namespace mbts.spark {
o.OnNext(quantity);
});
}
protected override void on_param_changed()
{
RaisePropertyChanged(nameof(quantity));
}
}
}
@@ -20,6 +20,7 @@ namespace mbts.ui.spark
public DataTemplate StringTemplate { get; set; }
public DataTemplate OrderDefTemplate { get; set; }
public DataTemplate QuantityMeasureTemplate { get; set; }
public DataTemplate SecurityKeyTemplate { get; set; }
public DataTemplate EnumTemplate { get; set; }
@@ -38,6 +39,7 @@ namespace mbts.ui.spark
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveDouble: return DoubleTemplate;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveInt: return IntTemplate;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveUint: return UIntTemplate;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveSecurityKey: return SecurityKeyTemplate;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveString: return StringTemplate;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveOrderDef: return OrderDefTemplate;
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveQuantity: return QuantityMeasureTemplate;
@@ -4,6 +4,7 @@ using bts.collections;
using bts.spark;
using mbts.collections;
using mbts.spark.utilities;
using mbts.ui;
using mbts.ui.utility;
using mbts.utils;
using System;
@@ -73,9 +74,9 @@ namespace mbts.spark {
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveDouble: return mk<double, double>(DynamicOrderParam.AsDoubleFieldNumber, v => v, v => v, double.NaN);
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveInt: return mk<int?, int>(DynamicOrderParam.AsInt32FieldNumber, v => v, v => v.GetValueOrDefault());
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveUint: return mk<uint?, uint>(DynamicOrderParam.AsUint32FieldNumber, v => v, v => v.GetValueOrDefault());
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveSecurityKey: return mk<uint?, uint>(DynamicOrderParam.AsUint32FieldNumber, v => v, v => v.GetValueOrDefault(), template_key: TemplateKeys.SecurityKey);
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveString: return mk<string, string>(DynamicOrderParam.AsStringFieldNumber, v => v, v => v);
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveQuantity:
{
case DynamicOrderPrimitiveDescriptor.DynamicOrderPrimitiveQuantity: {
var qm = new DynamicOrderQuantityVM(descriptor);
return attached(qm, DynamicOrderHelper.get_quantity_value, DynamicOrderHelper.set_quantity_value, new QuantityMeasure { Ratio = 1.0, Absolute = 1 });
}
@@ -88,16 +89,16 @@ namespace mbts.spark {
default: throw ExceptionBuilder.Argument.unexpected_case(descriptor.ParamType.DescriptorCase, nameof(descriptor));
}
DynamicOrderParamVM<TView, TModel> mk<TView, TModel>(int field_number, Func<TModel, TView> convert, Func<TView, TModel> convert_back, TView default_value = default) {
DynamicOrderParamVM<TView, TModel> mk<TView, TModel>(int field_number, Func<TModel, TView> convert, Func<TView, TModel> convert_back, TView default_value = default, string template_key = null) {
var fdesc = DynamicOrderParam.Descriptor.FindFieldByNumber(field_number);
var pvm = new DynamicOrderParamVM<TView, TModel>(descriptor, fdesc, convert, convert_back);
return attached<TView, DynamicOrderParamVM<TView, TModel>>(pvm, get_from_param, assign_to_param, default_value);
return attached<TView, DynamicOrderParamVM<TView, TModel>>(pvm, get_from_param, assign_to_param, default_value, template_key);
TView get_from_param(DynamicOrderParam param) => convert(ConvertUtils.try_convert<TModel>(fdesc.Accessor.GetValue(param)));
void assign_to_param(DynamicOrderParam param, TView value) => fdesc.Accessor.SetValue(param, convert_back(value));
}
TParam attached<T, TParam>(TParam pvm, Func<DynamicOrderParam, T> selector, Action<DynamicOrderParam, T> assign_to_param, T default_value = default) where TParam : DynamicOrderParamVM, IDynamicOrderParamVM<T> {
TParam attached<T, TParam>(TParam pvm, Func<DynamicOrderParam, T> selector, Action<DynamicOrderParam, T> assign_to_param, T default_value = default, string template_key = null) where TParam : DynamicOrderParamVM, IDynamicOrderParamVM<T> {
add_property<T>(
pvm.descriptor.ParamName,
mdef => mdef.OrderParams.TryGetValue(pvm.descriptor.ParamName, out DynamicOrderParam p) ? selector(p) : default_value,
@@ -105,7 +106,8 @@ namespace mbts.spark {
() => pvm.value,
v => pvm.value = v,
pvm.subscribe_value(),
default_value);
default_value,
template_key: template_key);
return pvm;
}
}
@@ -89,6 +89,7 @@ namespace mbts.spark {
case AlgoType.Dynamic: vm = dynamic(key, name, name, editing_permissions); break;
case AlgoType.Splitter: vm = splitter(key,name,editing_permissions); break;
case AlgoType.Composite: vm = composite(key, name, editing_permissions); break;
case AlgoType.None: vm = new DefaultAlgoVM(); break;
default: vm = generic(key, name, algo_type, editing_permissions); break;
//default:
// Log.Ui.debug_fatal($"Failed to create {typeof(IAlgoVM)}: unknown algo type '{algo_type}.'");
@@ -166,7 +167,8 @@ namespace mbts.spark {
};
void subscribe_new_algo(IAlgoVM old_algo, IAlgoVM new_algo) {
RaisePropertyChanged(sd.prop_name);
Disposable.replace(ref def_sub, new CompositeDisposable());
Disposable.dispose(ref def_sub);
def_sub = new CompositeDisposable();
if (assert(new_algo != null, sd.prop_name, "No algo specified.")) {
def_sub.Add(new_algo.subscribe_definition().Subscribe(_ => _def_change_notifier.execute()));
if (new_algo is INotifyDataErrorInfo ndei)
@@ -255,14 +257,14 @@ namespace mbts.spark {
_security_changed += o.OnNext;
return Disposable.Create(() => _security_changed -= o.OnNext);
});
Disposable.replace(ref _pending_load, Disposable.Create(
Disposable.dispose(ref _pending_load);
_pending_load = Disposable.Create(
// load children
ObservableAutoWrapper.connect_item_hooks(
_child_algo_selector_data.AsCollection(),
sd => security_src.SubscribeEach(_ => ObservableAutoWrapper.connect_item_actions(_child_algo_selector_data.AsCollection(), selector_load_impl))),
// load regular props
ObservableAutoWrapper.connect_item_actions(_auto_props.AsCollection(), p => p.load(algom))));
ObservableAutoWrapper.connect_item_actions(_auto_props.AsCollection(), p => p.load(algom)));
}
void selector_load_impl(AlgoSelectorData sd) {
@@ -298,11 +300,12 @@ namespace mbts.spark {
_security_changed += o.OnNext;
return Disposable.Create(() => _security_changed -= o.OnNext);
});
Disposable.replace(ref _pending_load, Disposable.Create(
Disposable.dispose(ref _pending_load);
_pending_load = Disposable.Create(
ObservableAutoWrapper.connect_item_hooks(
_child_algo_selector_data.AsCollection(),
sd => security_src.Subscribe(_ => ObservableAutoWrapper.connect_item_actions(_child_algo_selector_data.AsCollection(), selector_load_impl))),
ObservableAutoWrapper.connect_item_actions(_auto_props.AsCollection(), p => p.load_many(algos))));
ObservableAutoWrapper.connect_item_actions(_auto_props.AsCollection(), p => p.load_many(algos)));
void selector_load_impl(AlgoSelectorData sd) {
// **assume that algos has more than 1 element
@@ -542,8 +545,19 @@ namespace mbts.spark {
}
}
protected void add_property<TValue>(string prop_name, Func<TMutable, TValue> get_from_def, Action<TMutable, TValue> assign_to_def, Func<TValue> get_local, Action<TValue> set_local, IObservable<TValue> subscribe_local, TValue non_uniform_value = default, AlgoParamPermissions permissions = AlgoParamPermissions.ReadWrite) {
var param = new AlgoParamVM<TValue>(prop_name, DisplayNameHelper.snake_to_title_case(prop_name), get_local()) { permissions = permissions };
protected void add_property<TValue>(
string prop_name,
Func<TMutable, TValue> get_from_def,
Action<TMutable, TValue> assign_to_def,
Func<TValue> get_local,
Action<TValue> set_local,
IObservable<TValue> subscribe_local,
TValue non_uniform_value = default,
AlgoParamPermissions permissions = AlgoParamPermissions.ReadWrite,
string template_key = null) {
var param = new AlgoParamVM<TValue>(prop_name, DisplayNameHelper.snake_to_title_case(prop_name), get_local(), template_key) {
permissions = permissions
};
_algo_params.Add(param);
_auto_props[prop_name] = new AutoProp(prop_name,
def => {
@@ -816,12 +830,11 @@ namespace mbts.spark {
var default_algo = AlgoKey.from_known_type(OrderDataHelper.get_default_algo(OrderDataHelper.get_algo_format(security.Value.ContractCase)));
foreach (var sd in _child_algo_selectors)
sd.load_algo_data_recursive(algo_data, default_algo);
Disposable.replace(
ref _selector_data_hooks,
ObservableAutoWrapper.connect_item_hooks(child_algo_selectors, s => {
s.load_algo_data_recursive(algo_data, default_algo);
return Disposable.empty;
}));
Disposable.dispose(ref _selector_data_hooks);
_selector_data_hooks = ObservableAutoWrapper.connect_item_hooks(child_algo_selectors, s => {
s.load_algo_data_recursive(algo_data, default_algo);
return Disposable.empty;
});
}
}
+4 -2
View File
@@ -158,7 +158,9 @@ namespace mbts.spark {
public static string display_name(this OrderSecurity order_tuple) =>
display_name(order_tuple.order, order_tuple.algo);
public static string display_name(OrderRecordImmutable order, AlgoData? algo) {
public static string display_name(OrderRecordImmutable order, AlgoData? algo, SecurityImmutable? security = null) {
if (order.order_type() == CustomOrderDefinition.CustomOneofCase.Spreader && security.HasValue)
return security.Value.ToString();
if (algo.HasValue) {
return algo.Value.name;
} else if (order.HasDef && order.Def.HasCustomDef) {
@@ -250,7 +252,7 @@ namespace mbts.spark {
order_type.ToString().ToUpper();
public static string display_name(this OrderSecurityAlgo order_sec_algo) =>
display_name(order_sec_algo.order, order_sec_algo.algo);
display_name(order_sec_algo.order, order_sec_algo.algo, order_sec_algo.security);
public static string display_name(this CustomOrderDefinitionImmutable algo) =>
algo.CustomCase == CustomOrderDefinition.CustomOneofCase.Dynamic ? algo.Dynamic.DynamicOrderType : algo.CustomCase.display_name();
+23 -15
View File
@@ -59,23 +59,30 @@ namespace mbts.spark {
this.md_auxiliary_model = md_auxiliary_model;
var scheduler = ThreadPoolScheduler.Instance;
var interval = TimeSpan.FromMilliseconds(100);
on_orders =
_service
.subscribei_orders()
.Naggle(interval, scheduler)
.PermissionFilter(admin_model.on_admin_data)
.join(sstore, order => order.security_key())
on_orders = admin_model
.permission_filter(
_service.subscribei_orders()
.Naggle(interval, scheduler),
o => o.account_id()
).join(sstore, order => order.security_key())
.Table()
.Cache();
on_positions = _position_service.subscribei_position_data().Naggle(interval, scheduler).PermissionFilter(admin_model.on_admin_data).join(sstore, pos => pos.SecurityId).Table().Cache();
on_pnl = _position_service.subscribei_pnl_data()
.Naggle(interval, scheduler)
on_positions = admin_model
.permission_filter(
_position_service.subscribei_position_data().Naggle(interval, scheduler),
p => p.AccountId)
.join(sstore, pos => pos.SecurityId)
.Table()
.Cache();
on_pnl = admin_model
.permission_filter(
_position_service.subscribei_pnl_data().Naggle(interval, scheduler),
p => p.Pos.AccountId)
.join(sstore, p => p.Pos.SecurityId)
.TableCheckedAutoCorrect(EqualityComparer<(SecurityImmutable? sec, PNLUnitImmutable data)>.Default)
.Where(t => t.has_changes())
.Cache();
on_account_pnl = _position_service.subscribei_pnl_account_data().Naggle(interval, scheduler).Table().Cache();
var working_orders = on_orders.Filter(tup => tup.order.is_active());
this.working_orders =
on_orders.Scan(
@@ -174,10 +181,11 @@ namespace mbts.spark {
.Where(t => t.has_changes())
.Cache();
// fill tuples
var on_fills =
_service.subscribei_fills()
.Naggle(interval, scheduler)
.PermissionFilter(admin_model.on_admin_data)
var on_fills = admin_model
.permission_filter(
_service.subscribei_fills()
.Naggle(interval, scheduler),
f => f.Account)
.join(sstore, f => f.SecurityKey)
.Table().Cache();
var fill_order_tuples_join = on_fills.LeftJoin(
@@ -202,6 +210,7 @@ namespace mbts.spark {
// manual fills
on_manual_fills_securities = _position_service.subscribei_manual_fills()
.Naggle(interval, scheduler)
.Filter(f => f.FillType == ManualFill.Types.FillType.Local)
.join(sstore, mf => mf.SecurityKey)
.Table().Cache();
var manual_fill_tuples_account_join = on_manual_fills_securities.LeftJoin(
@@ -265,7 +274,6 @@ namespace mbts.spark {
public IObservable<IReadOnlyDictionary<uint, OrderSecurity>> working_orders { get; }
public IObservable<TableUpdate<(SecurityImmutable?, PNLUnitImmutable), int>> on_pnl { get; }
public IObservable<TableUpdate<PNLRowData, PNLKey>> security_account_pnl { get; }
public IObservable<TableUpdate<AccountPNLImmutable, uint>> on_account_pnl { get; }
public IObservable<TableUpdate<(SecurityImmutable?, PositionUnitImmutable), int>> on_positions { get; }
public IObservable<TableUpdate<(AlgoData algo, AlgoDefinitionMetadata? meta), AlgoKey>> studio_algos_with_meta { get; }
public IObservable<TableUpdate<(SecurityImmutable?, ManualFillImmutable), int>> on_manual_fills_securities { get; }
@@ -0,0 +1,80 @@
using bts.api;
using bts.api.orderman;
using bts.shell;
using bts.utils;
using mbts.spark;
using mbts.ui.settings;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace mbts {
static class OrderSentEventPredicateVMFactory {
public static Dictionary<OrderSentEventPredicate.PredicateTypeOneofCase, ITemplatedPropertyWrapperVM<OrderSentEventPredicate>> get_oneofs(IBus bus) =>
new Dictionary<OrderSentEventPredicate.PredicateTypeOneofCase, ITemplatedPropertyWrapperVM<OrderSentEventPredicate>> {
{ OrderSentEventPredicate.PredicateTypeOneofCase.AnyOrder, PredicateVMWrapper.create<OrderSentEventPredicate>(p => p.security = null) },
{ OrderSentEventPredicate.PredicateTypeOneofCase.SecurityOrder, SecurityCriteriaVMFactory.create<OrderSentEventPredicate>(bus, o => o.security?.is_value ?? new SecurityCriteria(),
(p, s) => {
if (p.security == null) {
p.security = new SecurityPredicate();
}
p.security.is_value = s;
})
}
};
}
[ProtoContract]
class OrderSentEventPredicate : IEquatable<OrderSentEventPredicate> {
static readonly int _type_hash = typeof(OrderSentEventPredicate).GetHashCode();
// arbitrary short time period (can override in config)
static readonly TimeSpan _stale_order_threshold = TimeSpan.FromSeconds(config.Configuration.get<bts.config.OrderAlerts>().stale_order_threshold_seconds);
public enum PredicateTypeOneofCase {
[Description("(any order)")]
AnyOrder,
[Description("choose securities")]
SecurityOrder
}
[ProtoMember(1)]
public SecurityPredicate security { get; set; }
public PredicateTypeOneofCase predicate_type_case {
get {
if (security != null)
return PredicateTypeOneofCase.SecurityOrder;
return PredicateTypeOneofCase.AnyOrder;
}
}
public IPredicate<OrderSecurity> create(object obj) =>
create_predicate((INotificationServiceDataCache)obj);
public IPredicate<OrderSecurity> create_predicate(INotificationServiceDataCache data_cache) {
var sec_pred = security?.create();
return PredicateBuilder.create<OrderSecurity>(os =>
// verify security
(sec_pred == null || (os.security.HasValue && sec_pred.trigger(os.security.Value))) &&
// verify not stale
((DateTime.Now - os.order.created()) < _stale_order_threshold) &&
// verify order hasn't been added yet
// Note: the notification service should offer a way to connect predicates so that they only receive items in TableUpdate.added,
// however, the notification service predated TableUpdate.Changes, so for now, just check that the history.Count == 1)
(data_cache.order_history.TryGetValue(os.order.Key, out var hist) && hist.Count == 1));
}
public INotificationPredicate<OrderSecurity> create_toast(INotificationServiceDataCache data_cache) =>
throw new NotImplementedException();
public bool Equals(OrderSentEventPredicate other) =>
other != null && other.security.safe_equals(other.security);
public override bool Equals(object obj) =>
Equals(obj as OrderSentEventPredicate);
public override int GetHashCode() =>
EqualityComparer.auto_phase(_type_hash, security?.GetHashCode() ?? 0);
}
}
@@ -5,14 +5,9 @@ using bts.utils;
using mbts.spark;
using mbts.ui;
using mbts.ui.settings;
using mbts.ui.utility;
using mbts.utils;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using OrderType = bts.api.orderman.CustomOrderDefinition.CustomOneofCase;
using PTOC = mbts.OrderRecordTuplePredicate.PredicateTypeOneofCase;
namespace mbts {
@@ -20,6 +15,7 @@ namespace mbts {
// TODO: uncomment the remaining cases when ready
public static Dictionary<PTOC, ITemplatedPropertyWrapperVM<OrderRecordTuplePredicate>> get_oneofs(IBus bus, OrdersModel orders_model) {
return new Dictionary<PTOC, ITemplatedPropertyWrapperVM<OrderRecordTuplePredicate>> {
{ PTOC.SentEvent, wrap(rp => rp.sent_event, (rp, p) => rp.sent_event = p, p => p.predicate_type_case, OrderSentEventPredicateVMFactory.get_oneofs(bus)) },
{ PTOC.FilledEvent, wrap(rp => rp.filled_event, (rp, p) => rp.filled_event = p, p => p.predicate_type_case, OrderFilledEventPredicateVMFactory.get_oneofs(bus)) },
{ PTOC.CompletedEvent, wrap(rp => rp.completed_event, (rp, p) => rp.completed_event = p, p => p.predicate_type_case, OrderCompletedEventPredicateVMFactory.get_oneofs(bus)) },
{ PTOC.CanceledEvent, wrap(rp => rp.canceled_event, (rp, p) => rp.canceled_event = p, p => p.predicate_type_case, OrderCanceledEventPredicateVMFactory.get_oneofs(bus)) },
@@ -77,6 +73,7 @@ namespace mbts {
OrderFilledEventPredicate _filled_event;
OrderCompletedEventPredicate _completed_event;
OrderCanceledEventPredicate _canceled_event;
OrderSentEventPredicate _sent_event;
public enum PredicateTypeOneofCase {
None,
@@ -120,6 +117,8 @@ namespace mbts {
OrderKey,
[PredicateCase(is_toastable:false)]
ParentKey,
[PredicateCase("When order is sent", PredicateCategory.Event)]
SentEvent,
[PredicateCase("When order gets a fill", PredicateCategory.Event)]
FilledEvent,
[PredicateCase("When order is completed", PredicateCategory.Event)]
@@ -176,6 +175,8 @@ namespace mbts {
public OrderCompletedEventPredicate completed_event { get => _completed_event; set => _set(ref _completed_event, value); }
[ProtoMember(23)]
public OrderCanceledEventPredicate canceled_event { get => _canceled_event; set => _set(ref _canceled_event, value); }
[ProtoMember(26)]
public OrderSentEventPredicate sent_event { get => _sent_event; set => _set(ref _sent_event, value); }
[ProtoMember(24)]
public bool is_toast_enabled { get; set; }
[ProtoMember(25)]
@@ -206,6 +207,7 @@ namespace mbts {
if (_filled_event != null) return PTOC.FilledEvent;
if (_completed_event != null) return PTOC.CompletedEvent;
if (_canceled_event != null) return PTOC.CanceledEvent;
if (_sent_event != null) return PTOC.SentEvent;
if (_attached_target_order_key != null) return PTOC.AttachedTargetOrderKey;
return PTOC.None;
}
@@ -236,6 +238,7 @@ namespace mbts {
case PTOC.FilledEvent: return _filled_event.create_predicate(data_cache);
case PTOC.CompletedEvent: return _completed_event.create_predicate(data_cache);
case PTOC.CanceledEvent: return _canceled_event.create(data_cache);
case PTOC.SentEvent: return _sent_event.create(data_cache);
case PTOC.AttachedTargetOrderKey: return wrap(_attached_target_order_key.create(), r => r.order.attached_target_order_key());
default: return null;
}
@@ -285,6 +288,7 @@ namespace mbts {
case PTOC.FilledEvent: return _filled_event.Equals(other._filled_event);
case PTOC.CompletedEvent: return _completed_event.Equals(other._completed_event);
case PTOC.CanceledEvent: return _canceled_event.Equals(other._canceled_event);
case PTOC.SentEvent: return _sent_event.Equals(other._sent_event);
case PTOC.AttachedTargetOrderKey: return _attached_target_order_key.Equals(other._attached_target_order_key);
case PTOC.None: return true;
default: throw ExceptionHelper.unexpected_oneof_case(ptoc);
@@ -320,6 +324,7 @@ namespace mbts {
case PTOC.FilledEvent: raw_hash = _filled_event.GetHashCode(); break;
case PTOC.CompletedEvent: raw_hash = _completed_event.GetHashCode(); break;
case PTOC.CanceledEvent: raw_hash = _canceled_event.GetHashCode(); break;
case PTOC.SentEvent: raw_hash = _sent_event.GetHashCode(); break;
case PTOC.AttachedTargetOrderKey: raw_hash = _attached_target_order_key.GetHashCode(); break;
case PTOC.None: raw_hash = 0; break;
default: throw ExceptionHelper.unexpected_oneof_case(ptoc);
@@ -355,6 +360,7 @@ namespace mbts {
_filled_event = null;
_completed_event = null;
_canceled_event = null;
_sent_event = null;
_attached_target_order_key = null;
}
field = value;
@@ -8,6 +8,7 @@ using mbts.spark;
using mbts.ui;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Windows.Input;
namespace bts.spark {
@@ -41,6 +42,9 @@ namespace bts.spark {
SparkCommand.create("P&L (2.0)", Icons.Accounting, SparkTags.ShowPNLTag);
// Ladder
public static PartialCommand<IImmutableSet<uint>> ShowLadderAutoLookup(KeyGesture key_gesture = null) =>
SparkCommand.create("Ladder", Icons.Ladder, SparkTags.ShowLadderAutoLookupTag, key_gesture);
public static PartialCommand<SecurityMD> ShowLadder(KeyGesture key_gesture = null) =>
SparkCommand.create("Ladder", Icons.Ladder, SparkTags.ShowLadderTag, key_gesture);
+3
View File
@@ -7,6 +7,7 @@ using bts.spark;
using mbts.ui;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
namespace mbts.spark {
@@ -55,6 +56,8 @@ namespace mbts.spark {
// The owners of the various SparkWindows may remove dependencies on the former at their leasure.
// For now, both tags go through the same logic in the LadderWindowFactory anyways.
public static ITag<SecurityMD> ShowLadderTag { get; } = new SparkTag<SecurityMD>("Show Ladder");
// TODO: get rid of the SecurityMD ShowLadderTag. This has created burdensome dependency issues.
public static ITag<IImmutableSet<uint>> ShowLadderAutoLookupTag { get; } = new SparkTag<IImmutableSet<uint>>("Show Ladder Auto Lookup");
public static ITag<IReadOnlyList<SecurityMD>> ShowLaddersTag { get; } = new SparkTag<IReadOnlyList<SecurityMD>>(nameof(ShowLaddersTag));
public static ITag<IObservable<SecurityMD>> ShowLinkedLadder { get; } = new SparkTag<IObservable<SecurityMD>>("Linked Ladder");
public static ITag<SecurityCriteria> ShowMarketViewTag { get; } = new SparkTag<SecurityCriteria>("Show MarketView");
Loaded 100 of 307 files, more files were not shown because too many files have changed in this diff. Show more