Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d706efb10 | ||
|
|
73fe142904 | ||
|
|
8668c54784 | ||
|
|
f29e04751d | ||
|
|
f9f64c23c1 | ||
|
|
d3e9f15e99 | ||
|
|
6dba376e8b | ||
|
|
99b380a9f3 | ||
|
|
175061a81e | ||
|
|
3daad4f7e7 | ||
|
|
8bcf2fde87 | ||
|
|
a5d20157f0 | ||
|
|
d3deac46d4 | ||
|
|
288e8a364a | ||
|
|
61c6d0513c | ||
|
|
b0f2b8e906 | ||
|
|
c194e76e46 | ||
|
|
e7f8cfaec1 | ||
|
|
0aa4f80752 | ||
|
|
b8eecfd853 | ||
|
|
2960ff0996 | ||
|
|
a071b62560 | ||
|
|
95004adbad | ||
|
|
f28334f551 | ||
|
|
718a12200b | ||
|
|
d6dab59254 | ||
|
|
9e6bdf74f6 | ||
|
|
030a8d5614 | ||
|
|
39946baf94 | ||
|
|
19be7d7740 | ||
|
|
37856b9768 | ||
|
|
dd2067802f | ||
|
|
de6c53a765 | ||
|
|
b2a20b47ff | ||
|
|
be16bc2a27 | ||
|
|
71c66f127d | ||
|
|
4987fc9fc1 | ||
|
|
16a4c315a2 | ||
|
|
71619c2e15 | ||
|
|
5392b706df | ||
|
|
cbda28c8b7 | ||
|
|
3956455e81 | ||
|
|
76eb541878 | ||
|
|
d17c56b799 | ||
|
|
e3795f9498 | ||
|
|
8da2569a27 | ||
|
|
a598188c14 | ||
|
|
3648f18a09 | ||
|
|
736e051225 | ||
|
|
e007958afd | ||
|
|
1682513af1 | ||
|
|
cc7e66aa61 | ||
|
|
cea153df5a | ||
|
|
9903b340a6 | ||
|
|
f07b272cff | ||
|
|
9d74a9d114 | ||
|
|
e8f9bb8226 | ||
|
|
033c1ec5de | ||
|
|
7fd2c075a1 | ||
|
|
125773b840 | ||
|
|
4cb743004b | ||
|
|
9dbc9df2a4 | ||
|
|
7c1016d940 | ||
|
|
43198f9602 | ||
|
|
8b1a195121 | ||
|
|
1cde234be4 | ||
|
|
bba6da76fb | ||
|
|
0f68a7f56b | ||
|
|
a4963f8bd9 | ||
|
|
58a762a18a | ||
|
|
90c13d526a | ||
|
|
743d8e0e81 | ||
|
|
eb7a79488f | ||
|
|
3dd7b9638b | ||
|
|
771d4976e9 | ||
|
|
f0a08c6f83 | ||
|
|
c7097faba2 | ||
|
|
e9a341a013 | ||
|
|
15839ba75d | ||
|
|
cd0b24c16a | ||
|
|
7151619645 | ||
|
|
684c4037b6 | ||
|
|
97a50faf16 | ||
|
|
ca2a6a1e60 | ||
|
|
61a112c221 | ||
|
|
8e079a970f | ||
|
|
a4bc22fc3b | ||
|
|
0f81ce1716 | ||
|
|
97deb63deb | ||
|
|
a3b91a4363 | ||
|
|
2551a0f11e | ||
|
|
2f5b06b628 | ||
|
|
575195c67a | ||
|
|
9c20fe892e | ||
|
|
4b626a160d | ||
|
|
bfef852de7 | ||
|
|
dbb859cce9 | ||
|
|
abb451349c | ||
|
|
e77ecaa48c | ||
|
|
1895a75bc7 | ||
|
|
0da184ab73 | ||
|
|
f9357d0860 | ||
|
|
f7bd209efa | ||
|
|
f794ffdace | ||
|
|
504323d5b7 | ||
|
|
9450a952d4 | ||
|
|
62394d0e71 | ||
|
|
8d9697d06d | ||
|
|
d4744d300b | ||
|
|
9b7275e713 | ||
|
|
51ed3a4c2c | ||
|
|
d9e967610e | ||
|
|
2cfbd655cb | ||
|
|
3ed5e5275e | ||
|
|
d997aeca1e | ||
|
|
3b371f3588 | ||
|
|
256b296521 | ||
|
|
38668f8de1 | ||
|
|
b68aaa0a00 | ||
|
|
36e58378e4 | ||
|
|
0ef2378dc9 | ||
|
|
d1d4a1bfb7 | ||
|
|
e22649c19d | ||
|
|
25f749bb0c | ||
|
|
e45ee1730e | ||
|
|
6bd3c6b0ca | ||
|
|
6f65a958ae | ||
|
|
53a4ab4974 | ||
|
|
6e4ed3f328 | ||
|
|
4a292c8030 | ||
|
|
29fbfd4479 | ||
|
|
500e5d508a | ||
|
|
396ac023c4 | ||
|
|
e32f40caee | ||
|
|
4b3cdf9ca4 | ||
|
|
2fc4c8bd60 | ||
|
|
47e7d69897 | ||
|
|
4f830cdd40 | ||
|
|
00e9de3b1e | ||
|
|
ddb4e55d13 | ||
|
|
7e0d79ac68 | ||
|
|
c2dfcbe343 | ||
|
|
582fffb1f4 | ||
|
|
e67756d055 | ||
|
|
42b73006a8 | ||
|
|
2fc85d6810 | ||
|
|
141e1a4ea0 | ||
|
|
097db2f340 | ||
|
|
b49c764c54 | ||
|
|
385387b739 | ||
|
|
87218962e1 | ||
|
|
88d8248f63 | ||
|
|
ffbda10200 | ||
|
|
7eb8b21cea | ||
|
|
986a791801 | ||
|
|
c834a6e840 | ||
|
|
f14c36223f | ||
|
|
d66c8e0ad8 | ||
|
|
8673f366d7 | ||
|
|
88e48ebcf7 | ||
|
|
ea3eacbbae | ||
|
|
9f3941d1a1 | ||
|
|
1a6a10a834 | ||
|
|
d780e2aab2 | ||
|
|
a4bc34e633 | ||
|
|
9c8bb7efeb | ||
|
|
d9b37efbbd | ||
|
|
d23b7942b6 | ||
|
|
f41c3a5334 | ||
|
|
d8e8f90131 | ||
|
|
0358afccf9 | ||
|
|
9f58327d0a | ||
|
|
d3ed6e21e4 | ||
|
|
a171abb741 | ||
|
|
52825e0e59 | ||
|
|
de83f19388 | ||
|
|
4d993f2ef7 | ||
|
|
ca81be3865 | ||
|
|
19ae05cb7d | ||
|
|
79ec41556e | ||
|
|
088377582d | ||
|
|
c8b3973b8f | ||
|
|
efc490cc0d | ||
|
|
a4d542067a | ||
|
|
efd222133e | ||
|
|
361491ebd2 | ||
|
|
559ab69940 | ||
|
|
b35dae9fab | ||
|
|
9d96fcaa45 | ||
|
|
e75be340e2 | ||
|
|
a5b7332fa4 | ||
|
|
b9d3a4d04c | ||
|
|
c7fb636e49 | ||
|
|
e2f314d007 | ||
|
|
80d8307822 | ||
|
|
eca11d0317 | ||
|
|
ced485856e | ||
|
|
08c54f75eb | ||
|
|
6c0cc76773 | ||
|
|
e332edb36b | ||
|
|
70b5d9adc6 | ||
|
|
23ee9508c2 | ||
|
|
8adcc98ff1 | ||
|
|
42afdc2994 | ||
|
|
1dc87de975 | ||
|
|
49ba2e72a9 | ||
|
|
47dc0d579b | ||
|
|
ef6662d4f8 | ||
|
|
b9aaaa7d37 | ||
|
|
ec43039b94 | ||
|
|
4939b85819 | ||
|
|
fab7596d06 | ||
|
|
81d67f640b | ||
|
|
3233187fd9 | ||
|
|
fe8f217587 | ||
|
|
b69958007d | ||
|
|
f433a3163b | ||
|
|
bb82590e5e | ||
|
|
1855fe3045 | ||
|
|
e3dba306a7 | ||
|
|
74f79a2f52 | ||
|
|
2c384af157 | ||
|
|
99fd77c1f1 | ||
|
|
7b0e3edfcf | ||
|
|
99b71ad2aa | ||
|
|
58c5eeb6d1 | ||
|
|
cbb638ff7a | ||
|
|
9cd2518853 | ||
|
|
2db8d717d4 | ||
|
|
df56c85e7b | ||
|
|
fb12d429cb |
No files matched your search
Vendored
+1
-1
@@ -209,7 +209,7 @@
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/home/bts/spark/build/ninja_debug/src/server/sparkd/sparkd",
|
||||
"args": ["test","Co2RelayTests"],
|
||||
"args": ["test","Co2Tests"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "/home/bts/spark/build/ninja_debug/src/server/sparkd/",
|
||||
"environment": [],
|
||||
|
||||
+1
-1
@@ -41,6 +41,7 @@ else ()
|
||||
-Wno-missing-braces -Wno-ignored-qualifiers \
|
||||
--std=c++17 -fdiagnostics-color")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -DNDEBUG -O3")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wno-undef")
|
||||
add_subdirectory(src/server/sparkd)
|
||||
add_subdirectory(src/lib)
|
||||
add_subdirectory(src/web)
|
||||
@@ -51,7 +52,6 @@ else ()
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/src/server/sparkd/sparkd ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/src/server/sparkd/defaults ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/web ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/data_files ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/src/lib/libspark.so ${CMAKE_BINARY_DIR}/server
|
||||
|
||||
@@ -25,3 +25,47 @@
|
||||
***** FillStore
|
||||
***** SecuritySrc
|
||||
* Benchmarks
|
||||
* OrderMan
|
||||
** OrderServices
|
||||
*** callbacks
|
||||
**** standard
|
||||
- update
|
||||
- cancel
|
||||
- crack
|
||||
- activate
|
||||
- book
|
||||
- settlement
|
||||
- child order state
|
||||
- timer
|
||||
**** low level
|
||||
- exe reports
|
||||
- cancel rejects
|
||||
- gateway status
|
||||
*** services
|
||||
**** standard
|
||||
- secdb
|
||||
- get time
|
||||
- schedule actions
|
||||
- order builder
|
||||
- activate
|
||||
- update
|
||||
- cancel
|
||||
- crack
|
||||
**** low level
|
||||
- governor
|
||||
- send fix
|
||||
- get time str
|
||||
- limiter
|
||||
** Internalize plan
|
||||
- change order initiated update/cancel/crack/activate/report_state to
|
||||
use direct method calls
|
||||
- need to watch out for reentrancy
|
||||
- need to also report state externally
|
||||
- also want to separate active from non active orders in map to speed
|
||||
up look ups
|
||||
- want to use direct references in orders to avoid lookups
|
||||
- want to change how time is captured, the trace is too big to copy
|
||||
around
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
set(sources /home/ppinto/Dropbox/bts/spark/doc/user/build.sh;/home/ppinto/Dropbox/bts/spark/doc/user/mkdocs.yml;bts-help-theme/404.html;bts-help-theme/base.html;bts-help-theme/content.html;bts-help-theme/css/base.css;bts-help-theme/css/bts.css;bts-help-theme/css/font-awesome.min.css;bts-help-theme/css/highlight.css;bts-help-theme/css/local.css;bts-help-theme/fonts/fontawesome-webfont.eot;bts-help-theme/fonts/glyphicons-halflings-regular.eot;bts-help-theme/img/favicon.ico;bts-help-theme/js/base.js;bts-help-theme/js/bootstrap-3.0.3.min.js;bts-help-theme/js/highlight.pack.js;bts-help-theme/js/jquery-1.10.2.min.js;bts-help-theme/keyboard-modal.html;bts-help-theme/main.html;bts-help-theme/nav-sub.html;bts-help-theme/nav.html;bts-help-theme/search-modal.html;bts-help-theme/toc.html;docs/Help.md;docs/Launcher.md;docs/Logging-In-to-the-System.md;docs/Market.md;docs/My-Windows.md;docs/Settings.md;docs/Spreader.md;docs/Trading.md;docs/images/image1.png;docs/images/image10.png;docs/images/image11.png;docs/images/image12.png;docs/images/image13.png;docs/images/image14.png;docs/images/image15.png;docs/images/image16.png;docs/images/image17.png;docs/images/image18.png;docs/images/image19.png;docs/images/image2.png;docs/images/image20.png;docs/images/image21.png;docs/images/image22.png;docs/images/image23.png;docs/images/image24.png;docs/images/image25.png;docs/images/image26.png;docs/images/image27.png;docs/images/image28.png;docs/images/image29.png;docs/images/image3.png;docs/images/image30.png;docs/images/image31.png;docs/images/image32.png;docs/images/image33.png;docs/images/image34.png;docs/images/image35.png;docs/images/image36.png;docs/images/image37.png;docs/images/image38.png;docs/images/image39.png;docs/images/image4.png;docs/images/image40.png;docs/images/image41.png;docs/images/image42.png;docs/images/image43.png;docs/images/image44.png;docs/images/image45.png;docs/images/image46.png;docs/images/image47.png;docs/images/image48.png;docs/images/image49.png;docs/images/image5.png;docs/images/image50.png;docs/images/image51.png;docs/images/image52.png;docs/images/image53.png;docs/images/image54.png;docs/images/image55.png;docs/images/image56.png;docs/images/image57.png;docs/images/image58.png;docs/images/image59.png;docs/images/image6.png;docs/images/image60.png;docs/images/image61.png;docs/images/image62.png;docs/images/image63.png;docs/images/image64.png;docs/images/image65.png;docs/images/image66.png;docs/images/image67.png;docs/images/image68.png;docs/images/image69.png;docs/images/image7.png;docs/images/image70.png;docs/images/image71.png;docs/images/image72.png;docs/images/image73.png;docs/images/image74.png;docs/images/image76.png;docs/images/image8.png;docs/images/image9.png;docs/index.md;docs/release_notes.md)
|
||||
@@ -16,6 +16,7 @@ set(DOC_GLOBS
|
||||
favicon.ico
|
||||
)
|
||||
file (GLOB_RECURSE All_Deps RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${DOC_GLOBS})
|
||||
set (All_Deps ${All_Deps} ${CMAKE_CURRENT_SOURCE_DIR}/build.sh ${CMAKE_CURRENT_SOURCE_DIR}/mkdocs.yml)
|
||||
update_deps_file("${All_Deps}")
|
||||
# END DEPENDENCIES
|
||||
|
||||
|
||||
+10
-1
@@ -1,2 +1,11 @@
|
||||
#!/bin/bash
|
||||
python -m mkdocs build -d $1
|
||||
tmpfile=$(mktemp /tmp/quiet_build_log.XXXX)
|
||||
python -m mkdocs build -d $1 >$tmpfile 2>&1
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
rm $tmpfile
|
||||
exit 0
|
||||
else
|
||||
cat $tmpfile
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,5 +1,9 @@
|
||||
#Help
|
||||
|
||||
<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>
|
||||
|
||||
##Report a Problem
|
||||
If there is any issue at all, you can click here
|
||||
and it’ll bring up a “Report a Problem” window, which you can type
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#Module Launcher
|
||||
|
||||
<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>
|
||||
|
||||
- The module launcher is the first item that will come up after
|
||||
logging in to Spark.
|
||||
- This is your central control for all modules
|
||||
@@ -9,7 +13,7 @@
|
||||
|
||||

|
||||
|
||||
- If you right click anywhere on the launcher you can modify
|
||||
- If you right-click anywhere on the launcher you can modify
|
||||
various display settings including:
|
||||
- Vertical layout, instead of horizontal
|
||||
- Showing the text of the individual modules
|
||||
@@ -25,5 +29,5 @@
|
||||
Some common features within BTS Spark
|
||||
|
||||
- All Windows are tabbed so they can be combined or separated to organize your workspace
|
||||
- Some Spark windows have a menu on the left hand side where you can launch related modules or change settings. You can see the menu item names either by hovering your mouse over the icon, or clicking on the right edge of the menu (a blue bar will appear).
|
||||
- Some Spark windows have a menu on the left-hand side where you can launch related modules or change settings. You can see the menu item names either by hovering your mouse over the icon or clicking on the right edge of the menu (a blue bar will appear).
|
||||
- Some table columns have filtering capabilities, where if you hover over the column header, it will display a filter icon, which enables you to filter the table based on the information in that column.
|
||||
+16
-8
@@ -9,6 +9,10 @@
|
||||
|
||||
##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>
|
||||
|
||||
- This provides a grid of outright, spread, and synthetic products
|
||||
showing real-time market data all in one place
|
||||
- You can create multiple market view grids and customize the
|
||||
@@ -29,7 +33,7 @@
|
||||
and all securities will be displayed. This will show up in the
|
||||
selected securities window as “<symbol> future at
|
||||
<exchange>”
|
||||
- Synthetic’s can be displayed by clicking on exchange “BTS”, then
|
||||
- Synthetics can be displayed by clicking on exchange “BTS”, then
|
||||
synthetic, symbol, and finally under the securities window.
|
||||
- Below is an example of an outright, spread, all futures, and
|
||||
synthetic chosen:
|
||||
@@ -98,10 +102,10 @@
|
||||
either the Bid or Ask price and volume.
|
||||
- Highlighting a single security and clicking on the order ticket
|
||||
 icon
|
||||
on the left hand browser window of the market view
|
||||
on the left-hand browser window of the market view
|
||||
|
||||
- Launch a ladder for 1 security
|
||||
- You can double click on any security in the market view, besides
|
||||
- You can double-click on any security in the market view, besides
|
||||
the Bid Qty, Bid Price, Ask Price, or Ask Qty columns to launch a
|
||||
ladder for that Security.
|
||||
|
||||
@@ -110,7 +114,7 @@
|
||||
- If you hold down the Ctrl key and select multiple securities, you
|
||||
can then click on the ladder icon
|
||||
 on
|
||||
the left hand side to bring up the selected ladders all at
|
||||
the left-hand side to bring up the selected ladders all at
|
||||
once.
|
||||
|
||||
- Launching a Fills window for 1 or many securities
|
||||
@@ -118,7 +122,7 @@
|
||||
- This is done by either highlighting 1 or many securities and then
|
||||
clicking on the Fills icon
|
||||
 on
|
||||
the left hand side to bring up a fill window for the selected
|
||||
the left-hand side to bring up a fill window for the selected
|
||||
securities.
|
||||
|
||||
- Please note - If there haven’t been any fills for the day in that
|
||||
@@ -129,14 +133,14 @@
|
||||
- This is accomplished by highlighting 1 or many securities and then
|
||||
clicking on the time and sales icon
|
||||
 on
|
||||
the left hand side
|
||||
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
|
||||
 on
|
||||
the lower left hand side
|
||||
the lower left-hand side
|
||||
|
||||
- Please note - If only 1 security is chosen, a create synthetic
|
||||
window will appear, and you will be required to add another leg from
|
||||
@@ -144,7 +148,11 @@
|
||||
|
||||
##Time and Sales
|
||||
|
||||
- Provides a display of real time fills as they happen for 1 or many
|
||||
<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>
|
||||
|
||||
- Provides a display of real-time fills as they happen for 1 or many
|
||||
securities
|
||||
- You can create multiple time and sale windows and customize the
|
||||
security selection to fit your needs
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#My Windows
|
||||
|
||||
<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>
|
||||
|
||||
This is the housing of the windows that you have manually named and
|
||||
creates a place where you can quickly and easily launch windows
|
||||
which you’ve customized.
|
||||
@@ -18,9 +22,9 @@ section of the module launcher.
|
||||
|
||||

|
||||
|
||||
Right clicking on a tab that has already had its default title modified
|
||||
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
|
||||
title or remove it from the My Windows, which will then restore the
|
||||
default standard title.
|
||||
|
||||

|
||||
@@ -1,6 +1,10 @@
|
||||
|
||||
#Settings
|
||||
|
||||
<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>
|
||||
|
||||
##Workspaces
|
||||
|
||||
This is where your workspaces can be saved or switched
|
||||
|
||||
+34
-14
@@ -1,14 +1,35 @@
|
||||
|
||||
#Spreader
|
||||
|
||||
<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
|
||||
synthetic management browser which appears like below:
|
||||
|
||||

|
||||
|
||||
- From this window it’ll show any synthetics that you have already
|
||||
- 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
|
||||
synthetics and other tasks all from the left-hand side pane within
|
||||
the window, including:
|
||||
|
||||
- Adding a new synthetic 
|
||||
@@ -30,7 +51,7 @@
|
||||
- From the main module launcher, you can go to spreader, then
|
||||
synthetics, then click add
|
||||
- Highlighting one or more securities in a market view and clicking
|
||||
on create synthetic
|
||||
on Create Synthetic
|
||||
- Cloning an existing security
|
||||
|
||||
- An empty synthetic browser will look like below without any legs
|
||||
@@ -43,10 +64,10 @@
|
||||
- Upon adding legs, you can then go through each of the parameters to
|
||||
customize how you would like the spread to be worked in the
|
||||
market
|
||||
- We’ll start at the top of create synthetic window and work our way
|
||||
- We will start at the top of the Create Synthetic window and work our way
|
||||
down:
|
||||
|
||||
- At the very top of the create synthetic window you will have to
|
||||
- At the very top of the Create Synthetic window you will have to
|
||||
name your synthetic product. By default, it will auto-populate
|
||||
based on the symbols you have chosen:
|
||||
|
||||
@@ -73,16 +94,15 @@
|
||||
exchange
|
||||
- Furthermore, if you are ever unsure of what a parameter’s function
|
||||
is and how it is controlled you can hover over the parameter’s title
|
||||
and a “?” will be shown. Clicking on this will expand built in
|
||||
and a “?” will be shown. Clicking on this will expand built-in
|
||||
details of how that parameter functions. Below is an example of the
|
||||
throttle details displayed:
|
||||
|
||||

|
||||
|
||||
- Main parameters - these are the top 4 rows in the create synthetic
|
||||
- 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 are custom to a traders needs, however the
|
||||
top 4 are the main foundational aspects used for the calculation of
|
||||
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:
|
||||
|
||||

|
||||
@@ -95,7 +115,7 @@
|
||||
be priced, by default, it’ll be based on the same as the quantity of
|
||||
the synthetic produced, but you can change it to modify the balance
|
||||
of the price, giving more weighting to one leg over another.
|
||||
- Enable quoting - This parameter is in the form of a check box,
|
||||
- Enable quoting - This parameter is in the form of a checkbox,
|
||||
where if the box is checked the leg will be quoted versus not
|
||||
checked, it will not be shown in the market. If it is not actively
|
||||
quoted in the market, the leg will still be used for calculation of
|
||||
@@ -107,7 +127,7 @@
|
||||
If your Hedge Ratio is 3 on the NQ leg, then you’ll work the ES
|
||||
order based on where you could fill 6 (2 (Qty of NQ) \* 3 (Hedge
|
||||
Ratio)).
|
||||
- The next 6 parameters are all completely custom to a traders needs
|
||||
- The next 6 parameters are all completely custom to a trader's needs
|
||||
and can further define how a synthetic is worked. As previously
|
||||
mentioned, if you hover over any of these parameters a “?” will be
|
||||
displayed and click on such will display further details on how this
|
||||
@@ -118,7 +138,7 @@
|
||||
- Quote
|
||||
|
||||
- Throttle - This can be enabled or disabled based on if the box is
|
||||
checked per leg. It’s main function is to reduce re-quoting updates
|
||||
checked per leg. Its main function is to reduce re-quoting updates
|
||||
by defining a region on either side of the working quote order,
|
||||
inside which quote updates will not be sent:
|
||||
|
||||
@@ -148,8 +168,8 @@
|
||||
|
||||

|
||||
|
||||
- Time Based Cross - Basically the exact same as ticks away cross,
|
||||
however this is based on time (in ms) on when to automatically cross
|
||||
- Time Based Cross - Basically the same as Ticks Away Cross,
|
||||
however, this is based on time (in ms) on when to automatically cross
|
||||
(fill) the market if they get too far away from the opposite inside
|
||||
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
|
||||
|
||||
+55
-41
@@ -9,7 +9,11 @@
|
||||
|
||||
##Order Book
|
||||
|
||||
- This provides list of all orders a user has placed, by default it
|
||||
<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>
|
||||
|
||||
- This provides a list of all orders a user has placed, by default it
|
||||
will display only working orders
|
||||
- You can create multiple order books filtered however you would
|
||||
like
|
||||
@@ -44,39 +48,39 @@
|
||||
- Anytime
|
||||
- Today
|
||||
- Since Open
|
||||
- A specific user defined period of time
|
||||
- A specific user-defined period of time
|
||||
|
||||

|
||||
|
||||
- The left hand box within an order book provides users with further
|
||||
- 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’s appears like the below:
|
||||
well as launch other modules. It appears like the below:
|
||||
|
||||

|
||||
|
||||
- ][Fills -
|
||||
- Fills -
|
||||
clicking on this will launch a fills window
|
||||
- ][ Modify -
|
||||
-  Modify -
|
||||
clicking on this will launch an order ticket for a live order
|
||||
highlighted in the Order Book.
|
||||
- ][Cancel
|
||||
- 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 click on each row of orders
|
||||
- ][Cancel
|
||||
holding hold the Ctrl key when clicking on each row of orders
|
||||
- Cancel
|
||||
buys - clicking on this will cancel all the buy orders you have in
|
||||
the order book
|
||||
- ][Cancel
|
||||
- Cancel
|
||||
sells - clicking on this will cancel all the sell orders you have in
|
||||
the order book
|
||||
- ][Cancel
|
||||
- Cancel
|
||||
all - clicking on this will cancel all working orders you have the
|
||||
order book
|
||||
|
||||
##Fills
|
||||
|
||||
- This provides list of all fills a user has had for a given time
|
||||
period, by default it will open up with “since open” time frame
|
||||
- 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
|
||||
selected showing you fills on the day thus far
|
||||
- You can create multiple fill windows, filtered however you
|
||||
like
|
||||
@@ -85,8 +89,12 @@
|
||||
|
||||
##P&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>
|
||||
|
||||
- This provides a running ledger of a users account(s) profit and
|
||||
loss broken down per symbol
|
||||
loss, broken down per symbol
|
||||
- You can create multiple P&L windows, filtered however you would
|
||||
like
|
||||
- All P&L windows are brought up as tabs and can be combined with all
|
||||
@@ -101,6 +109,10 @@
|
||||
|
||||
##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>
|
||||
|
||||
- The ladder was designed to be the most logically produced ladder on
|
||||
the market, engineered and designed by professional traders for
|
||||
professional traders
|
||||
@@ -112,8 +124,8 @@
|
||||
|
||||

|
||||
|
||||
- The ladder consist of 2 major parts, the Ladder itself and the
|
||||
information and control section on the left hand side
|
||||
- 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: 
|
||||
- Day - showing the current price of the security on the day
|
||||
@@ -126,17 +138,17 @@
|
||||
|
||||
|
||||
- The control section right underneath the information section on the
|
||||
left hand side offers the following:
|
||||
left-hand side offers the following:
|
||||
|
||||

|
||||
|
||||
- Account in which the orders will flow into when trading this
|
||||
- The account in which the orders will flow into when trading this
|
||||
security
|
||||
- Length of time the order will remain in market, either DAY or
|
||||
- Length of time the order will remain in the market, either DAY or
|
||||
GTC
|
||||
- Order type, by default orders will go in as Limit, however all of
|
||||
- Order type, by default, orders will go in as Limit, however all of
|
||||
the following are offered out of the box. The top 5 are all fairly
|
||||
standard order types, however the bottom 5 are all specialized
|
||||
standard order types, however, the bottom 5 are all specialized
|
||||
algos. They are only offered by BTS and require specialized
|
||||
parameters. Please see below for each order type:
|
||||
|
||||
@@ -147,8 +159,8 @@
|
||||
|
||||
- Limit
|
||||
|
||||
- This is a buy or sell order designed to take place on the exact
|
||||
price level you have entered the order at.
|
||||
- This is a buy or sell order designed to take place on the
|
||||
price level where you entered the order.
|
||||
|
||||
- Stop
|
||||
|
||||
@@ -168,10 +180,10 @@
|
||||
- Iceberg
|
||||
|
||||
- This is a buy or sell order where the order is divided into a
|
||||
visible or “show” portion which is seen at the exchange. ][The
|
||||
visible or “show” portion which is seen at the exchange. The
|
||||
rest of the order is hidden and will remain hidden until the show
|
||||
quantity is filled, essentially reloading the order back to the show
|
||||
quantity. You will need to ][define what type of order that will
|
||||
quantity. You will need to define what type of order that will
|
||||
be used for the child order to be sent.
|
||||
|
||||

|
||||
@@ -218,8 +230,7 @@
|
||||
market flips and has at least threshold size as defined.
|
||||
- “Flip” refers to the event where the best offer becomes the best
|
||||
bid or the market trades away from you, i.e. the line moves up in
|
||||
the GUI. This is all true in the reverse way as well if
|
||||
selling.
|
||||
the GUI. The reverse is true if selling.
|
||||
|
||||

|
||||
|
||||
@@ -241,7 +252,7 @@
|
||||
|
||||
- You can manually type in a quantity here as well
|
||||
- Furthermore, if you have a value in the volume bar, you can
|
||||
increase this size by right clicking and the value will increase
|
||||
increase this size by right-clicking and the value will increase
|
||||
incrementally by 1. The same is true if you would like to decrease
|
||||
this value by left click and the value will decrease.
|
||||
- By having the auto clear box checked, it will bring the value back
|
||||
@@ -252,12 +263,12 @@
|
||||
- The bottom section of the control area of a ladder has 4 aspects
|
||||
to it
|
||||
|
||||
- Cancel Buys - which will cancel all buys currently working on the
|
||||
- Cancel Buys, which will cancel all buys currently working on the
|
||||
ladder
|
||||
- Cancel Sells - which will cancel all sells currently working on the
|
||||
- Cancel Sells, which will cancel all sells currently working on the
|
||||
ladder
|
||||
- Cancel All - which will cancel all orders on the ladder
|
||||
- Settings - this will launch the ladder settings window which
|
||||
- Cancel All, which will cancel all orders on the ladder
|
||||
- Settings, which will launch the ladder settings window which
|
||||
appears like below
|
||||
|
||||

|
||||
@@ -269,27 +280,26 @@
|
||||
|
||||
- There are 5 main columns
|
||||
|
||||
- Orders - which display current orders working in the market
|
||||
- Bid - which displays the current bid volumes at each price
|
||||
- Orders, which display current orders working in the market
|
||||
- Bid, which displays the current bid volumes at each price
|
||||
level
|
||||
- Price - which displays the price levels of the symbol shown
|
||||
- Ask - which displays the current ask volumes at each price
|
||||
- Price, which displays the price levels of the symbol shown
|
||||
- Ask, which displays the current ask volumes at each price
|
||||
level
|
||||
- Last Trade - which displays where the price level and volume of
|
||||
- Last Trade, which displays the price level and volume
|
||||
where the last trade occurred
|
||||
|
||||
- Functionality of the ladder
|
||||
|
||||
- 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
|
||||
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
|
||||
|
||||

|
||||
|
||||
- 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
|
||||
- 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
|
||||
- To cancel the order, left click on the badge
|
||||
- Furthermore, you can click down on the scroll wheel of your mouse
|
||||
@@ -298,6 +308,10 @@
|
||||
|
||||
## 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>
|
||||
|
||||
- The order ticket was designed to provide another means other than
|
||||
the ladder to enter orders into the market
|
||||
- You can bring up an order ticket directly from the module launcher,
|
||||
@@ -307,7 +321,7 @@
|
||||
|
||||

|
||||
|
||||
- On the top left you have the price for the order as well as the
|
||||
- On the top left, you have the price for the order as well as the
|
||||
volume
|
||||
- Beneath are the predefined volumes as well as a clear button to
|
||||
clear out the volume
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
|
||||
Click on the headings on the the left to expand their contents. If you need specific information quickly use the Search button in the top right of this page.
|
||||
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.
|
||||
|
||||
@@ -1,4 +1,54 @@
|
||||
# Release Notes
|
||||
## 1.4.2
|
||||
|
||||
### User Interface Improvements
|
||||
- When creating a synthetic from the Market View window, securities are now added to the Create Synthetic dialog in the same sort order as they appear in grid
|
||||
### Bug Fixes
|
||||
- Shell no longer crashes when removing a security from the synthetics window
|
||||
- It is now possible to create a new synthetic using the same name as a previously deleted synthetic
|
||||
### SDK Improvements
|
||||
- Improved Client and Server SDK clarity and documentation
|
||||
### Performance Improvements
|
||||
- Synthetic calculation speed was improved by 400%.
|
||||
### Risk / Entitlement System
|
||||
- Risk Admin UI
|
||||
- Spark users now have separate Trading, RiskAdmin, and/or MDAdmin permissions
|
||||
- Spark users can now only add other users or accounts if permissioned to do so.
|
||||
- Market Data Entitlement
|
||||
- Automated market data reporting
|
||||
|
||||
|
||||
## 1.4.1
|
||||
|
||||
### Tabs
|
||||
- Tabs now shrink and expand to make better use of horizontal space
|
||||
### Bug Fixes
|
||||
- Fixed a bug that could cause excessive CPU usage when a connection broke
|
||||
- Fixed a layout bug in hedging/requoting performance reports
|
||||
- Fixed account name mismatching bug for old fills
|
||||
### Absolute Position limits
|
||||
- Positions can now be netted or absolute for purposes of limit enforcing
|
||||
|
||||
## 1.4.0
|
||||
|
||||
### Speed Enhancements
|
||||
- Improved requoting and hedging performance
|
||||
- Improved order book form performance
|
||||
### Server Side SDK
|
||||
- Added a beta version of the server side SDK
|
||||
### Front End
|
||||
- Added status bars to all UI grids
|
||||
### Reporting
|
||||
- Added reporting of hedging and requoting performance
|
||||
|
||||
## 1.3.8
|
||||
|
||||
### Speed Enhancements
|
||||
- Further speed enhancements
|
||||
### Conditional (new quoting parameter)
|
||||
- Reduces re-quoting updates by only quoting if N ticks away from the opposite inside market.
|
||||
- Quotes are canceled when it gets further away.
|
||||
- "Price Type" dictates if this logic applies to the quoting market or to the synthetic spread market.
|
||||
|
||||
## 1.3.7
|
||||
|
||||
@@ -21,7 +71,7 @@
|
||||
### Synthetic creation option to choose Merged or Direct
|
||||
- The ability to choose Merged or Direct per leg when creating a synthetic
|
||||
### Volume at price
|
||||
- Within a ladder you can now see a volume at price graph
|
||||
- Within a ladder, you can now see a volume at price graph
|
||||
- This is configurable from a ladder's settings as well
|
||||
### Customized settings in all windows
|
||||
- All windows now contain a settings page where grid settings (font color, size, etc) are applied
|
||||
@@ -39,7 +89,7 @@
|
||||
|
||||
### Order Book
|
||||
- Many visual facets of the Order Book grid can now be customized
|
||||
- The Order Book settings page can be access from the gears icon in the Order Book toolbar or from the right-click menu
|
||||
- The Order Book settings page can be accessed from the gears icon in the Order Book toolbar or from the right-click menu
|
||||
- The Expand/Collapse All button has been separated into two different buttons on the toolbar
|
||||
|
||||
### Sound Alerts
|
||||
@@ -75,13 +125,13 @@
|
||||
### Synthetics
|
||||
- Hedge Ratio parameter has been renamed to Lean Qty Factor
|
||||
- Spreader now includes a Hidden mode parameter
|
||||
- A quoting leg can be hidden, ie an order will not sent out until the market crosses the computed quoting price. When that happens, the quote is sent out as an IOC order.
|
||||
- A quoting leg can be hidden, ie an order will not be sent out until the market crosses the computed quoting price. When that happens, the quote is sent out as an IOC order.
|
||||
|
||||
### Algos
|
||||
- Trigger orders now can contain a Trigger Exit parameter based on time or price; once the exit condition has been met the Trigger order will cancel
|
||||
- IOC/FAK order type added
|
||||
- Cover order type added
|
||||
- Cancelling a synthetic order no longer cancels any working hedge orders
|
||||
- Canceling a synthetic order no longer cancels any working hedge orders
|
||||
|
||||
### General
|
||||
- A manual page has been added to the launcher Help menu
|
||||
@@ -89,18 +139,18 @@
|
||||
- Various cash per point values updated
|
||||
- Time-based grid filters now have tick up/down buttons
|
||||
- Numerous performance improvements and stability enhancements
|
||||
- Automated position and orderbook maintenance during daily recycle
|
||||
- Individual fills be compacted into start of day position records
|
||||
- Automated position and Order Book maintenance during daily recycle
|
||||
- Individual fills will be compacted into the Start of Day position records
|
||||
- Orders from the day before the recycle will be deleted
|
||||
|
||||
|
||||
##1.1
|
||||
|
||||
###1.1.22
|
||||
- Orderbook: Orders in Error status can now be recreated
|
||||
- Orderbook: Orders containing child orders will now be collapsed by default.
|
||||
- Orderbook: Expand / Collapse All button added to the right-click menu and window action pane, denoted by ▲ icon
|
||||
- Orderbook: Symbol column added to allow for filtering based on group symbol
|
||||
- Order Book: Orders in Error status can now be recreated
|
||||
- Order Book: Orders containing child orders will now be collapsed by default.
|
||||
- Order Book: Expand / Collapse All button added to the right-click menu and window action pane, denoted by ▲ icon
|
||||
- Order Book: Symbol column added to allow for filtering based on group symbol
|
||||
- Time filters now have a quick Set Last Hour hyperlink which will set the Period Begin filter to (Now - 1 hour)
|
||||
|
||||
###1.1.20
|
||||
@@ -119,15 +169,15 @@
|
||||
- Fixed occasional crash when filtering fills
|
||||
- Fixed several cash per point multipliers
|
||||
- Colored time of sales row with aggressor side
|
||||
- Iceberg orders now cancel (rathern than error) when a child is canceled
|
||||
- Iceberg orders now cancel (rather than an error) when a child is canceled
|
||||
|
||||
###1.1.0
|
||||
- Added per user self match protection, location and self match protection FIX tag settings
|
||||
- Implemented a new "Trigger Order" algo
|
||||
- Corrected tick formatting for a number of products
|
||||
- Added the hability to recreate canceled orders
|
||||
- Added leg fills to facilitate futured based PnL
|
||||
- PnL report now has PnL columns calculated based on your start of day, current day, and total position
|
||||
- Added the ability to recreate canceled orders
|
||||
- Added leg fills to facilitate futures based PnL
|
||||
- PnL report now has PnL columns calculated based on your Start of Day, current day, and total position
|
||||
- Start, Day and Total PnL columns are painted with a red or green background color based on if the pnl value is negative or positive respectively
|
||||
- Corrected cash per point values, used in pnl calculations, for a number of products
|
||||
- PnL report will now remember any customizations you make to filtering and/or sorting criteria
|
||||
- PnL report will now remember any customizations you make to filtering and/or sorting criteria
|
||||
+1
-1
Submodule docker/linux updated: aedfd79e02...8ee9692597.
@@ -1,3 +1,10 @@
|
||||
1.4.2
|
||||
- Be sure the system has a bts user before deployment. bts is the superuser, he has all permissions and can see all market data
|
||||
- After deployment re-permission all existing users for trading, riskadmin, and/or md admin permissions as appropriate
|
||||
- Also note which users can add other users and accounts and permission them appropriately (Can Add?)
|
||||
- Permission users for appropriate market data entitlements; this has monetary consequences so ask Kevin if you aren't sure.
|
||||
- MIC reporting needs to be added to audit Jenkins job (https://bluetradesys.atlassian.net/browse/SPARK-1900)
|
||||
|
||||
1.3.5
|
||||
- Change in market data wire format. Old shell will get only direct market data instead of merged which may not match what the servers is driving from.
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace mbts.spark {
|
||||
IEnumerable<BTSAccountImmutable> active_accounts =
|
||||
from admin_data in update.all
|
||||
from bts_account in admin_data.Accounts
|
||||
where bts_account.IsPresent
|
||||
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
|
||||
|
||||
@@ -16,26 +16,26 @@ namespace mbts.spark
|
||||
{
|
||||
_admin_data = admin_data;
|
||||
_user_name = user_name ?? string.Empty;
|
||||
_allowed_accounts = search_admin(u => u.Name == _user_name).Select(x => x.Item1).ToList();
|
||||
foreach(var val in _allowed_accounts)
|
||||
_allowed_accounts = search_admin(u => u.Name == _user_name).Where(x =>
|
||||
{
|
||||
return x.Item2.HasPermissions || x.Item3.HasPermissions;
|
||||
}).Select(xx => xx.Item1).ToList();
|
||||
foreach (var val in _allowed_accounts)
|
||||
_allowed_account_dict[val.Name] = val.Name;
|
||||
}
|
||||
public IEnumerable<Tuple<BTSAccountImmutable, TradingPermissionUnitImmutable>> get_trading_permissions(UInt32 user_id)
|
||||
{
|
||||
return search_admin(u => u.Id == user_id);
|
||||
}
|
||||
public IEnumerable<BTSAccountImmutable> viewable_accounts()
|
||||
{
|
||||
return _allowed_accounts;
|
||||
}
|
||||
public bool can_view_account(string account)
|
||||
{
|
||||
return _allowed_account_dict.ContainsKey(account) || _user_name.ToLower() == "bts";
|
||||
return _allowed_account_dict.ContainsKey(account) || _user_name.ToLower().Equals("bts");
|
||||
}
|
||||
|
||||
IEnumerable<Tuple<BTSAccountImmutable, TradingPermissionUnitImmutable>> search_admin(Func<BTSUserImmutable, bool> predicate)
|
||||
IEnumerable<Tuple<BTSAccountImmutable, TradingPermissionUnit, AdminPermissionUnit>>
|
||||
search_admin(Func<BTSUserImmutable, bool> predicate)
|
||||
{
|
||||
var rv = new List<Tuple<BTSAccountImmutable, TradingPermissionUnitImmutable>>();
|
||||
var rv = new List<Tuple<BTSAccountImmutable, TradingPermissionUnit, AdminPermissionUnit>>();
|
||||
if (_admin_data.HasValue)
|
||||
{
|
||||
var users = _admin_data.Value.Users.Where(predicate);
|
||||
@@ -51,9 +51,7 @@ namespace mbts.spark
|
||||
if (accounts != null && accounts.Count() == 1)
|
||||
{
|
||||
var account = accounts.ElementAt(0);
|
||||
var tp = kv.Value.TradingPermission;
|
||||
var rv_val = new TradingPermissionUnitImmutable(tp);
|
||||
rv.Add(Tuple.Create(account, rv_val));
|
||||
rv.Add(Tuple.Create(account, kv.Value.TradingPermission, kv.Value.AdminPermission));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace bts {
|
||||
.Subscribe(t => {
|
||||
var deleted_synthetic_keys = new HashSet<uint>(t.Where(kv => kv.Value.Deleted).Select(kv => kv.Key));
|
||||
// add back 'undeleted' synthetics
|
||||
foreach (var kvp in _deleted_synthetics) {
|
||||
foreach (var kvp in _deleted_synthetics.ToList()) {
|
||||
if (!deleted_synthetic_keys.Contains(kvp.Key)) {
|
||||
_exchange_sec_map.TryAdd(kvp.Key, kvp.Value);
|
||||
_deleted_synthetics.Remove(kvp.Key);
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace mbts.spark {
|
||||
})
|
||||
),
|
||||
SparkCommands.ShowTimeAndSales.complete(_vm.selected_securities_observable(), _ => true, secs => secs.Count > 0 ? new SecurityCriteria(secs) : _state.security_criteria),
|
||||
SparkCommands.ShowSyntheticCreate.complete(_vm.selected_securities_observable(), secs => secs.Count > 0 && secs.Count <= 24, secs => new SecurityCriteria(secs)),
|
||||
SparkCommands.ShowSyntheticCreate.complete(_vm.sorted_selected_securities_observable(), secs => secs.Count > 0 && secs.Count <= 24, secs => new SecurityCriteria(secs)),
|
||||
SparkCommands.change_securities_command(() => (update_securities_cmd, _state.security_criteria)),
|
||||
// wrap the grid settings view factory in a dialogCommand here since the vm is destroyed/recreated when the security criteria changes
|
||||
SparkCommands.window_settings_command(new DialogCommand(() => {
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
UIntTemplate="{StaticResource SimpleValueTextTemplate}"
|
||||
MarketDataTypeTemplate="{StaticResource SimpleValueTextTemplate}"
|
||||
MarketDataCalculationTemplate="{StaticResource SimpleValueTextTemplate}"
|
||||
ConditionalPriceTypeTemplate="{StaticResource SimpleValueTextTemplate}"
|
||||
>
|
||||
<usp:DataGridParameterCellTemplateConverter.BooleanTemplate>
|
||||
<DataTemplate>
|
||||
@@ -122,6 +123,11 @@
|
||||
<ComboBox SelectedItem="{Binding value}" ItemsSource="{u:EnumBindingSource {u:Nested sp:LegSpreaderParams.Types.LegMarketDataCalculation}}" ItemTemplate="{StaticResource EnumDescriptionTemplate}"/>
|
||||
</DataTemplate>
|
||||
</usp:DataGridParameterCellTemplateConverter.MarketDataCalculationTemplate>
|
||||
<usp:DataGridParameterCellTemplateConverter.ConditionalPriceTypeTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox SelectedItem="{Binding value}" ItemsSource="{u:EnumBindingSource {u:Nested sp:ConditionalQuoting.Types.PriceType}}" ItemTemplate="{StaticResource EnumDescriptionTemplate}"/>
|
||||
</DataTemplate>
|
||||
</usp:DataGridParameterCellTemplateConverter.ConditionalPriceTypeTemplate>
|
||||
<usp:DataGridParameterCellTemplateConverter.QuantityMeasureTemplate>
|
||||
<DataTemplate>
|
||||
<Grid IsEnabled="{Binding enabled}">
|
||||
|
||||
@@ -304,6 +304,7 @@ namespace mbts.ui.spark {
|
||||
public DataTemplate QuantityMeasureTemplate { get; set; }
|
||||
public DataTemplate MarketDataTypeTemplate { get; set; }
|
||||
public DataTemplate MarketDataCalculationTemplate { get; set; }
|
||||
public DataTemplate ConditionalPriceTypeTemplate { get; set; }
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||
Type t = (Type)value;
|
||||
@@ -314,6 +315,7 @@ namespace mbts.ui.spark {
|
||||
else if (t == typeof(QuantityMeasure)) return QuantityMeasureTemplate;
|
||||
else if (t == typeof(LegSpreaderParams.Types.MarketDataType)) return MarketDataTypeTemplate;
|
||||
else if (t == typeof(LegSpreaderParams.Types.LegMarketDataCalculation)) return MarketDataCalculationTemplate;
|
||||
else if (t == typeof(ConditionalQuoting.Types.PriceType)) return ConditionalPriceTypeTemplate;
|
||||
else return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using mbts.ui;
|
||||
using mbts.ui.spark;
|
||||
using mbts.ui.utility;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Linq;
|
||||
@@ -43,8 +44,23 @@ namespace bts.shell {
|
||||
name + "(1)";
|
||||
}
|
||||
|
||||
async void _show_synthetic_create(SecurityCriteria security_criteria) =>
|
||||
_show_synthetic_create((await security_criteria.securities(_bus)).ToList());
|
||||
async void _show_synthetic_create(SecurityCriteria security_criteria) {
|
||||
var found_securities = await security_criteria.securities(_bus);
|
||||
var respect_clause_security_ordering_is_possible = security_criteria.clauses.Any(clause => clause.security_keys != null && clause.security_keys.Count > 0);
|
||||
if (!respect_clause_security_ordering_is_possible) {
|
||||
_show_synthetic_create(found_securities.Values.ToList());
|
||||
} else {
|
||||
List<SecurityImmutable> ordered_security_list = new List<SecurityImmutable>();
|
||||
foreach (var clause in security_criteria.clauses) {
|
||||
foreach (var sec_key in clause.security_keys) {
|
||||
if (found_securities.TryGetValue(sec_key, out SecurityImmutable found_result)) {
|
||||
ordered_security_list.Add(found_result);
|
||||
}
|
||||
}
|
||||
_show_synthetic_create(ordered_security_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _show_synthetic_create(IReadOnlyCollection<SecurityImmutable> securities) {
|
||||
if (securities.Count == 1) {
|
||||
|
||||
@@ -103,6 +103,11 @@ namespace bts.shell {
|
||||
OutsideTicks = 3,
|
||||
Priority = RulePriority
|
||||
};
|
||||
public static ConditionalQuoting ConditionalQuoting => new ConditionalQuoting
|
||||
{
|
||||
NTicks = 2,
|
||||
PriceType = ConditionalQuoting.Types.PriceType.Leg
|
||||
};
|
||||
public static QuoteInsideMarketDistanceWithTravel QuoteInsideMarketDistanceWithTravel => new QuoteInsideMarketDistanceWithTravel { Priority = RulePriority };
|
||||
public static QuoteInsideMarketDistance QuoteInsideMarketDistance => new QuoteInsideMarketDistance { Priority = RulePriority };
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class SyntheticEditorVM {
|
||||
class EnableHedgeModel : RowModelBase<bool> {
|
||||
public override string display_name { get; } = "Enable Hedging";
|
||||
public override string help_text { get; } = "Send a hedge for this leg?";
|
||||
public override string man_page { get; } = string.Empty;
|
||||
|
||||
public override bool get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.EnableHedging;
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, bool value) =>
|
||||
leg_tup.leg_params.EnableHedging = value;
|
||||
|
||||
public override bool has_errors(IReadOnlyCollection<LegSpreaderParamsTuple> leg_tups) =>
|
||||
!leg_tups.Any(lt => lt.leg_params.EnableHedging);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using mbts.ui.spark;
|
||||
using System;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class SyntheticEditorVM {
|
||||
class MinLeanQtyModel : RowModelBase<System.UInt32> {
|
||||
public override string display_name { get; } = "Min Lean Qty";
|
||||
public override string help_text { get; } = "Minimum Quantity required at this leg to quote";
|
||||
public override string man_page { get; } = string.Empty;
|
||||
|
||||
public override System.UInt32 get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.MinLeanQty;
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, System.UInt32 value) =>
|
||||
leg_tup.leg_params.QuoteParams.MinLeanQty = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
using bts.shell;
|
||||
using mbts.ui.spark;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class SyntheticEditorVM {
|
||||
class ConditionalQuoteEnabledModel : RowModelBase<bool> {
|
||||
readonly ConditionalQuotingTicksModel _ticks;
|
||||
readonly ConditionalQuotingPriceTypeModel _price_type;
|
||||
|
||||
public ConditionalQuoteEnabledModel(ConditionalQuotingTicksModel ticks, ConditionalQuotingPriceTypeModel price_type)
|
||||
{
|
||||
_ticks = ticks;
|
||||
_price_type = price_type;
|
||||
}
|
||||
|
||||
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.Conditional };
|
||||
|
||||
public override bool get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.ConditionalQuoting != null;
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, bool value) {
|
||||
if (value) {
|
||||
if (leg_tup.leg_params.QuoteParams.ConditionalQuoting == null) {
|
||||
leg_tup.leg_params.QuoteParams.ConditionalQuoting = SyntheticDataHelper.Defaults.ConditionalQuoting;
|
||||
_ticks.apply_value(leg_tup);
|
||||
_price_type.apply_value(leg_tup);
|
||||
}
|
||||
} else {
|
||||
leg_tup.leg_params.QuoteParams.ConditionalQuoting = null;
|
||||
}
|
||||
_ticks.set_enabled(leg_tup, value);
|
||||
_price_type.set_enabled(leg_tup, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
using mbts.ui.spark;
|
||||
using bts.spark;
|
||||
using PriceType = bts.spark.ConditionalQuoting.Types.PriceType;
|
||||
using mbts.collections.extensions;
|
||||
using System.Collections.Generic;
|
||||
using bts.shell;
|
||||
|
||||
namespace mbts.spark
|
||||
{
|
||||
partial class SyntheticEditorVM
|
||||
{
|
||||
class ConditionalQuotingPriceTypeModel : RowModelBase<PriceType>
|
||||
{
|
||||
IDictionary<uint, PriceType> _value_store = new Dictionary<uint, PriceType>();
|
||||
|
||||
public override string display_name { get; } = "Price Type";
|
||||
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.Conditional };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_value(leg_tup).PriceType = _value_from_store(leg_tup);
|
||||
|
||||
public override PriceType get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_value(leg_tup) is ConditionalQuoting cond ?
|
||||
cond.PriceType :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, PriceType value)
|
||||
{
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
if (_get_value(leg_tup) is ConditionalQuoting cond)
|
||||
cond.PriceType = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) => _get_value(leg_tup) != null; //TAHA_SPREADER
|
||||
|
||||
ConditionalQuoting _get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.ConditionalQuoting;
|
||||
|
||||
PriceType _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.ConditionalQuoting.PriceType);
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
using bts.shell;
|
||||
using bts.spark;
|
||||
using mbts.collections.extensions;
|
||||
using mbts.ui.spark;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace mbts.spark {
|
||||
partial class SyntheticEditorVM {
|
||||
class ConditionalQuotingTicksModel : RowModelBase<int> {
|
||||
IDictionary<uint, int> _value_store = new Dictionary<uint, int>();
|
||||
|
||||
public override string display_name { get; } = "Ticks";
|
||||
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.Conditional };
|
||||
|
||||
public void apply_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_value(leg_tup).NTicks = _value_from_store(leg_tup);
|
||||
|
||||
public override int get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_value(leg_tup) is ConditionalQuoting cond ?
|
||||
cond.NTicks :
|
||||
_value_from_store(leg_tup);
|
||||
|
||||
public override void set_value(LegSpreaderParamsTuple leg_tup, int value) {
|
||||
_value_store[leg_tup.SecurityKey] = value;
|
||||
if (_get_value(leg_tup) is ConditionalQuoting cond)
|
||||
cond.NTicks = value;
|
||||
}
|
||||
|
||||
protected override bool _get_enabled(LegSpreaderParamsTuple leg_tup) =>
|
||||
_get_value(leg_tup) != null;
|
||||
|
||||
ConditionalQuoting _get_value(LegSpreaderParamsTuple leg_tup) =>
|
||||
leg_tup.leg_params.QuoteParams.ConditionalQuoting;
|
||||
|
||||
int _value_from_store(LegSpreaderParamsTuple leg_tup) =>
|
||||
_value_store.GetValueOrDefault(leg_tup.SecurityKey, _ => SyntheticDataHelper.Defaults.ConditionalQuoting.NTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,13 @@ namespace mbts.spark {
|
||||
"Reduces re-quoting updates by defining a region on either side " +
|
||||
"of the working quoting order, inside which quote updates will not be sent.");
|
||||
|
||||
public static ParameterSection Conditional =>
|
||||
new ParameterSection("Conditional", true,
|
||||
"Reduces re-quoting updates by only quoting if N ticks away from the opposite " +
|
||||
"inside market. Quotes are cancelled when it gets further away. 'Price Type' " +
|
||||
"dictates if this logic applies to the quoting market or to the synthetic spread " +
|
||||
"market");
|
||||
|
||||
public static ParameterSection InsideMarketThrottleThresholds =>
|
||||
new ParameterSection("Inside Market Throttle Thresholds", true,
|
||||
"Reduces re-quoting for quotes that are moving toward the inside market. " +
|
||||
|
||||
@@ -178,6 +178,9 @@ namespace mbts.spark {
|
||||
var quote_throttle_outside_ticks = new QuoteThrottleOutsideTicksModel();
|
||||
var quote_throttle_inside_ticks = new QuoteThrottleInsideTicksModel();
|
||||
|
||||
var conditional_quoting_ticks = new ConditionalQuotingTicksModel();
|
||||
var conditional_quoting_price_type = new ConditionalQuotingPriceTypeModel();
|
||||
|
||||
var quote_inside_market_throttle_ticks = new QuoteInsideMarketThrottleTicksModel();
|
||||
var quote_inside_market_throttle_min_move = new QuoteInsideMarketThrottleMinMoveModel();
|
||||
|
||||
@@ -199,13 +202,18 @@ namespace mbts.spark {
|
||||
_quantity_model,
|
||||
_price_mult_model,
|
||||
new IsQuoteModel(),
|
||||
//new EnableHedgeModel(), //TAHA_SPREADER
|
||||
new HedgeRatioModel(),
|
||||
//new MinLeanQtyModel(), //TAHA_SPREADER
|
||||
new QuoteHiddenModel(),
|
||||
new MarketDataTypeModel(),
|
||||
new MarketDataCalculationModel(),
|
||||
new QuoteThrottleEnabledModel(quote_throttle_inside_ticks, quote_throttle_outside_ticks),
|
||||
quote_throttle_inside_ticks,
|
||||
quote_throttle_outside_ticks,
|
||||
new ConditionalQuoteEnabledModel(conditional_quoting_ticks, conditional_quoting_price_type),
|
||||
conditional_quoting_ticks,
|
||||
conditional_quoting_price_type,
|
||||
//new QuoteInsideMarketThrottleEnabledModel(quote_inside_market_throttle_ticks, quote_inside_market_throttle_min_move),
|
||||
//quote_inside_market_throttle_ticks,
|
||||
//quote_inside_market_throttle_min_move,
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace mbts.spark {
|
||||
/// Warning: <see cref="_security_md_cache"/> must NOT be reassigned with <see cref="securities"/>; the latter is always the same object.
|
||||
/// This would mean that the <see cref="GlobalExtensions.difference{T}(IEnumerable{T}, IEnumerable{T}, out IEnumerable{T}, out IEnumerable{T})"/>
|
||||
/// call above would literally be calculating the difference between the keys of the same dictionary!
|
||||
foreach (var k in removed_keys) {
|
||||
foreach (var k in removed_keys.ToList()) {
|
||||
if (_security_orders.try_lookup(k, out ISet<uint> order_keys)) {
|
||||
SecurityMD old_sec_md = _security_md_cache[k];
|
||||
removed_securities.Add(k, old_sec_md);
|
||||
@@ -109,7 +109,7 @@ namespace mbts.spark {
|
||||
}
|
||||
_security_md_cache.Remove(k);
|
||||
}
|
||||
foreach (var k in added_keys) {
|
||||
foreach (var k in added_keys.ToList()) {
|
||||
SecurityMD new_sec_md = securities[k];
|
||||
if (_security_orders.try_lookup(k, out ISet<uint> order_keys)) {
|
||||
added_securities.Add(k, new_sec_md);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace mbts.spark
|
||||
cross_threshold = new InlineUserProperty<bts.spark.QuantityMeasure>(
|
||||
new bts.spark.QuantityMeasure() { Ratio = 1.0, Absolute = 1}, false);
|
||||
max_chase_ticks = new InlineUserProperty<uint>(2, false);
|
||||
trade_toward_behavior = new InlineUserProperty<LeanOrderDefinition.Types.OnToward>(LeanOrderDefinition.Types.OnToward.Cancel, false);
|
||||
trade_toward_behavior = new InlineUserProperty<LeanOrderDefinition.Types.OnToward>(LeanOrderDefinition.Types.OnToward.NoChange, false);
|
||||
}
|
||||
public readonly InlineUserProperty<OrderTemplateHeader> selected_child_order_type;
|
||||
public readonly InlineUserProperty<IReadOnlyCollection<OrderTemplateHeader>> child_order_types;
|
||||
@@ -47,7 +47,7 @@ namespace mbts.spark
|
||||
|
||||
public bts.spark.QuantityMeasure cross_threshold { get; set; } = new bts.spark.QuantityMeasure() { Ratio = 1.0, Absolute = 1 };
|
||||
public uint max_chase_ticks { get; set; } = 2;
|
||||
public LeanOrderDefinition.Types.OnToward trade_toward_behavior { get; set; } = LeanOrderDefinition.Types.OnToward.Cancel;
|
||||
public LeanOrderDefinition.Types.OnToward trade_toward_behavior { get; set; } = LeanOrderDefinition.Types.OnToward.NoChange;
|
||||
|
||||
public LeanOrderVM(OrdersModel model, IObservable<SecurityMD> security_md_source, string id, string display_name)
|
||||
: this(model, security_md_source, security_md_source.Select(smd =>
|
||||
|
||||
@@ -82,9 +82,4 @@
|
||||
</ItemGroup>
|
||||
<Target Name="diagnostic" AfterTargets="PreBuildEvent">
|
||||
</Target>
|
||||
<Target Name="copy_defaults" AfterTargets="PostBuildEvent">
|
||||
<!-- this feels like the wrong place to copy defaults but it works alright -->
|
||||
<!-- <Message Importance="High" Text="copy defaults :: @(ConfigDefaults)" /> -->
|
||||
<Copy SourceFiles="@(ConfigDefaults)" DestinationFolder="$(OutputPath)\defaults\" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -223,7 +223,7 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="4" />
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="4" />
|
||||
<RowDefinition Height="4" />
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -231,13 +231,37 @@
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Center">Cross Thresh</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="1"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center">Cross Thresh</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="When the size of the opposite-inside market falls below this size threshold the order will payup." />
|
||||
</StackPanel>
|
||||
<uag:QuantityMeasureControl Grid.Row="1" Grid.Column="2" QuantityMeasure="{Binding cross_threshold}"/>
|
||||
<TextBlock Grid.Row="3" VerticalAlignment="Center">Max Chase Ticks</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="3"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center">Max Chase Ticks</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="The max number of ticks the order will continue to pay up after the initial payup." />
|
||||
</StackPanel>
|
||||
<c:TickUpDownUInt Grid.Row="3" Grid.Column="2" Value="{Binding max_chase_ticks}"/>
|
||||
<TextBlock Grid.Row="5">On Toward</TextBlock>
|
||||
<ComboBox Grid.Row="5" Grid.Column="2" ItemsSource="{Binding trade_toward_types}" ItemTemplate="{StaticResource EnumDescriptionTemplate}" SelectedItem="{Binding trade_toward_behavior}"/>
|
||||
<TextBlock Grid.Row="7">Child</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="5"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center">On Toward</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="What should happen when the market moves toward the order." />
|
||||
</StackPanel>
|
||||
<ComboBox Grid.Row="5" Grid.Column="2" ItemsSource="{Binding trade_toward_types}" ItemTemplate="{StaticResource EnumDescriptionTemplate}" SelectedItem="{Binding trade_toward_behavior}"/>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="7"
|
||||
>
|
||||
<TextBlock >Child</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="This is the type of order to be placed when the algo is triggered" />
|
||||
</StackPanel>
|
||||
<uag:OrderDetailsPopupControl
|
||||
Grid.Row="7" Grid.Column="2"
|
||||
IsOpen="{Binding child_order.editable_properties_open, FallbackValue=False}"
|
||||
@@ -266,9 +290,21 @@
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Center">Join Thresh</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="1"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center">Join Thresh</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="The Threshold at which the order will join the market when the market flips (the event where the best offer becomes the best bid in the buy case)." />
|
||||
</StackPanel>
|
||||
<uag:QuantityMeasureControl Grid.Row="1" Grid.Column="2" QuantityMeasure="{Binding join_threshold}"/>
|
||||
<TextBlock Grid.Row="3">Child</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="3"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center">Child</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="This is the type of order to be placed when the algo is triggered" />
|
||||
</StackPanel>
|
||||
<uag:OrderDetailsPopupControl
|
||||
Grid.Row="3" Grid.Column="2"
|
||||
IsOpen="{Binding child_order.editable_properties_open, FallbackValue=False}"
|
||||
@@ -295,9 +331,22 @@
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Center">Top Thresh</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="1"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center">Top Thresh</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="If the order is at the top of book, the quantity remaining below which the order will be canceled." />
|
||||
</StackPanel>
|
||||
<uag:QuantityMeasureControl Grid.Row="1" Grid.Column="2" QuantityMeasure="{Binding top_threshold}"/>
|
||||
<TextBlock Grid.Row="3">Child</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="3"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center">Child</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="This is the type of order to be placed when the algo is triggered." />
|
||||
</StackPanel>
|
||||
|
||||
<uag:OrderDetailsPopupControl
|
||||
Grid.Row="3" Grid.Column="2"
|
||||
IsOpen="{Binding child_order.editable_properties_open, FallbackValue=False}"
|
||||
@@ -326,9 +375,21 @@
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Center" >Hedge Ticks</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="1"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center" >Hedge Ticks</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="This is the number of ticks to offset the hedge." />
|
||||
</StackPanel>
|
||||
<c:TickUpDownInt Grid.Row="1" Grid.Column="2" Value="{Binding hedge_ticks}"/>
|
||||
<TextBlock Grid.Row="3">Hedge</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="3"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center">Hedge</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="This is the type of the hedge order to send for each fill of Child Order." />
|
||||
</StackPanel>
|
||||
<uag:OrderDetailsPopupControl
|
||||
Grid.Row="3" Grid.Column="2"
|
||||
IsOpen="{Binding hedge_order.editable_properties_open, FallbackValue=False}"
|
||||
@@ -336,7 +397,14 @@
|
||||
SelectedItem="{Binding hedge_order}"
|
||||
HasEditableProperties="{Binding hedge_order.has_editable_properties, FallbackValue=False}"
|
||||
/>
|
||||
<TextBlock Grid.Row="5">Child</TextBlock>
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="5"
|
||||
>
|
||||
<TextBlock VerticalAlignment="Center">Child</TextBlock>
|
||||
<c:HelpButton Margin="4,0,0,0" ToolTip="This is the type of order to be placed when the algo is triggered." />
|
||||
</StackPanel>
|
||||
|
||||
<uag:OrderDetailsPopupControl
|
||||
Grid.Row="5" Grid.Column="2"
|
||||
IsOpen="{Binding child_order.editable_properties_open, FallbackValue=False}"
|
||||
@@ -377,7 +445,7 @@
|
||||
/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:OrderModificationTemplateSelector.OffsetOrderTemplate>
|
||||
</usp:OrderModificationTemplateSelector.OffsetOrderTemplate>
|
||||
<usp:OrderModificationTemplateSelector.TriggerOrderTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Grid.IsSharedSizeScope="True">
|
||||
@@ -458,7 +526,7 @@
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock FontWeight="SemiBold" Margin="0,0,4,0">Price</TextBlock>
|
||||
<c:HelpButton ToolTip="The child order, resulting from the trigger condition being met, can be sent either at a specified price specified price (Fixed) price or payup/less ticks from the Trigger Price" />
|
||||
<c:HelpButton ToolTip="The child order, resulting from the trigger condition being met, can be sent either at a specified price (Fixed) price or payup/less ticks from the Trigger Price" />
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
<Grid>
|
||||
@@ -634,8 +702,8 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding descriptor.ParamName}"/>
|
||||
<CheckBox HorizontalAlignment="Stretch" Grid.Column="2" IsChecked="{Binding param.AsBool, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.BoolTemplate>
|
||||
<usp:DynamicOrderParamTemplateSelector.DoubleTemplate>
|
||||
<DataTemplate>
|
||||
@@ -647,9 +715,9 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding descriptor.ParamName}"/>
|
||||
<c:TickUpDownDouble Grid.Column="2" Value="{Binding param.AsDouble, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.DoubleTemplate>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.DoubleTemplate>
|
||||
<usp:DynamicOrderParamTemplateSelector.IntTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
@@ -660,9 +728,9 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding descriptor.ParamName}"/>
|
||||
<c:TickUpDownInt Grid.Column="2" Value="{Binding param.AsInt32, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.IntTemplate>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.IntTemplate>
|
||||
<usp:DynamicOrderParamTemplateSelector.UIntTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
@@ -673,9 +741,9 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding descriptor.ParamName}"/>
|
||||
<c:TickUpDownUInt Grid.Column="2" Value="{Binding param.AsUint32, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.UIntTemplate>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.UIntTemplate>
|
||||
<usp:DynamicOrderParamTemplateSelector.StringTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
@@ -686,9 +754,9 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding descriptor.ParamName}"/>
|
||||
<TextBox HorizontalAlignment="Stretch" Grid.Column="2" Text="{Binding param.AsString, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.StringTemplate>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.StringTemplate>
|
||||
<usp:DynamicOrderParamTemplateSelector.EnumTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
@@ -699,11 +767,11 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding descriptor.ParamName}"/>
|
||||
<ComboBox Grid.Column="2" ItemsSource="{Binding descriptor.ParamType.Enumerated.Element}" SelectedItem="{Binding param.AsEnumerated.EnumValue}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.EnumTemplate>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector.EnumTemplate>
|
||||
</usp:DynamicOrderParamTemplateSelector>
|
||||
</ItemsControl.ItemTemplateSelector>
|
||||
</ItemsControl.ItemTemplateSelector>
|
||||
</ItemsControl>
|
||||
<TextBlock Grid.Row="3">Child</TextBlock>
|
||||
<uag:OrderDetailsPopupControl
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using bts;
|
||||
using mbts.spark.filters;
|
||||
using mbts.ui.controls.adorners;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
||||
namespace mbts.ui.controls {
|
||||
public class UniformTabGrid : UniformGrid {
|
||||
public UniformTabGrid () {
|
||||
this.IsItemsHost = true;
|
||||
this.Rows = 1;
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size constraint) {
|
||||
var child_tabs = this.Children.OfType<TabItem>();
|
||||
var child_tabs_max_width = child_tabs.Sum(t => t.MaxWidth);
|
||||
// I noticed when debugging that this can sometimes be infinty,
|
||||
// especially when a TabItem has not been set with a MaxWidth.
|
||||
if (!double.IsInfinity(child_tabs_max_width)) {
|
||||
// if the window width is greater than the total tab width, then
|
||||
// there is more than enough space for all the tabs. If this
|
||||
// is set to the default of Stretch and the window has only 1
|
||||
// tab or few tabs, the tab appears in the middle, which is not good.
|
||||
// i.e. we want tabs to added left to right, so align left
|
||||
//
|
||||
// When the window is less than the total tab width, then align
|
||||
// can be set to stretch b/c the UniformGrid will take care of
|
||||
// sizing each tab accordingly.
|
||||
this.HorizontalAlignment = (constraint.Width > child_tabs_max_width)
|
||||
? HorizontalAlignment.Left
|
||||
: HorizontalAlignment.Stretch;
|
||||
|
||||
// this bit here is necessary because when the window is expanded
|
||||
// beyond the maxwidth of all the tabs, we switch to Left and the
|
||||
// headers snap to some smaller than MaxWidth size, which is not
|
||||
// the behavior we want
|
||||
foreach (var child in child_tabs) {
|
||||
child.Width = this.HorizontalAlignment == HorizontalAlignment.Left
|
||||
? child.MaxWidth
|
||||
: double.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
return base.MeasureOverride(constraint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
|
||||
xmlns:ui="clr-namespace:mbts.ui"
|
||||
xmlns:c="clr-namespace:mbts.ui.controls"
|
||||
mc:Ignorable="d" AllowDrop="True"
|
||||
Style="{StaticResource BTSFloatingWindow}"
|
||||
d:DesignHeight="300" d:DesignWidth="300"
|
||||
@@ -25,18 +26,25 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<WrapPanel x:Name="HeaderPanel" Orientation="Horizontal" Margin="0,0,100,0"
|
||||
<!-- This stack panel serves as the area between the last tab and the widget control on right side of title bar (below).
|
||||
It allows the region in between (if such a region exists) to be grabbed to move the window.
|
||||
-->
|
||||
<StackPanel Grid.Row="0" Margin="0,0,100,0" Background="Transparent" ui:WindowStyle.IsNonClientArea="True">
|
||||
<c:UniformTabGrid x:Name="HeaderPanel"
|
||||
Grid.Row="0"
|
||||
Panel.ZIndex="1"
|
||||
IsItemsHost="True"
|
||||
KeyboardNavigation.TabIndex="1"
|
||||
Background="Transparent" ui:WindowStyle.IsNonClientArea="True">
|
||||
</WrapPanel>
|
||||
Background="Transparent"
|
||||
ui:WindowStyle.IsNonClientArea="True"
|
||||
>
|
||||
</c:UniformTabGrid>
|
||||
</StackPanel>
|
||||
<Border Grid.Row="1" BorderThickness="0"
|
||||
Padding="{Binding Path=Padding, RelativeSource={RelativeSource AncestorType=Window}}" ui:WindowStyle.IsNonClientArea="False" >
|
||||
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" />
|
||||
</Border>
|
||||
<Border Grid.Row="0" Width="100" HorizontalAlignment="Right" VerticalAlignment="Stretch" Panel.ZIndex="2" Background="Transparent" ui:WindowStyle.IsNonClientArea="True">
|
||||
<!-- Window widget control area-->
|
||||
<Border Grid.Row="0" MinWidth="100" HorizontalAlignment="Right" Panel.ZIndex="2" Background="Transparent" ui:WindowStyle.IsNonClientArea="True">
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Panel.ZIndex="2" Background="Transparent" Margin="5">
|
||||
<Button Style="{StaticResource RoundMinimizeButton}" HorizontalAlignment="Right" Command="{x:Static SystemCommands.MinimizeWindowCommand}" />
|
||||
<Button Style="{StaticResource RoundMaximizeButton}" HorizontalAlignment="Right" Command="{x:Static SystemCommands.MaximizeWindowCommand}" />
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</TabItem.RenderTransform>
|
||||
<TabItem.Template>
|
||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||
<Border x:Name="bd" BorderBrush="Black" BorderThickness="0,0,0.5,0" Background="#d6d6d6" Width="{DynamicResource TabWidth}" Height="{DynamicResource TabHeight}" MinWidth="40" Margin="0" SnapsToDevicePixels="True" DockPanel.Dock="Left">
|
||||
<Border x:Name="bd" BorderBrush="Black" BorderThickness="0,0,0.5,0" Background="#d6d6d6" Height="{DynamicResource TabHeight}" MinWidth="40" Margin="0" SnapsToDevicePixels="True" DockPanel.Dock="Left">
|
||||
<Border.ToolTip>
|
||||
<TextBlock Text="{Binding Title}" />
|
||||
</Border.ToolTip>
|
||||
@@ -90,6 +90,7 @@
|
||||
</TabItem.Template>
|
||||
<TabItem.Style>
|
||||
<Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}">
|
||||
<Setter Property="MaxWidth" Value="{DynamicResource TabWidth}" />
|
||||
<Setter Property="HeaderTemplate" Value="{StaticResource _template}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding EditMode}" Value="True">
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace mbts.spark {
|
||||
return self == null ? all.Values : all.Values.Where(md => ContractPickerModel.security_in_criteria(self, md.security));
|
||||
}
|
||||
|
||||
public static async Task<IEnumerable<SecurityImmutable>> securities(this SecurityCriteria self, IBus bus) {
|
||||
public static async Task<IDictionary<uint,SecurityImmutable>> securities(this SecurityCriteria self, IBus bus) {
|
||||
var md_map = await bus.subscribe(SparkTags.SecuritiesTag).FirstAsync();
|
||||
var all_secs = md_map.Values.Select(md => md.security);
|
||||
return self == null ? all_secs : all_secs.Where(s => ContractPickerModel.security_in_criteria(self, s));
|
||||
var all_secs = md_map.Values.Select(md => md.security).ToDictionary(key => key.Id);
|
||||
return self == null ? all_secs : all_secs.Values.Where(s => ContractPickerModel.security_in_criteria(self, s)).ToDictionary(key => key.Id);
|
||||
}
|
||||
|
||||
public static IObservable<IEnumerable<SecurityImmutable>> subscribe(this SecurityCriteria self, IBus bus) {
|
||||
|
||||
@@ -122,6 +122,21 @@ namespace mbts.spark
|
||||
where TRow : class, ISecurityRow =>
|
||||
security_grid.selected_securities.ObserveSelf();
|
||||
|
||||
public static IObservable<IReadOnlyList<SecurityImmutable>> sorted_selected_securities_observable<TRow, TRowModel>(this SecurityGridBase<TRow, TRowModel> security_grid)
|
||||
where TRow : class, ISecurityRow =>
|
||||
security_grid.selected_rows
|
||||
.ObserveSelf()
|
||||
.Select(rows =>
|
||||
rows.Select(
|
||||
row => (security: row.security, row_index: security_grid.rows_view.indexOf(row))
|
||||
)
|
||||
.OrderBy(sec_vs_index => sec_vs_index.row_index)
|
||||
.Select(sec_vs_index => sec_vs_index.security)
|
||||
.ToReadOnlyList()
|
||||
);
|
||||
|
||||
|
||||
|
||||
public static IObservable<IReadOnlyList<SecurityMD>> selected_security_mds_observable<TRow, TRowModel>(this SecurityMDGrid<TRow, TRowModel> security_md_grid)
|
||||
where TRow : class, ISecurityMDRow =>
|
||||
security_md_grid.selected_rows.ObserveSelf(true).Select(rows => rows.Select(r => r.md).ToReadOnlyList());
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using bts.api;
|
||||
using bts.api.core;
|
||||
|
||||
namespace bts.api
|
||||
{
|
||||
public class Authenticator
|
||||
{
|
||||
readonly static Lazy<user.UserService> _auth = new Lazy<user.UserService>(() => Locator.locate<user.UserService>(), true);
|
||||
user.AuthToken _token = null;
|
||||
public Authenticator() { }
|
||||
|
||||
public user.AuthToken last_token => _token;
|
||||
public async Task<user.AuthToken> login(string login, string password)
|
||||
{
|
||||
var res = await _auth.Value.authenticate_login_async(new user.AuthenticateLoginRequest { Login = login, Password = password });
|
||||
if (res.success)
|
||||
_token = res.value.Token;
|
||||
return _token;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bts
|
||||
{
|
||||
public class AsyncLazy<T> : Lazy<Task<T>>
|
||||
{
|
||||
public AsyncLazy(Func<T> valueFactory) :
|
||||
base(() => Task.Factory.StartNew(valueFactory))
|
||||
{ }
|
||||
|
||||
public AsyncLazy(Func<Task<T>> taskFactory) :
|
||||
base(() => Task.Factory.StartNew(() => taskFactory()).Unwrap())
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using bts.api;
|
||||
using bts.api.core;
|
||||
|
||||
namespace bts.api
|
||||
{
|
||||
public static class Locator
|
||||
{
|
||||
readonly static Lazy<ServiceContext> _context = new Lazy<ServiceContext>(() => new ServiceContext(), true);
|
||||
public static T locate<T>(string qualifier="") where T : class, IApiClient
|
||||
{
|
||||
return _context.Value.locate<T>(qualifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,49 +33,48 @@ namespace bts.api.md
|
||||
readonly ConcurrentDictionary<security_key, Data> _data = new ConcurrentDictionary<security_key, Data>();
|
||||
readonly ConcurrentDictionary<security_key, string> _security_key_to_desc= new ConcurrentDictionary<security_key, string>();
|
||||
readonly ConcurrentDictionary<string, security_key> _security_desc_to_key = new ConcurrentDictionary<string, security_key>();
|
||||
readonly Lazy<MDRequest> _subscription;
|
||||
readonly MDRequest _subscription;
|
||||
readonly Venue _venue;
|
||||
|
||||
readonly static Lazy<MarketDataRelay> _md = new Lazy<MarketDataRelay>(() => locate(), true);
|
||||
readonly static Lazy<MarketDataRelay> _md = new Lazy<MarketDataRelay>(() => Locator.locate<MarketDataRelay>(), true);
|
||||
readonly static ConcurrentDictionary<api.Venue, MarketDataClient> _venue_cache = new ConcurrentDictionary<api.Venue, api.md.MarketDataClient>();
|
||||
static readonly List<Product> _all_products;
|
||||
static MarketDataClient()
|
||||
{
|
||||
_all_products = _md.Value.request_products(new VoidMessage()).Products.ToList();
|
||||
}
|
||||
public static bool create_or_get(api.Venue exchange, out MarketDataClient md)
|
||||
|
||||
public static IEnumerable<api.Venue> cached_exchanges => _venue_cache.Keys;
|
||||
public static bool create_or_get(api.Venue exchange, out MarketDataClient md, user.AuthToken token = null)
|
||||
{
|
||||
if (!_venue_cache.TryGetValue(exchange, out md))
|
||||
{
|
||||
_venue_cache[exchange] = md = new MarketDataClient(exchange);
|
||||
_venue_cache[exchange] = md = new MarketDataClient(exchange, token);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public MarketDataClient(bts.api.Venue exchange = Venue.Unset)
|
||||
public MarketDataClient(bts.api.Venue exchange = Venue.Unset, user.AuthToken token = null)
|
||||
{
|
||||
_venue = exchange;
|
||||
_subscription = new Lazy<MDRequest>(() => load_request(exchange));
|
||||
_subscription = load_request(exchange, token);
|
||||
}
|
||||
|
||||
MDRequest load_request(bts.api.Venue exchange)
|
||||
public void set_auth_token(user.AuthToken toke)
|
||||
{
|
||||
var req = new MDRequest();
|
||||
_subscription.Token = toke?.Token ?? string.Empty;
|
||||
}
|
||||
|
||||
MDRequest load_request(bts.api.Venue exchange, user.AuthToken token)
|
||||
{
|
||||
var req = new MDRequest() { Token = token?.Token ?? string.Empty } ;
|
||||
var prods = _all_products.Where(x=>x.Exchange == exchange || exchange == bts.api.Venue.Unset);
|
||||
foreach(var prod in prods)
|
||||
req.Channels.Add(new SecurityChannel() { Exchange = prod.Exchange, Type = prod.Type, Symbol = prod.Symbol, Flags = 0 });
|
||||
return req;
|
||||
}
|
||||
|
||||
static MarketDataRelay locate()
|
||||
{
|
||||
using (var ctx = new api.core.ServiceContext())
|
||||
{
|
||||
return ctx.locate<MarketDataRelay>();
|
||||
}
|
||||
}
|
||||
|
||||
public Security lookup(security_key key)
|
||||
{
|
||||
Data value;
|
||||
@@ -217,7 +216,7 @@ namespace bts.api.md
|
||||
|
||||
bool check_subscriptions(uint flags, Func<SecurityChannel, bool> selector)
|
||||
{
|
||||
foreach (var sub in _subscription.Value.Channels)
|
||||
foreach (var sub in _subscription.Channels)
|
||||
{
|
||||
if (selector(sub))
|
||||
{
|
||||
@@ -251,7 +250,7 @@ namespace bts.api.md
|
||||
while (!rep.success && count++ < 5);
|
||||
while (true)
|
||||
{
|
||||
var reply = await _md.Value.requestmd_async(_subscription.Value);
|
||||
var reply = await _md.Value.requestmd_async(_subscription);
|
||||
if (reply.success)
|
||||
{
|
||||
foreach (var channel in reply.value.Channels)
|
||||
|
||||
@@ -32,12 +32,14 @@ namespace bts {
|
||||
Testing,
|
||||
Latency,
|
||||
DataFlow,
|
||||
Plugin
|
||||
Plugin,
|
||||
ClientSdk
|
||||
// Please keep this list in sync with logging.h/logging.cpp
|
||||
}
|
||||
readonly struct Logger {
|
||||
|
||||
public readonly struct Logger {
|
||||
readonly Subsystem _sys;
|
||||
public Logger(Subsystem sys) {
|
||||
internal Logger(Subsystem sys) {
|
||||
_sys = sys;
|
||||
}
|
||||
|
||||
@@ -61,19 +63,20 @@ namespace bts {
|
||||
static extern void Logger_log (Level level, Subsystem subsystem, string message, string file, int line);
|
||||
}
|
||||
|
||||
static class Log {
|
||||
public static Logger Gen => new Logger(Subsystem.gen);
|
||||
public static Logger Config => new Logger(Subsystem.Config);
|
||||
public static Logger QBus => new Logger(Subsystem.QBus);
|
||||
public static Logger Md => new Logger(Subsystem.md);
|
||||
public static Logger Api => new Logger(Subsystem.Api);
|
||||
public static Logger Persist => new Logger(Subsystem.Persist);
|
||||
public static Logger User => new Logger(Subsystem.User);
|
||||
public static Logger OrderMan => new Logger(Subsystem.OrderMan);
|
||||
public static Logger Assert => new Logger(Subsystem.Assert);
|
||||
public static Logger Ui => new Logger(Subsystem.Ui);
|
||||
public static Logger Testing => new Logger(Subsystem.Testing);
|
||||
public static Logger DataFlow => new Logger(Subsystem.DataFlow);
|
||||
public static class Log {
|
||||
internal static Logger Gen => new Logger(Subsystem.gen);
|
||||
internal static Logger Config => new Logger(Subsystem.Config);
|
||||
internal static Logger QBus => new Logger(Subsystem.QBus);
|
||||
internal static Logger Md => new Logger(Subsystem.md);
|
||||
internal static Logger Api => new Logger(Subsystem.Api);
|
||||
internal static Logger Persist => new Logger(Subsystem.Persist);
|
||||
internal static Logger User => new Logger(Subsystem.User);
|
||||
internal static Logger OrderMan => new Logger(Subsystem.OrderMan);
|
||||
internal static Logger Assert => new Logger(Subsystem.Assert);
|
||||
internal static Logger Ui => new Logger(Subsystem.Ui);
|
||||
internal static Logger Testing => new Logger(Subsystem.Testing);
|
||||
internal static Logger DataFlow => new Logger(Subsystem.DataFlow);
|
||||
public static Logger ClientSdk => new Logger(Subsystem.ClientSdk);
|
||||
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
@@ -99,10 +102,10 @@ namespace bts {
|
||||
assert(o == null);
|
||||
}
|
||||
delegate void on_crash_callback([MarshalAs(UnmanagedType.LPStr)]string msg, [MarshalAs(UnmanagedType.LPStr)] string details);
|
||||
public static void system_is_crashing(string message, object details) {
|
||||
internal static void system_is_crashing(string message, object details) {
|
||||
OnSystemCrashing?.Invoke(message, details);
|
||||
}
|
||||
public static event Action<string, object> OnSystemCrashing;
|
||||
internal static event Action<string, object> OnSystemCrashing;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,5 +69,21 @@ namespace bts.excel
|
||||
Utilities.bts_load_assembly(ass);
|
||||
}
|
||||
}
|
||||
|
||||
public static void calculate_full_rebuild()
|
||||
{
|
||||
object app = ExcelDnaUtil.Application;
|
||||
var mi = app?.GetType().GetMethod("CalculateFullRebuild", BindingFlags.Instance | BindingFlags.Public);
|
||||
if(mi != null)
|
||||
mi.Invoke(app, null);
|
||||
}
|
||||
|
||||
public static void calculate_full()
|
||||
{
|
||||
object app = ExcelDnaUtil.Application;
|
||||
var mi = app?.GetType().GetMethod("CalculateFull", BindingFlags.Instance | BindingFlags.Public);
|
||||
if (mi != null)
|
||||
mi.Invoke(app, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@
|
||||
<!--
|
||||
Enable/Disable packing of .dna files
|
||||
-->
|
||||
<RunExcelDnaPack Condition="'$(RunExcelDnaPack)' == ''">false</RunExcelDnaPack>
|
||||
<RunExcelDnaPack Condition="'$(RunExcelDnaPack)' == ''">true</RunExcelDnaPack>
|
||||
|
||||
<!--
|
||||
Suffix used for packed .xll files e.g. MyAddIn-packed.xll
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ExcelDna.Integration;
|
||||
using ExcelDna.Integration.Rtd;
|
||||
using ExcelDna.Registration.Utils;
|
||||
|
||||
using bts.api.admin;
|
||||
using bts.excel;
|
||||
@@ -14,9 +17,30 @@ namespace bts.api.orderman
|
||||
{
|
||||
public partial class OrderService_Excel
|
||||
{
|
||||
readonly static Lazy<user.UserService> _users = new Lazy<user.UserService>(() => locate<user.UserService>(), true);
|
||||
readonly static Lazy<admin.AdminService> _admin = new Lazy<admin.AdminService>(() => locate<admin.AdminService>(), true);
|
||||
|
||||
readonly static Lazy<user.UserService> _users = new Lazy<user.UserService>(() => Locator.locate<user.UserService>(), true);
|
||||
readonly static Lazy<admin.AdminService> _admin = new Lazy<admin.AdminService>(() => Locator.locate<admin.AdminService>(), true);
|
||||
|
||||
[ExcelFunction(Category = "BTS", Description = "Get All Accessible Accounts")]
|
||||
async public static void spark_get_accounts(string login_token, ExcelAsyncHandle handle)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> accts = new List<string>();
|
||||
var admin = await _admin.Value.get_filtered_admin_data_async(new FilteredAdminDataRequest { Token = login_token });
|
||||
if (admin.success)
|
||||
{
|
||||
foreach (var acc in admin.value.Accounts)
|
||||
if(acc.IsPresent)
|
||||
accts.Add(acc.Name);
|
||||
}
|
||||
var res = Utilities.make_column_vector(accts.ToArray());
|
||||
handle.SetResult(res);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
handle.SetException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[ExcelFunction(Category = "BTS", Description = "Cancel an Order by Order ID", IsMacroType = true)]
|
||||
public static object spark_orderservice_cancel_order(long order_id)
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Reactive.Linq;
|
||||
using Google.Protobuf;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using ExcelDna.Integration;
|
||||
|
||||
namespace bts.excel.rtd
|
||||
{
|
||||
@@ -17,7 +18,7 @@ namespace bts.excel.rtd
|
||||
_data = data;
|
||||
}
|
||||
|
||||
#region parser
|
||||
#region parser
|
||||
static IDictionary<string, object> parse_dictionary(object[,] range)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
+2
-2
@@ -3,10 +3,10 @@ using System;
|
||||
|
||||
namespace bts.excel.rtd
|
||||
{
|
||||
class TopMDFormatter : IExcelFormatter
|
||||
class TopOfBookMDFormatter : IExcelFormatter
|
||||
{
|
||||
readonly co2.ChannelUpdate _update;
|
||||
public TopMDFormatter(co2.ChannelUpdate upd)
|
||||
public TopOfBookMDFormatter(co2.ChannelUpdate upd)
|
||||
{
|
||||
_update = upd;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
|
||||
using System;
|
||||
|
||||
namespace bts.excel.rtd
|
||||
{
|
||||
class TopicMDFormatter : IExcelFormatter
|
||||
{
|
||||
readonly co2.ChannelUpdate _update;
|
||||
readonly string _topic;
|
||||
public TopicMDFormatter(co2.ChannelUpdate upd, string topic)
|
||||
{
|
||||
_update = upd;
|
||||
_topic = topic;
|
||||
}
|
||||
|
||||
public object[,] format(bool include_headers = false)
|
||||
{
|
||||
var retval = new object[1, 1];
|
||||
switch (_topic.ToLower())
|
||||
{
|
||||
case "bid":
|
||||
case "bidprice":
|
||||
retval[0, 0] = BookMDFormatter.format_md(_update?.Direct?.Bids?[0]?.Mantissa ?? 0, _update?.Direct?.Bids?[0]?.Exponent ?? 0);
|
||||
break;
|
||||
case "ask":
|
||||
case "askprice":
|
||||
retval[0, 0] = BookMDFormatter.format_md(_update?.Direct?.Asks?[0]?.Mantissa ?? 0, _update?.Direct?.Asks?[0]?.Exponent ?? 0);
|
||||
break;
|
||||
case "bidsize":
|
||||
case "bidqty":
|
||||
retval[0, 0] = _update?.Direct?.Bids?[0]?.Size;
|
||||
break;
|
||||
case "asksize":
|
||||
case "askqty":
|
||||
retval[0, 0] = _update?.Direct?.Asks?[0]?.Size;
|
||||
break;
|
||||
case "impliedbid":
|
||||
case "impliedbidprice":
|
||||
retval[0, 0] = BookMDFormatter.format_md(_update?.Implied?.Bids?[0]?.Mantissa ?? 0, _update?.Implied?.Bids?[0]?.Exponent ?? 0);
|
||||
break;
|
||||
case "impliedask":
|
||||
case "impliedaskprice":
|
||||
retval[0, 0] = BookMDFormatter.format_md(_update?.Implied?.Asks?[0]?.Mantissa ?? 0, _update?.Implied?.Asks?[0]?.Exponent ?? 0);
|
||||
break;
|
||||
case "impliedbidsize":
|
||||
case "impliedbidqty":
|
||||
retval[0, 0] = _update?.Implied?.Bids?[0]?.Size;
|
||||
break;
|
||||
case "impliedasksize":
|
||||
case "impliedaskqty":
|
||||
retval[0, 0] = _update?.Implied?.Asks?[0]?.Size;
|
||||
break;
|
||||
case "settlement":
|
||||
case "settlementprice":
|
||||
retval[0, 0] = BookMDFormatter.format_md(_update?.Misc?.Settlement?.Mantissa ?? 0, _update?.Misc?.Settlement?.Exponent ?? 0);
|
||||
break;
|
||||
case "previoussettlement":
|
||||
case "previoussettlementprice":
|
||||
retval[0, 0] = BookMDFormatter.format_md(_update?.Misc?.PreviousSettlementPrice?.Mantissa ?? 0, _update?.Misc?.PreviousSettlementPrice?.Exponent ?? 0);
|
||||
break;
|
||||
case "open":
|
||||
case "openprice":
|
||||
retval[0, 0] = _update?.Misc?.OpenPrice;
|
||||
break;
|
||||
case "close":
|
||||
case "closeprice":
|
||||
retval[0, 0] = _update?.Misc?.ClosePrice;
|
||||
break;
|
||||
case "high":
|
||||
case "highprice":
|
||||
retval[0, 0] = _update?.Misc?.SessionHigh;
|
||||
break;
|
||||
case "low":
|
||||
case "lowprice":
|
||||
retval[0, 0] = _update?.Misc?.SessionLow;
|
||||
break;
|
||||
case "last":
|
||||
case "lastprice":
|
||||
retval[0, 0] = BookMDFormatter.format_md(_update?.LastTrade?.Mantissa ?? 0, _update?.LastTrade?.Exponent ?? 0);
|
||||
break;
|
||||
case "lastsize":
|
||||
case "lastqty":
|
||||
retval[0, 0] = _update?.LastTrade?.Size;
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,16 +4,36 @@ using System.Linq;
|
||||
|
||||
using ExcelDna.Integration;
|
||||
using ExcelDna.Integration.Rtd;
|
||||
using ExcelDna.Registration.Utils;
|
||||
using System.Reactive.Linq;
|
||||
using bts.api;
|
||||
using bts.api.md;
|
||||
using bts.api.orderman;
|
||||
using ExcelDna.Registration.Utils;
|
||||
|
||||
namespace bts.excel.rtd
|
||||
{
|
||||
public class MDSubscribe
|
||||
{
|
||||
static Authenticator _auth = new Authenticator();
|
||||
[ExcelFunction(Category = "BTS", Description = "Log in to BTS Spark")]
|
||||
async public static void spark_login(string login, string password, ExcelAsyncHandle handle)
|
||||
{
|
||||
try
|
||||
{
|
||||
var toke = await _auth.login(login, password);
|
||||
foreach (var ven in MarketDataClient.cached_exchanges)
|
||||
{
|
||||
MarketDataClient.create_or_get(ven, out MarketDataClient md);
|
||||
md?.set_auth_token(toke);
|
||||
}
|
||||
handle.SetResult(toke?.Token ?? "Could not log in check user/pass");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
handle.SetException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static MarketDataClient market_data(api.Venue exchange)
|
||||
{
|
||||
var newc = MarketDataClient.create_or_get(exchange, out MarketDataClient md);
|
||||
@@ -83,18 +103,18 @@ namespace bts.excel.rtd
|
||||
|
||||
|
||||
[ExcelFunction(Category = "BTS", Description = "Subscribe to BTS Spark top of book market data")]
|
||||
public static object spark_md_top(
|
||||
public static object spark_md_top_of_book(
|
||||
[ExcelArgument("Required. The specific contract, GCZ8 or ZNU8-ZNZ8, etc")] string contract,
|
||||
[ExcelArgument("Required. The symbol, GC or ZN, etc")] string symbol,
|
||||
[ExcelArgument("Optional. The type, Future or Spread, default = Future")] string security_type = null,
|
||||
[ExcelArgument("Optional. The exchange, default = GLBX")] string exchange = null)
|
||||
{
|
||||
var param = new object[] { contract, symbol, security_type, exchange };
|
||||
return ObservableRtdUtil.Observe(nameof(spark_md_top), param,
|
||||
return ObservableRtdUtil.Observe(nameof(spark_md_top_of_book), param,
|
||||
() => md_observable(contract, symbol, security_type, exchange).Select(x =>
|
||||
{
|
||||
if (x is co2.ChannelUpdate upd)
|
||||
return new TopMDFormatter(upd).format();
|
||||
return new TopOfBookMDFormatter(upd).format();
|
||||
return x;
|
||||
}));
|
||||
}
|
||||
@@ -116,5 +136,23 @@ namespace bts.excel.rtd
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
[ExcelFunction(Category = "BTS", Description = "Subscribe to BTS Spark top of book market data")]
|
||||
public static object spark_md(
|
||||
[ExcelArgument("Required. The 'Topic' string, 'bid', 'ask', etc")] string topic,
|
||||
[ExcelArgument("Required. The specific contract, GCZ8 or ZNU8-ZNZ8, etc")] string contract,
|
||||
[ExcelArgument("Required. The symbol, GC or ZN, etc")] string symbol,
|
||||
[ExcelArgument("Optional. The type, Future or Spread, default = Future")] string security_type = null,
|
||||
[ExcelArgument("Optional. The exchange, default = GLBX")] string exchange = null)
|
||||
{
|
||||
var param = new object[] { topic, contract, symbol, security_type, exchange };
|
||||
return ObservableRtdUtil.Observe(nameof(spark_md), param,
|
||||
() => md_observable(contract, symbol, security_type, exchange).Select(x =>
|
||||
{
|
||||
if (x is co2.ChannelUpdate upd)
|
||||
return new TopicMDFormatter(upd, topic).format();
|
||||
return x;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,13 @@
|
||||
<ExternalLibrary Path="spark_excel.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" />
|
||||
|
||||
<Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
|
||||
|
||||
<Reference Path="nunit.framework.dll" Pack="true" ExplicitExports="true" />
|
||||
<Reference Path="ExcelDna.Registration.dll" Pack="true" />
|
||||
<Reference Path="ExcelDna.Integration.dll" Pack="true" />
|
||||
|
||||
<Reference Path="Google.Protobuf.dll" Pack="true" ExplicitExports="true" />
|
||||
<Reference Path="System.Linq.Dynamic.dll" Pack="true" ExplicitExports="true" />
|
||||
<Reference Path="Newtonsoft.Json.dll" Pack="true" ExplicitExports="true" />
|
||||
<Reference Path="nunit.framework.dll" Pack="true" ExplicitExports="true" />
|
||||
<Reference Path="System.Reactive.Core.dll" Pack="true" ExplicitExports="true" />
|
||||
<Reference Path="System.Reactive.Interfaces.dll" Pack="true" ExplicitExports="true" />
|
||||
<Reference Path="System.Reactive.Providers.dll" Pack="true" ExplicitExports="true" />
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="spark_excel_example.xlsm"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></None>
|
||||
<None Include="spark_excel_example_2018.xlsm"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></None>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- <Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -5,12 +5,28 @@ using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using ExcelDna.Integration;
|
||||
using bts.api;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace bts.excel
|
||||
{
|
||||
public class Utilities
|
||||
{
|
||||
|
||||
[ExcelFunction]
|
||||
public static object bts_json_lookup(string json, string key1, string key2 = null, string key3 = null)
|
||||
{
|
||||
var jo = JObject.Parse(json);
|
||||
JToken val = json;
|
||||
if (!string.IsNullOrEmpty(key1) && !string.IsNullOrEmpty(key2) && !string.IsNullOrEmpty(key3))
|
||||
val = jo[key1][key2][key3];
|
||||
else if (!string.IsNullOrEmpty(key1) && !string.IsNullOrEmpty(key2))
|
||||
val = jo[key1][key2];
|
||||
else if (!string.IsNullOrEmpty(key1))
|
||||
val = jo[key1];
|
||||
return val.ToString();
|
||||
}
|
||||
|
||||
public static bool parse_venue(string exch, out Venue ven)
|
||||
{
|
||||
if (!Enum.TryParse(exch.ToUpper(), true, out ven))
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
# BTS Spark Client SDK
|
||||
|
||||
#### Getting Started
|
||||
|
||||
## Git
|
||||
|
||||
* First clone the spark_client_sdk repo
|
||||
|
||||
```
|
||||
> git clone https://github.com/BlueTradingSystems/spark_client_sdk.git
|
||||
```
|
||||
|
||||
|
||||
## Build
|
||||
* Use msbuild to target windows / .net 4.71
|
||||
* Install studio here if you don't have it: https://visualstudio.microsoft.com/downloads/
|
||||
* Use VSCode for editing, it's better: https://code.visualstudio.com/
|
||||
```
|
||||
> cd spark_client_sdk\src\spark_sdk
|
||||
spark_client_sdk\src\spark_sdk> msbuild /t:restore
|
||||
spark_client_sdk\src\spark_sdk> msbuild
|
||||
|
||||
```
|
||||
|
||||
* spark_sdk binaries will be produced in the bin\Debug directory
|
||||
|
||||
## Connecting to Spark Server
|
||||
|
||||
* Start your exe using the -ConfigServer parameter to point at a running Spark Server
|
||||
```
|
||||
> spark_sdk.exe -ConfigServer http://location:8000/config
|
||||
```
|
||||
Or create a file called spark.conf at %APPDATA%\bts\conf\ that contains:
|
||||
```
|
||||
include: "http://location:8000/config/"
|
||||
```
|
||||
|
||||
## Examples
|
||||
* Make sure you can connect to a running server
|
||||
* run spark_sdk.exe with no parameters to see help
|
||||
```
|
||||
spark_sdk\bin\Debug\net471> spark_sdk.exe
|
||||
|
||||
BTS Spark SDK
|
||||
Usages: spark_sdk [command] [arguments]
|
||||
|
||||
Commands:
|
||||
md <exchange> <security_type> <symbol> [<security_desc>]
|
||||
ui <exchange> <security_type> <symbol> <security_desc> <poll_interval_in_ms>
|
||||
order <exchange> <security_type> <symbol> <security_desc> <signed_quantity> [<price>]
|
||||
Arguments:
|
||||
--pump=<pump_interval_in_ms=100 default>
|
||||
```
|
||||
|
||||
* Check out sample code
|
||||
* [Market Data](src/spark_sdk/samples/MarketDataSample.cs)
|
||||
* [Orders](src/spark_sdk/samples/OrderSample.cs)
|
||||
* [Driver](src/spark_sdk/samples/SDKMain.cs)
|
||||
|
||||
|
||||
## Excel
|
||||
```
|
||||
spark_sdk\bin\Debug\net471> start spark_excel-addin64-packed.xll
|
||||
```
|
||||
* This will start excel and load the bts addin
|
||||
* Check the [```excel```](excel/) directory for an example spreadsheet
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
* Our client side API is based on Google's protocol buffers; the message types are all protos. https://developers.google.com/protocol-buffers/
|
||||
|
||||
* We extended the protoc compiler to generate c#, c++, excel and js bindings to the services provided by our server process (https://github.com/BlueTradingSystems/spark_sdk)
|
||||
|
||||
|
||||
* ### Dotnet core
|
||||
|
||||
* Right now we only support c# Windows 10 clients, but the package targets both net471 and .net core 2.1.6, so in theory one could run a .net core or c++ client on linux with a little work.
|
||||
|
||||
* https://dotnet.microsoft.com/
|
||||
|
||||
|
||||
```
|
||||
spark_client_sdk\src\spark_sdk> dotnet build
|
||||
...> dotnet spark_sdk.dll
|
||||
```
|
||||
|
||||
* Send us an email for help: api_support@bluetradesys.com
|
||||
@@ -26,16 +26,9 @@ namespace bts.sdk
|
||||
_md = client;
|
||||
}
|
||||
|
||||
readonly static Lazy<OrderService> _orders = new Lazy<OrderService>(() => locate<OrderService>(), true);
|
||||
readonly static Lazy<UserService> _users = new Lazy<UserService>(() => locate<UserService>(), true);
|
||||
readonly static Lazy<AdminService> _admin = new Lazy<AdminService>(() => locate<AdminService>(), true);
|
||||
static T locate<T>() where T : class, IApiClient
|
||||
{
|
||||
using (var ctx = new api.core.ServiceContext())
|
||||
{
|
||||
return ctx.locate<T>();
|
||||
}
|
||||
}
|
||||
readonly static Lazy<OrderService> _orders = new Lazy<OrderService>(() => Locator.locate<OrderService>(), true);
|
||||
readonly static Lazy<UserService> _users = new Lazy<UserService>(() => Locator.locate<UserService>(), true);
|
||||
readonly static Lazy<AdminService> _admin = new Lazy<AdminService>(() => Locator.locate<AdminService>(), true);
|
||||
|
||||
void print_update<T>(T update)
|
||||
{
|
||||
|
||||
@@ -13,56 +13,73 @@ namespace bts.sdk
|
||||
|
||||
public class SDKMain
|
||||
{
|
||||
private static void user_test()
|
||||
{
|
||||
var ctx = new ServiceContext();
|
||||
|
||||
var s = ctx.locate<api.user.UserService>();
|
||||
var r = new api.user.GetUsersRequest();
|
||||
var resp = s.get_users(r);
|
||||
Console.WriteLine("{0}", resp);
|
||||
}
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
MarketDataClient client = new MarketDataClient();
|
||||
CompositeDisposable disp = new CompositeDisposable(client);
|
||||
if (args.FirstOrDefault() == "ui")
|
||||
{
|
||||
if (args.Length >= 6)
|
||||
{
|
||||
using (var ui = new ui.UISample(client))
|
||||
{
|
||||
ui.simple_price_ui(args[1], args[2], args[3], args[4], args[5]);
|
||||
}
|
||||
}
|
||||
else
|
||||
ui_help();
|
||||
}
|
||||
else if (args.Length > 0 && args.FirstOrDefault().Contains("md"))
|
||||
Log.ClientSdk.info("Welcome to the BTS Client Side SDK example");
|
||||
if (args.FirstOrDefault() == "users")
|
||||
{
|
||||
var s = new MarketDataSample(client);
|
||||
if (args.FirstOrDefault() == "md")
|
||||
user_test();
|
||||
}
|
||||
else
|
||||
{
|
||||
MarketDataClient client = new MarketDataClient();
|
||||
CompositeDisposable disp = new CompositeDisposable(client);
|
||||
if (args.FirstOrDefault() == "ui")
|
||||
{
|
||||
if (args.Length >= 5)
|
||||
if (args.Length >= 6)
|
||||
{
|
||||
s.print_security(args[1], args[2], args[3], args[4]);
|
||||
using (var ui = new ui.UISample(client))
|
||||
{
|
||||
ui.simple_price_ui(args[1], args[2], args[3], args[4], args[5]);
|
||||
}
|
||||
}
|
||||
else if (args.Length >= 4)
|
||||
else
|
||||
ui_help();
|
||||
}
|
||||
else if (args.Length > 0 && args.FirstOrDefault().Contains("md"))
|
||||
{
|
||||
var s = new MarketDataSample(client);
|
||||
if (args.FirstOrDefault() == "md")
|
||||
{
|
||||
s.print_channel(args[1], args[2], args[3]);
|
||||
if (args.Length >= 5)
|
||||
{
|
||||
s.print_security(args[1], args[2], args[3], args[4]);
|
||||
}
|
||||
else if (args.Length >= 4)
|
||||
{
|
||||
s.print_channel(args[1], args[2], args[3]);
|
||||
}
|
||||
else
|
||||
md_help();
|
||||
}
|
||||
else
|
||||
md_help();
|
||||
}
|
||||
}
|
||||
else if (args.FirstOrDefault() == "order")
|
||||
{
|
||||
OrderSample os = new OrderSample(client);
|
||||
disp.Add(os);
|
||||
order_sample(os, args);
|
||||
}
|
||||
else
|
||||
md_help();
|
||||
}
|
||||
else if (args.FirstOrDefault() == "order")
|
||||
{
|
||||
OrderSample os = new OrderSample(client);
|
||||
disp.Add(os);
|
||||
order_sample(os, args);
|
||||
}
|
||||
else
|
||||
help();
|
||||
help();
|
||||
|
||||
int ms = 100;
|
||||
string p = args.FirstOrDefault(x => x.Contains("--pump="));
|
||||
if (p != null)
|
||||
ms = int.Parse(p.Replace("--pump=", string.Empty));
|
||||
client.run_pump(TimeSpan.FromMilliseconds(ms));
|
||||
wait_for_stop(disp);
|
||||
int ms = 100;
|
||||
string p = args.FirstOrDefault(x => x.Contains("--pump="));
|
||||
if (p != null)
|
||||
ms = int.Parse(p.Replace("--pump=", string.Empty));
|
||||
client.run_pump(TimeSpan.FromMilliseconds(ms));
|
||||
wait_for_stop(disp);
|
||||
}
|
||||
}
|
||||
|
||||
static async void order_sample(OrderSample os, string[] args)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
|
||||
<TargetFrameworks>netstandard2.0;net471</TargetFrameworks>
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.1;net471</TargetFrameworks>
|
||||
<OutputType>Exe</OutputType>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<GeneratePackageOnBuild Condition="$(Configuration) == 'Release' or $(Configuration) == 'Release'">true</GeneratePackageOnBuild>
|
||||
<PackageOutputPath>$(OutputPath)\net471</PackageOutputPath>
|
||||
<IncludeSource>true</IncludeSource>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
@@ -41,17 +40,63 @@
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<!-- <PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
-->
|
||||
<!-- $(SparkRoot) is something we define on our build at BTS, if it's empty, this project file is in the wild-->
|
||||
<ItemGroup Condition= " '$(SparkRoot)' != '' ">
|
||||
<ProjectReference Include="../spark_api/spark_api.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition= " '$(SparkRoot)' != '' and '$(TargetFramework)' == 'net471' ">
|
||||
<!-- This is so we can ship excel in the nupkg -->
|
||||
<ProjectReference Include="../spark_excel/spark_excel.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
|
||||
<ItemGroup Condition= " '$(SparkRoot)' != '' ">
|
||||
<None Include="README.md" pack="true" PackagePath="." />
|
||||
<None Include="$(OutputPath)\net471\spark_excel_example_2018.xlsm" pack="true" PackagePath=".\excel\spark_excel_example_2018.xlsm" />
|
||||
<None Include="$(OutputPath)\net471\spark_excel-addin64-packed.xll" pack="true" PackagePath=".\excel\spark_excel-addin64-packed.xll" />
|
||||
<None Include="$(OutputPath)\net471\spark_excel-addin64.dna" pack="true" PackagePath=".\excel\spark_excel-addin64.dna" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences" Condition= " '$(SparkRoot)' != '' ">
|
||||
<ItemGroup>
|
||||
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
|
||||
<BuildOutputInPackage Include="$(OutputPath)..\net471\libspark.dll"/>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="copy_scripts" AfterTargets="PostBuildEvent" Condition= " '$(SparkRoot)' != '' " >
|
||||
<Copy SourceFiles="../../sdk/update_github.cmd" DestinationFolder="$(OutputPath)\" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
<!-- deployed sdk build net471 -->
|
||||
<ItemGroup Condition= " '$(SparkRoot)' == '' and '$(TargetFramework)' == 'net471'">
|
||||
<Reference Include="spark_api">
|
||||
<HintPath>..\..\lib\net471\spark_api.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- deployed sdk build netcoreapp2.1 -->
|
||||
<ItemGroup Condition= " '$(SparkRoot)' == '' and '$(TargetFramework)' == 'netcoreapp2.1'">
|
||||
<Reference Include="spark_api">
|
||||
<HintPath>..\..\lib\netcoreapp2.1\spark_api.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="copy_lib_deployed" AfterTargets="PostBuildEvent" Condition= " '$(SparkRoot)' == '' " >
|
||||
<Copy SourceFiles="..\..\lib\net471\libspark.dll" DestinationFolder="$(OutputPath)\" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="copy_lib_deployed471" AfterTargets="PostBuildEvent" Condition= " '$(SparkRoot)' == '' and '$(TargetFramework)' == 'net471'" >
|
||||
<Copy SourceFiles="..\..\lib\net471\spark_excel.dll" DestinationFolder="$(OutputPath)\" SkipUnchangedFiles="true" />
|
||||
<Copy SourceFiles="..\..\excel\spark_excel_example_2018.xlsm" DestinationFolder="$(OutputPath)\" SkipUnchangedFiles="true" />
|
||||
<Copy SourceFiles="..\..\excel\spark_excel-addin64-packed.xll" DestinationFolder="$(OutputPath)\" SkipUnchangedFiles="true" />
|
||||
<Copy SourceFiles="..\..\excel\spark_excel-addin64.dna" DestinationFolder="$(OutputPath)\" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ManyConsole {
|
||||
public static class ConsoleCommandEx {
|
||||
public static string get_argument(this ConsoleCommand _, string arg_name) {
|
||||
var arg = Environment.GetCommandLineArgs().FirstOrDefault(str => str.StartsWith("--"+arg_name));
|
||||
if (arg != null) {
|
||||
var parts = arg.Split(new[] { '=' }, 2);
|
||||
if (parts.Length > 1) {
|
||||
return parts[1];
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using bts.api.core;
|
||||
using bts.test;
|
||||
using ManyConsole;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bts {
|
||||
class TailService : ConsoleCommand {
|
||||
static bool _all = false;
|
||||
static bool _timestamp = false;
|
||||
public TailService() {
|
||||
void ignore(string _) { }
|
||||
IsCommand("tailservice", "Tail updates to named service api. Ex: tail --method=SyntheticSecurityService.metadata");
|
||||
HasRequiredOption("method", "Service.method to tail", ignore);
|
||||
HasOption("time", "Include timestamp", _ => _timestamp = true);
|
||||
// The following are not implemented. If you need them get to work.
|
||||
HasOption("path", "Path inside the row to use for display. Ex: 'Id' or 'Name' ", ignore);
|
||||
HasOption("all", "Invlude 'all' rows on every print", _ => _all = true);
|
||||
}
|
||||
public override int Run(string[] remainingArguments) {
|
||||
var arg = this.get_argument("method");
|
||||
var split = arg.Split('.');
|
||||
if (split.Length != 2) {
|
||||
Console.WriteLine("Try --method=[ServiceName].[Method]");
|
||||
return -1;
|
||||
}
|
||||
tail(split[0], split[1]);
|
||||
return 0;
|
||||
}
|
||||
class SubscriptionLogger<T> : IObserver<T> {
|
||||
public void OnCompleted() {
|
||||
ConsoleEx.WriteLine("Completed.", ConsoleColor.Yellow);
|
||||
}
|
||||
|
||||
public void OnError(Exception error) {
|
||||
ConsoleEx.WriteLine($"Error. '{error}'", ConsoleColor.Red);
|
||||
}
|
||||
|
||||
public void OnNext(T value) {
|
||||
if (_timestamp) {
|
||||
Console.Write(DateTime.Now.ToString("HH:mm:ss.fff"));
|
||||
Console.Write(" ");
|
||||
}
|
||||
if (_all) { }
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
}
|
||||
private static void tail(string service_name, string method_name) {
|
||||
var spark_api = typeof(ServiceContext).Assembly;
|
||||
var service_type = spark_api.GetExportedTypes().FirstOrDefault(t => t.Name == service_name);
|
||||
if (service_type == null) {
|
||||
Console.WriteLine($"Could not find service type {service_name} in spark_api.dll");
|
||||
return;
|
||||
}
|
||||
var subscribe_method = service_type.GetMethod("subscribei_" + method_name);
|
||||
using (var ctx = new ServiceContext()) {
|
||||
var locate = typeof(ServiceContext).GetMethod("locate").MakeGenericMethod(service_type);
|
||||
var service = locate.Invoke(ctx, new[] { "" });
|
||||
// Subscribe with null qualifier
|
||||
object observable = subscribe_method.Invoke(service, new object[] { null });
|
||||
Type update_type = observable.GetType().GetGenericArguments().First(arg => arg.Name.StartsWith("Update"));
|
||||
Type observer_type = typeof(SubscriptionLogger<>).MakeGenericType(update_type);
|
||||
object observer = Activator.CreateInstance(observer_type);
|
||||
|
||||
var subscribe = observable.GetType().GetMethod("Subscribe", new[] { observer_type });
|
||||
var dispose = subscribe.Invoke(observable, new[] { observer });
|
||||
|
||||
while (true) {
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using bts.api;
|
||||
using bts.api.core;
|
||||
using bts.api.synthetic;
|
||||
using bts.test;
|
||||
using ManyConsole;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace bts {
|
||||
public class ServiceTest : ConsoleCommand {
|
||||
@@ -28,6 +30,8 @@ namespace bts {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private static void synthetic_test() {
|
||||
using (var ctx = new ServiceContext()) {
|
||||
var security = new Security {
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
Session ID Access ID Secret Key Creation Date Expiration Date Environment
|
||||
1U7 i9pLY5mVhWLXs7FWNb9X 8esbwiaHaqmR2rXZMkJRHt00fW6l_-ppCGoheWWuBZQ 2018-04-05 2019-04-05 CERT
|
||||
1U7 ozXmORijPtJriTg6Wwny A1KOwrhH8GojNotjkCfVwHRSi_OS280xihaRZwJLFKo 2018-04-03 2018-05-03 CERT
|
||||
ANS 6ogfYoF54g695tqaHsFC CtDkFnuDuStB1S05nC_pWvANb6FWsV2IMNKkmM3EcP4 2018-04-05 2019-04-05 NEWRELEASE
|
||||
KTK IrUp518ekr8SzbfJGdPZ QmilC-cKgqlIiIBs_BV59fowbPfuBWn0QjeEc1dYj38 2018-04-05 2019-04-05 NEWRELEASE
|
||||
M5Y bUFtyvZgPhZFCYa434ap rfZ2XLLwtHt26szWwMxYRw9uPb7jE4evEWaKuKf2uyU 2018-04-05 2019-04-05 CERT
|
||||
MBX tbna9JLxT4Jlrzj0wtSS EcYqrLmR4ysSIT_NCBeC2AjDo7IAHsVZ0rOZ0cpAh_o 2018-04-05 2019-04-05 CERT
|
||||
MC1 0N10hKkE2B2KUt86ewd8 dJ5I52JNA-6aZZ8hnO0byVKcyqA8Of6kkstfIF89AAM 2018-04-05 2019-04-05 CERT
|
||||
MC5 e4uBmhQ1ebaXAeWHa7HK PNOM86eofsiCwzzKUsB5yAmrNoyZypnYD72pT2A8zgc 2018-04-05 2019-04-05 CERT
|
||||
MC7 S6KfCnay5UJ67P55ibHd 5lSs1TbX7N0p6Duu63_JDMghPUqBAWacvkM91MUv1uM 2018-04-05 2019-04-05 CERT
|
||||
MC8 AbEEtBn63WIAuItPDz1c n3ndjYb03Hx6wBO3me35HoONyDgO5TZKWk0tDSaX9KA 2018-04-05 2019-04-05 CERT
|
||||
T39 UWggBgHWAe07aqW3ps2I tbb3it0rUQSSTa0TC9QcRwkrHEMDLWhaJH4VQ0FqGB4 2018-04-05 2019-04-05 NEWRELEASE
|
||||
V06 WOC3GVA6l8ffrcOKUT9P Az1TJc2XHJyZ4C0S1bG_p5eWPQlVYUYhfjmdPqSGJ8o 2018-11-26 2019-11-26 NEWRELEASE
|
||||
@@ -1,14 +1,14 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>BTS Spark Socket To Socket Requote Times</title>
|
||||
<title>BTS Spark Socket To Socket Requote and Hedge Times</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="/perf_trace/compiled.css">
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=es6"></script>
|
||||
<style type="text/css">
|
||||
.summary-block {
|
||||
margin: 2em 1em;
|
||||
padding: 1em 1em;
|
||||
}
|
||||
.summary-block > ul {
|
||||
margin: 0em 1em;
|
||||
@@ -23,6 +23,16 @@
|
||||
.clear {
|
||||
clear:both;
|
||||
}
|
||||
.session-table tr {
|
||||
padding-top: 1em;
|
||||
}
|
||||
.session-table th {
|
||||
background-color: #4169AA;
|
||||
color:#fff;
|
||||
text-align: center;
|
||||
padding: 1em;
|
||||
border-left: 1px solid #f6f6f6;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -47,7 +57,7 @@
|
||||
</ul>
|
||||
</div-->
|
||||
<div style="margin:2em 0 0 2em;"><!--div class="is-tab-content" is-tab-content is shorter than the screen to accommodate tabs at the top -->
|
||||
<h1 class="is-size-2">Socket To Socket Requote Times</h1>
|
||||
<h1 class="is-size-2">Socket To Socket Latencies</h1>
|
||||
<div id="output"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,9 @@ $( document ).ready(function (){
|
||||
let urlParams = new URLSearchParams(window.location.search);
|
||||
num_rows = urlParams.get('r');
|
||||
let show_rows = urlParams.get('showrows');
|
||||
let rows_of = urlParams.get('rowsof');
|
||||
|
||||
//let trace_data_url = "./perf_trace_data";
|
||||
let trace_data_url = "/perf_trace_data";
|
||||
if(num_rows != null) {
|
||||
trace_data_url += "/" + num_rows;
|
||||
@@ -15,14 +17,50 @@ $( document ).ready(function (){
|
||||
error: ajax_err,
|
||||
crossDomain: true
|
||||
}).done(function(result) {
|
||||
|
||||
if(show_rows != null) {
|
||||
list_rows(show_rows, result);
|
||||
if(rows_of === "quot") {
|
||||
list_rows(show_rows, rows_of, result.requotes);
|
||||
}
|
||||
else {
|
||||
list_rows(show_rows, rows_of, result.hedges);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
if(result.length > 0){
|
||||
let summary_info = "<h1 class='is-size-3'><b>Host:</b> " + result[0].host + "</h1>";
|
||||
if((result.requotes.length + result.hedges.length) > 0) {
|
||||
let useful_result = (result.requotes.length > 0 ? result.requotes : result.hedges);
|
||||
let less_useful_result = (result.requotes.length === 0 ? result.requotes : result.hedges);
|
||||
|
||||
let summary_info = "<h1 class='is-size-3'><b>Host:</b> " + useful_result[0].host + "</h1><br>";
|
||||
|
||||
$("#output").html(summary_info);
|
||||
$(result).each(display_session);
|
||||
|
||||
let whole_result = result.requotes.concat(result.hedges);
|
||||
let unique_sessions = [];
|
||||
whole_result.filter(function(value) {
|
||||
if (unique_sessions.find(function(elm) {
|
||||
return elm.session_name === value.session_name;
|
||||
}) === undefined) {
|
||||
unique_sessions.push(value);
|
||||
}
|
||||
});
|
||||
|
||||
$(unique_sessions).each(function (index, sess_val){
|
||||
console.log(sess_val.session_name);
|
||||
let r = result.requotes.find(function(elm){
|
||||
return elm.session_name === sess_val.session_name;
|
||||
});
|
||||
|
||||
let h = result.hedges.find(function(elm){
|
||||
return elm.session_name === sess_val.session_name;
|
||||
});
|
||||
|
||||
display_session(r, h);
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,29 +68,30 @@ $( document ).ready(function (){
|
||||
|
||||
});
|
||||
|
||||
function list_rows(show_rows, data) {
|
||||
function list_rows(show_rows, rows_of, data) {
|
||||
$.each(data, function(index, value){
|
||||
if(value.session_name === show_rows){
|
||||
let summary_info = "<table class='table bts-data-table'>";
|
||||
summary_info += "<thead><tr><th>Trace Time</th>" +
|
||||
"<th>Order Key</th>" +
|
||||
"<th>MD</th>" +
|
||||
"<th>Spreader</th>" +
|
||||
"<th>Fix</th>" +
|
||||
"<th>Total</th></tr></thead><tbody>";
|
||||
|
||||
summary_info += "<thead><tr><th>Trace Time</th>"
|
||||
$.each(value.rows[0], function(key, unval){
|
||||
if(key !== "trace_time" && key !== "total")
|
||||
{
|
||||
summary_info +="<th>" + format_title(key) + "</th>";
|
||||
}
|
||||
});
|
||||
summary_info += "<th>Total</th></tr></thead><tbody>";
|
||||
|
||||
$.each(value.rows, function(key, val) {
|
||||
summary_info += "<tr>";
|
||||
console.log(val);
|
||||
|
||||
summary_info += "<td>" + val.trace_time + "</td>" +
|
||||
"<td>" + val.order_key + "</td>" +
|
||||
"<td>" + val.md + "</td>" +
|
||||
"<td>" + val.spreader + "</td>" +
|
||||
"<td>" + val.fix + "</td>" +
|
||||
"<td>" + val.total + "</td>";
|
||||
|
||||
|
||||
summary_info += "<td>" + val.trace_time + "</td>";
|
||||
$.each(val, function(key, uval){
|
||||
if(key !== "trace_time" && key !== "total")
|
||||
{
|
||||
summary_info += "<td>" + uval + "</td>";
|
||||
}
|
||||
});
|
||||
summary_info += "<td>" + val.total + "</td>";
|
||||
summary_info += "</tr>";
|
||||
});
|
||||
summary_info += "</tbody></table>";
|
||||
@@ -77,7 +116,26 @@ function ajax_err (jqXHR, textStatus,errorThrown) {
|
||||
function first_upper (str)
|
||||
{
|
||||
let ret_str = str[0].toUpperCase() + str.substring(1, str.length);
|
||||
return ret_str
|
||||
return ret_str;
|
||||
}
|
||||
|
||||
function format_title (str)
|
||||
{
|
||||
let ret_str = "";
|
||||
|
||||
for(let i=0; i < str.length; i++) {
|
||||
if(i === 0 || str[i-1] === "_") {
|
||||
ret_str += str[i].toUpperCase();
|
||||
}
|
||||
else if(str[i] === "_") {
|
||||
ret_str += " ";
|
||||
}
|
||||
else {
|
||||
ret_str += str[i];
|
||||
}
|
||||
}
|
||||
|
||||
return ret_str;
|
||||
}
|
||||
|
||||
function generate_histogram(id, data)
|
||||
@@ -95,70 +153,143 @@ function generate_histogram(id, data)
|
||||
Plotly.newPlot(id, plot_data);
|
||||
}
|
||||
|
||||
function display_session (index, value) {
|
||||
//console.log(value);
|
||||
let session_info = "<ul class=''>";
|
||||
session_info += "<li id='" + value.session_name + "' class='is-size-5'><b>Session:</b> " + value.session_name + "</li>";
|
||||
session_info += "<li><b>Build Type:</b> " + value.build_type + "</li>";
|
||||
session_info += "<li><b>Version:</b> " + value.version + "</li>";
|
||||
function write_summary (histo_id, v)
|
||||
{
|
||||
session_info = "<ul>";
|
||||
session_info += "<li><b>" + format_title(v.value) + "</b></li>";
|
||||
session_info += "<li>Min: " + v.min + "</li>";
|
||||
session_info += "<li>Median: " + v.median + "</li>";
|
||||
session_info += "<li>Max: " + v.max + "</li>";
|
||||
session_info += "<li>99%: " + v.ninenty_nine + "</li>";
|
||||
session_info += "<li>Standard Deviation: " + v.stdev + "</li>";
|
||||
session_info += "</ul>";
|
||||
session_info += "<div id='" + histo_id + "' class='histogram-div'></div>"
|
||||
|
||||
|
||||
return session_info;
|
||||
}
|
||||
|
||||
function display_session (quot_val, hed_val) {
|
||||
let safe_quot_val = (quot_val != undefined) ? quot_val : {
|
||||
session_name: hed_val.session_name,
|
||||
build_type: hed_val.build_type,
|
||||
version: hed_val.version,
|
||||
n_rows: 0,
|
||||
total: 0,
|
||||
summaries: []
|
||||
};
|
||||
let safe_hed_val = (hed_val != undefined) ? hed_val : {
|
||||
session_name: quot_val.session_name,
|
||||
build_type: quot_val.build_type,
|
||||
version: quot_val.version,
|
||||
n_rows: 0,
|
||||
total: 0,
|
||||
summaries: []
|
||||
};
|
||||
|
||||
let session_info = "<table class='session-table'>";
|
||||
session_info += "<tr><td colspan='2' id='" + safe_quot_val.session_name + "' class='is-size-5'><b>Session:</b> " + safe_quot_val.session_name + "<br>";
|
||||
session_info += "<b>Build Type:</b> " + safe_quot_val.build_type + "<br>";
|
||||
session_info += "<b>Version:</b> " + safe_quot_val.version + "<br><br></td></tr>";
|
||||
|
||||
//column headers
|
||||
session_info += "<tr><th>Requotes</th><th>Hedges</th></tr>"
|
||||
|
||||
if(num_rows != null) {
|
||||
session_info += "<li><a href='?showrows=" + value.session_name + "&r=" + num_rows + "'><b>Rows:</b> " + value.n_rows + "</a></li>";
|
||||
}
|
||||
else {
|
||||
session_info += "<li><a href='?showrows=" + value.session_name + "'><b>Rows:</b> " + value.n_rows + "</a></li>";
|
||||
}
|
||||
session_info += "<tr><td ><a href='?showrows=" + safe_quot_val.session_name + "&rowsof=quot" + "&r=" + num_rows + "'><b>Rows:</b> " + safe_quot_val.n_rows + "</a></td>";
|
||||
session_info += "<td><a href='?showrows=" + safe_hed_val.session_name + "&rowsof=hed" + "&r=" + num_rows + "'><b>Rows:</b> " + safe_hed_val.n_rows + "</a></td></tr>";
|
||||
}
|
||||
else {
|
||||
session_info += "<tr><td><a href='?showrows=" + safe_quot_val.session_name + "&rowsof=quot" + "'><b>Rows:</b> " + safe_quot_val.n_rows + "</a></td>";
|
||||
session_info += "<td><a href='?showrows=" + safe_hed_val.session_name + "&rowsof=hed" + "'><b>Rows:</b> " + safe_hed_val.n_rows + "</a></td></tr>";
|
||||
}
|
||||
|
||||
$(value.summaries).each(function(i,v){
|
||||
session_info += "<tr><td class='summary-block'>";
|
||||
$(safe_quot_val.summaries).each(function(i,v){
|
||||
if(v.value === "total") {
|
||||
session_info += "<li class='summary-block'><ul>";
|
||||
session_info += "<li><b>" + first_upper(v.value) + "</b></li>";
|
||||
session_info += "<li>Min: " + v.min + "</li>";
|
||||
session_info += "<li>Median: " + v.median + "</li>";
|
||||
session_info += "<li>Max: " + v.max + "</li>";
|
||||
session_info += "<li>99%: " + v.ninenty_nine + "</li>";
|
||||
session_info += "<li>Standard Deviation: " + v.stdev + "</li>";
|
||||
session_info += "</ul>";
|
||||
session_info += "<div id='" + value.session_name + "-" + v.value + "' class='histogram-div'></div>"
|
||||
session_info += "</li>";
|
||||
return false
|
||||
session_info += write_summary(safe_quot_val.session_name + "-quot-" + v.value, v);
|
||||
return false
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(value.summaries).each(function(i,v){
|
||||
if(v.value !== "total") {
|
||||
session_info += "<li class='summary-block'><ul>";
|
||||
session_info += "<li><b>" + first_upper(v.value) + "</b></li>";
|
||||
session_info += "<li>Min: " + v.min + "</li>";
|
||||
session_info += "<li>Median: " + v.median + "</li>";
|
||||
session_info += "<li>Max: " + v.max + "</li>";
|
||||
session_info += "<li>99%: " + v.ninenty_nine + "</li>";
|
||||
session_info += "<li>Standard Deviation: " + v.stdev + "</li>";
|
||||
session_info += "</ul>";
|
||||
session_info += "<div id='" + value.session_name + "-" + v.value + "' class='histogram-div'></div>"
|
||||
session_info += "</li>";
|
||||
session_info += "</td>";
|
||||
session_info += "<td class='summary-block'>";
|
||||
|
||||
$(safe_hed_val.summaries).each(function(i,v){
|
||||
if(v.value === "total") {
|
||||
session_info += write_summary(safe_hed_val.session_name + "-hed-" + v.value, v);
|
||||
return false
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
session_info += "</ul><hr class='clear'>";
|
||||
session_info += "</td></tr>";
|
||||
|
||||
let loop_val = 0;
|
||||
|
||||
if(safe_quot_val.summaries.length >= safe_hed_val.summaries.length ) {
|
||||
loop_val = safe_quot_val.summaries.length;
|
||||
}
|
||||
else {
|
||||
loop_val = safe_hed_val.summaries.length;
|
||||
}
|
||||
|
||||
/*
|
||||
for(let i = 0; i < loop_val; i++) {
|
||||
session_info += "<tr><td class='summary-block'>";
|
||||
if (safe_quot_val.summaries[i] !== undefined && safe_quot_val.summaries[i].value !== "total") {
|
||||
session_info += write_summary(safe_quot_val.session_name + "-quot-" + safe_quot_val.summaries[i].value, safe_quot_val.summaries[i]);
|
||||
}
|
||||
session_info += "</td><td class='summary-block'>";
|
||||
if (safe_hed_val.summaries[i] !== undefined && safe_hed_val.summaries[i].value !== "total") {
|
||||
session_info += write_summary(safe_hed_val.session_name + "-hed-" + safe_hed_val.summaries[i].value, safe_hed_val.summaries[i]);
|
||||
}
|
||||
session_info += "</td></tr>";
|
||||
}
|
||||
*/
|
||||
|
||||
session_info += "</table><hr class='clear'>";
|
||||
$("#output").append(session_info);
|
||||
|
||||
let all_data = {};
|
||||
let quot_val_data = {};
|
||||
|
||||
$(value.rows).each(function(i, row) {
|
||||
$(safe_quot_val.rows).each(function(i, row) {
|
||||
$.each(row, function(name, v) {
|
||||
if(all_data[name] === undefined){
|
||||
all_data[name] = [v];
|
||||
if(quot_val_data[name] === undefined){
|
||||
quot_val_data[name] = [v];
|
||||
}
|
||||
else {
|
||||
all_data[name].push(v);
|
||||
quot_val_data[name].push(v);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//console.log(all_data);
|
||||
let hed_val_data = {};
|
||||
|
||||
$(value.summaries).each(function(i,v){
|
||||
generate_histogram(value.session_name + "-" + v.value, all_data[v.value]);
|
||||
$(safe_hed_val.rows).each(function(i, row) {
|
||||
$.each(row, function(name, v) {
|
||||
if(hed_val_data[name] === undefined){
|
||||
hed_val_data[name] = [v];
|
||||
}
|
||||
else {
|
||||
hed_val_data[name].push(v);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if(safe_quot_val.summaries.length > 0){
|
||||
generate_histogram(safe_quot_val.session_name + "-quot-total", quot_val_data["total"]);
|
||||
}
|
||||
/*
|
||||
$(safe_quot_val.summaries).each(function(i,v){
|
||||
generate_histogram(safe_quot_val.session_name + "-quot-" + v.value, quot_val_data[v.value]);
|
||||
});
|
||||
*/
|
||||
if(safe_hed_val.summaries.length > 0){
|
||||
generate_histogram(safe_hed_val.session_name + "-hed-total", hed_val_data["total"]);
|
||||
}
|
||||
/*
|
||||
$(safe_hed_val.summaries).each(function(i,v){
|
||||
generate_histogram(safe_hed_val.session_name + "-hed-" + v.value, hed_val_data[v.value]);
|
||||
});
|
||||
*/
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/services/AdminService.proto;api/services/ApiUnitTestService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/services/UserService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/Executor.conf;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/quickbus_cfg.proto;config/protos/spreader.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPriceLantencyTester.cpp;md/Diag/ShmDumper.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MDRecoverableConsumer.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/md2_tests.cpp;md/test/synthetic_book_merge_tests.cpp;os/os.cpp;os/tests/os_tests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;utils/AuthToken.cpp;utils/Dispatcher.cpp;utils/GrowableSPSCQueue.cpp;utils/HTTPStream.cpp;utils/PBUtils.cpp;utils/Puid.cpp;utils/SecureLogon.cpp;utils/SharedMemory.cpp;utils/Sqlite_utils.cpp;utils/Uuid.cpp;utils/datetime.cpp;utils/download.cpp;utils/file_utils.cpp;utils/init_spark_lib.cpp;utils/is_unittest_environment.cpp;utils/stats.cpp;utils/thread_manager.cpp)
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/services/AdminService.proto;api/services/ApiUnitTestService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/services/UserService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/Executor.conf;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/quickbus_cfg.proto;config/protos/spreader.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGateway.cpp;jetfix/gateway/Session.cpp;jetfix/store/FIXFileStore.cpp;jetfix/store/session_name.cpp;jetfix/tests/async_reader_tests.cpp;jetfix/tests/decoding_tests.cpp;jetfix/tests/fix_encoding_stream_tests.cpp;jetfix/tests/fix_fragment_tests.cpp;jetfix/tests/jetfix_performance_tests.cpp;jetfix/tests/sample_fix.cpp;jetfix/tests/store_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MDRecoverableConsumer.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/md2_tests.cpp;md/test/synthetic_book_merge_tests.cpp;mercury/actors/IPollableActor.cpp;mercury/broker/Broker.cpp;mercury/broker/BrokerProxy.cpp;mercury/broker/ILocalBroker.cpp;mercury/broker/IRemoteBroker.cpp;mercury/common/mercury_common.cpp;mercury/events/TimerEvent.cpp;mercury/executor/Executor.cpp;mercury/topics/Topic.cpp;metrics/metrics.cpp;metrics/system_metrics.cpp;orderman/actors/AsyncFactory.cpp;orderman/actors/ExecutionGateway.cpp;orderman/actors/FillStore.cpp;orderman/actors/MDSupplementarySource.cpp;orderman/actors/OrderStore.cpp;orderman/actors/SODPosition.cpp;orderman/actors/SecuritySrc.cpp;orderman/actors/ServiceBridge.cpp;orderman/actors/order_manager/OrderBuilder.cpp;orderman/actors/order_manager/OrderManager.cpp;orderman/actors/order_manager/OrderServicesData.cpp;orderman/events/CancelRejectEvent.cpp;orderman/events/NewExecutionReportEvent.cpp;orderman/limiter/LimitStore.cpp;orderman/limiter/Limiter.cpp;orderman/limiter/ProductLimitNode.cpp;orderman/limiter/ProductLimitTree.cpp;orderman/limiter/SecurityLimitNode.cpp;orderman/limiter/SecurityLimitTree.cpp;orderman/limiter/tests/limit_tests.cpp;orderman/order_factory/DynamiLine truncated
|
||||
+20
-4
@@ -54,11 +54,27 @@ if(NOT old_config_proto_str STREQUAL config_proto_str)
|
||||
file(WRITE "${config_proto_file}" "${config_proto_str}")
|
||||
endif()
|
||||
|
||||
# copy defaults to output directory
|
||||
# generate static defaults
|
||||
set(config_defaults_file ${CMAKE_CURRENT_BINARY_DIR}/config_defaults.h)
|
||||
# Defaults cannot be a single string because the compiler complains about a string longer than 65k
|
||||
set(config_defaults_str "const char * config_static_defaults[] = { ")
|
||||
foreach (cfg_file_path ${Conf_Defaults})
|
||||
get_filename_component(cfg_file_name ${cfg_file_path} NAME)
|
||||
configure_file(${cfg_file_path} ${CMAKE_BINARY_DIR}/src/server/sparkd/defaults/${cfg_file_name})
|
||||
file(READ ${cfg_file_path} cfg_file_content)
|
||||
string(REPLACE "\"" "\\\"" cfg_file_content_escaped ${cfg_file_content})
|
||||
string(REPLACE "\n" ";" cfg_lines ${cfg_file_content_escaped})
|
||||
foreach(line ${cfg_lines})
|
||||
string(APPEND config_defaults_str "\n \"${line}\",")
|
||||
endforeach(line)
|
||||
endforeach(cfg_file_path)
|
||||
string(APPEND config_defaults_str "};")
|
||||
set(old_defaults_str "")
|
||||
if(EXISTS ${config_defaults_file})
|
||||
file(READ ${config_defaults_file} old_defaults_str)
|
||||
endif()
|
||||
if(NOT config_defaults_str STREQUAL old_defaults_str)
|
||||
file(WRITE "${config_defaults_file}" "${config_defaults_str}")
|
||||
endif()
|
||||
|
||||
|
||||
# lib
|
||||
if (WIN32)
|
||||
@@ -125,4 +141,4 @@ if (WIN32)
|
||||
include(${CMAKE_SOURCE_DIR}/tools/vs_filters.cmake)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ message GatewayLoginResult {
|
||||
bool is_valid = 1;
|
||||
string reason = 2;
|
||||
string token = 3;
|
||||
bool can_create = 4;
|
||||
}
|
||||
message GatewayCallHeader {
|
||||
int32 request_id = 1;
|
||||
|
||||
@@ -25,14 +25,9 @@ namespace {{package}}
|
||||
// {{comment}}
|
||||
public partial class {{name}}_Excel : IDisposable
|
||||
{
|
||||
readonly static Lazy<{{name}}> _service = new Lazy<{{name}}>(() => locate<{{name}}>(), true);
|
||||
static T locate<T>() where T : class, IApiClient
|
||||
{
|
||||
using (var ctx = new api.core.ServiceContext())
|
||||
{
|
||||
return ctx.locate<T>();
|
||||
}
|
||||
}
|
||||
readonly static object _lock = new object();
|
||||
readonly static Lazy<{{name}}> _service = new Lazy<{{name}}>(() => bts.api.Locator.locate<{{name}}>(), true);
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
@@ -80,6 +75,54 @@ public void Dispose()
|
||||
|
||||
{{#unless skip_excel_generation}}
|
||||
|
||||
[ExcelFunction(Category = "BTS", Description = "Call BTS Spark {{../lname}} API Method {{lname}} with parameter {{input_type_full}}")]
|
||||
async public static void spark_{{../lname}}_{{lname}}_async (object[,] parameters, ExcelAsyncHandle handle, bool show_headers = false, bool display_vertically = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
Google.Protobuf.IMessage req = null;
|
||||
{{input_type_full}} casted_req = null;
|
||||
try
|
||||
{
|
||||
if(parameters.Rank == 2 && parameters.GetLength(0) == 1 && parameters.GetLength(1) == 1)
|
||||
{
|
||||
if(parameters[0,0] == ExcelMissing.Value)
|
||||
req = (Google.Protobuf.IMessage) Activator.CreateInstance(typeof({{input_type_full}}));
|
||||
else if(parameters[0,0] is string json)
|
||||
req = APIDispatch.generate_imessage(typeof({{input_type_full}}), json);
|
||||
}
|
||||
if(req == null)
|
||||
{
|
||||
string json = JsonFormatter.parse_json(typeof({{input_type_full}}), parameters);
|
||||
req = APIDispatch.generate_imessage(typeof({{input_type_full}}), json);
|
||||
}
|
||||
casted_req = ({{input_type_full}}) req;
|
||||
}
|
||||
catch
|
||||
{
|
||||
var members = bts.excel.extensions.ReflectionExtensions
|
||||
.get_fields_or_properties(typeof({{input_type_full}}))
|
||||
.Where(x => !DataParser.excluded_member(x));
|
||||
handle.SetResult(
|
||||
"Error in calling method {{lname}}( {{input_type_full}} ), input members are: " +
|
||||
string.Join(",", members.Select(x => x.Name).ToArray())
|
||||
);
|
||||
}
|
||||
|
||||
var res = await _service.Value.{{name}}_async( casted_req );
|
||||
object res_res = res.value;
|
||||
object[,] scattered = new JsonFormatter(res_res).format(show_headers);
|
||||
if(display_vertically)
|
||||
scattered = bts.excel.Utilities.transpose_keep_dimension(scattered);
|
||||
handle.SetResult(scattered);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Trace.TraceError(ex.ToString());
|
||||
handle.SetException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
[ExcelFunction(Category = "BTS", Description = "Call BTS Spark {{../lname}} API Method {{lname}} with parameter {{input_type_full}}")]
|
||||
public static object spark_{{../lname}}_{{lname}} (object[,] parameters, bool show_headers = false, bool display_vertically = false)
|
||||
{
|
||||
@@ -113,7 +156,7 @@ public void Dispose()
|
||||
.Where(x => !DataParser.excluded_member(x));
|
||||
return "Error in calling method {{lname}}( {{input_type_full}} ), input members are: " +
|
||||
string.Join(",", members.Select(x => x.Name).ToArray());
|
||||
}
|
||||
}
|
||||
{{/unless}}
|
||||
|
||||
{{/if}}
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
#include "lib/config/protos/cme_reference_data.pb.h"
|
||||
#include "lib/config/protos/jetfix.pb.h"
|
||||
#include "lib/config/config.h"
|
||||
#include "lib/config/protos/system.pb.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
|
||||
namespace bts{
|
||||
namespace admin{
|
||||
@@ -83,8 +86,7 @@ AdminServiceUtils::resolve_cme_connection(const bts::api::admin::AdminData& data
|
||||
const bts::api::admin::ExchangeConnection*
|
||||
AdminServiceUtils::resolve_sim_connection(const bts::api::admin::AdminData& data,
|
||||
const bts::api::admin::BTSAccount& account,
|
||||
const bts::api::Security& sec){
|
||||
bts_assert(sec.exchange() == api::Venue::VENUE_SIM);
|
||||
const bts::api::Security& ){
|
||||
if(account.has_connections())
|
||||
for (const std::string& conn_name : account.connections().exchange_connection_names()){
|
||||
const bts::api::admin::ExchangeConnection* conn = find_connection(data, conn_name);
|
||||
@@ -100,24 +102,30 @@ AdminServiceUtils::resolve_connection(const bts::api::admin::AdminData& data,
|
||||
const bts::api::Security& sec){
|
||||
const bts::api::admin::ExchangeConnection* rv = nullptr;
|
||||
switch(sec.exchange()){
|
||||
case api::Venue::VENUE_GLBX:
|
||||
rv = resolve_cme_connection(data, account, sec);
|
||||
break;
|
||||
case api::Venue::VENUE_UNSET:
|
||||
case api::Venue::VENUE_BTS:
|
||||
case api::Venue::VENUE_SIM:
|
||||
case api::Venue::VENUE_GLBX: {
|
||||
auto deployment_type =
|
||||
boost::to_lower_copy(config::get<config::DeploymentType>().type());
|
||||
rv = resolve_cme_connection(data, account, sec);
|
||||
if (rv == nullptr && (deployment_type == "dev" ||
|
||||
deployment_type == "demo"))
|
||||
rv = resolve_sim_connection(data, account, sec);
|
||||
break;
|
||||
case api::Venue::VENUE_CBOE:
|
||||
case api::Venue::VENUE_CBOECFE:
|
||||
case api::Venue::VENUE_ICE:
|
||||
case api::Venue::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
|
||||
break;
|
||||
}
|
||||
case api::Venue::VENUE_UNSET:
|
||||
case api::Venue::VENUE_BTS:
|
||||
case api::Venue::VENUE_SIM:
|
||||
rv = resolve_sim_connection(data, account, sec);
|
||||
break;
|
||||
case api::Venue::VENUE_CBOE:
|
||||
case api::Venue::VENUE_CBOECFE:
|
||||
case api::Venue::VENUE_ICE:
|
||||
case api::Venue::Venue_INT_MIN_SENTINEL_DO_NOT_USE_:
|
||||
case api::Venue::Venue_INT_MAX_SENTINEL_DO_NOT_USE_:
|
||||
rv = nullptr;
|
||||
break;
|
||||
rv = nullptr;
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////
|
||||
// connection mutators /////////////////////
|
||||
////////////////////////////////////////////
|
||||
@@ -838,12 +846,35 @@ void AdminServiceUtils::find_user_trading_accounts (const bts::api::admin::Admin
|
||||
const bts::api::admin::UserAccountPermissions* user_perm_ptr = get_user_permissions (admin_data, user_id);
|
||||
if (user_perm_ptr != nullptr)
|
||||
for(auto it=user_perm_ptr->account_permissions().begin(); it!=user_perm_ptr->account_permissions().end(); it++)
|
||||
if (it->second.has_trading_permission()){
|
||||
if (it->second.has_trading_permission() && it->second.trading_permission().has_permissions()){
|
||||
const api::admin::BTSAccount* account_ptr = find_account(admin_data, it->first);
|
||||
if (account_ptr != nullptr)
|
||||
associated_accounts.push_back(account_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
// for a given account, fills in the associated_users ref arg
|
||||
// with the users that can trade into the account
|
||||
void AdminServiceUtils::find_users_for_trading_account (const AdminData& admin_data,
|
||||
uint32_t account_id,
|
||||
std::vector<const BTSUser*>& associated_users)
|
||||
{
|
||||
for(const auto& u : AdminServiceUtils::users(admin_data, false))
|
||||
{
|
||||
const auto user_perm_ptr = get_user_permissions (admin_data, u->id());
|
||||
if (user_perm_ptr)
|
||||
{
|
||||
const auto& permission_unit = user_perm_ptr->account_permissions().find(account_id);
|
||||
if(permission_unit != user_perm_ptr->account_permissions().end() && permission_unit->second.has_trading_permission() &&
|
||||
permission_unit->second.trading_permission().has_permissions())
|
||||
{
|
||||
associated_users.push_back(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AdminServiceUtils::validate_user_update (const bts::api::admin::AdminData& admin_data,
|
||||
const bts::api::admin::BTSUser& updated_user,
|
||||
bts::api::admin::AdminServiceOperationResult& result){
|
||||
@@ -883,7 +914,7 @@ void AdminServiceUtils::get_md_entitlement_report(const AdminData& admin_data,
|
||||
admin_data);
|
||||
if(cme_data!=nullptr){
|
||||
for (const auto& cme_mic_data : cme_data->md_permissions()){
|
||||
MDEntitlementReportUnit rv=get_cme_md_entitlement_unit(user.name(),
|
||||
MDEntitlementReportUnit rv=get_cme_md_entitlement_unit(user,
|
||||
cme_mic_data);
|
||||
entitlements.push_back(rv);
|
||||
}
|
||||
@@ -891,10 +922,11 @@ void AdminServiceUtils::get_md_entitlement_report(const AdminData& admin_data,
|
||||
}
|
||||
}
|
||||
MDEntitlementReportUnit AdminServiceUtils::get_cme_md_entitlement_unit(
|
||||
const std::string& user,
|
||||
const BTSUser& user,
|
||||
const CMEMicData& cme_mic_data){
|
||||
MDEntitlementReportUnit rv;
|
||||
rv.set_user(user);
|
||||
rv.set_user(user.name());
|
||||
rv.set_user_id(user.id());
|
||||
rv.set_exchange("GLBX");
|
||||
switch(cme_mic_data.mic())
|
||||
{
|
||||
@@ -966,6 +998,8 @@ bts::api::admin::BTSUser* AdminServiceUtils::create_user (bts::api::admin::Admin
|
||||
uint32_t parent_group_id,
|
||||
const std::string& name,
|
||||
const std::string& password,
|
||||
const std::string& full_name,
|
||||
const std::string& company,
|
||||
bool is_active,
|
||||
const bts::api::admin::LicenseData& license_data,
|
||||
const bts::api::admin::LicenseEntitlements& license_entitlements,
|
||||
@@ -991,6 +1025,8 @@ bts::api::admin::BTSUser* AdminServiceUtils::create_user (bts::api::admin::Admin
|
||||
new_user_ptr->set_parent_group_id(parent_group_id);
|
||||
new_user_ptr->set_name(name);
|
||||
new_user_ptr->set_password (password);
|
||||
new_user_ptr->set_full_name (full_name);
|
||||
new_user_ptr->set_company (company);
|
||||
new_user_ptr->set_is_active(is_active);
|
||||
new_user_ptr->mutable_license_data()->CopyFrom(license_data);
|
||||
new_user_ptr->mutable_license_entitlements()->CopyFrom(license_entitlements);
|
||||
@@ -1260,13 +1296,14 @@ void AdminServiceUtils::bootstrap_data (bts::api::admin::AdminData& data){
|
||||
auto def_group = create_group(data, 0, std::string("default"), result);
|
||||
// adding users to the group
|
||||
bts::api::admin::LicenseData license_data;
|
||||
bts::api::admin::LicenseEntitlements license_entitlements;
|
||||
auto user_1 = create_user(data, def_group->id(), std::string("bts"), std::string(""), false, license_data, license_entitlements, user_result); user_1->set_is_active(true);
|
||||
auto user_2 = create_user(data, def_group->id(), std::string("bts_2"), std::string("bts_2"), false, license_data, license_entitlements, user_result); user_2->set_is_active(true);
|
||||
auto user_3 = create_user(data, def_group->id(), std::string("bts_3"), std::string("bts_3"), false, license_data, license_entitlements, user_result); user_3->set_is_active(true);
|
||||
bts::api::admin::LicenseEntitlements license_entitlements; std::string empty("");
|
||||
auto user_1 = create_user(data, def_group->id(), std::string("bts"), std::string(""), empty, empty, false, license_data, license_entitlements, user_result); user_1->set_is_active(true);
|
||||
auto user_2 = create_user(data, def_group->id(), std::string("bts_2"), std::string("bts_2"), empty, empty, false, license_data, license_entitlements, user_result); user_2->set_is_active(true);
|
||||
auto user_3 = create_user(data, def_group->id(), std::string("bts_3"), std::string("bts_3"), empty, empty, false, license_data, license_entitlements, user_result); user_3->set_is_active(true);
|
||||
//associate users
|
||||
bts::api::admin::UserAccountPermissionUnit permission_unit;
|
||||
permission_unit.mutable_trading_permission()->set_submit_market_orders(true);
|
||||
permission_unit.mutable_trading_permission()->set_has_permissions(true);
|
||||
permission_unit.mutable_admin_permission()->set_has_permissions(true);
|
||||
bts::api::admin::UserAccountPermissions account_permissions;
|
||||
account_permissions.mutable_account_permissions()->insert(google::protobuf::MapPair<uint32_t, bts::api::admin::UserAccountPermissionUnit>(parent_account->id(), permission_unit));
|
||||
|
||||
@@ -217,6 +217,12 @@ public:
|
||||
const AdminData& admin_data,
|
||||
uint32_t user_id,
|
||||
std::vector<const BTSAccount*>& associated_accounts);
|
||||
// for a given account, fills in the associated_users ref arg
|
||||
// with the users that can trade into the account
|
||||
static void find_users_for_trading_account (
|
||||
const AdminData& admin_data,
|
||||
uint32_t account_id,
|
||||
std::vector<const BTSUser*>& associated_users);
|
||||
// validates that changes in user data satisfy all the
|
||||
// constraints
|
||||
static void validate_user_update (const AdminData& admin_data,
|
||||
@@ -230,7 +236,7 @@ public:
|
||||
std::vector<MDEntitlementReportUnit>& entitlements);
|
||||
// Gets a reporting unit out of CMEMicData
|
||||
static MDEntitlementReportUnit get_cme_md_entitlement_unit(
|
||||
const std::string& user,
|
||||
const BTSUser& user,
|
||||
const CMEMicData& cme_mic_data);
|
||||
static void get_user_symbol_permissions(
|
||||
const AdminData& data,
|
||||
@@ -243,6 +249,8 @@ public:
|
||||
uint32_t parent_group_id,
|
||||
const std::string& name,
|
||||
const std::string& password,
|
||||
const std::string& full_name,
|
||||
const std::string& company,
|
||||
bool is_active,
|
||||
const LicenseData& license_data,
|
||||
const LicenseEntitlements& license_entitlements,
|
||||
|
||||
@@ -54,9 +54,12 @@ message BTSUser{
|
||||
uint32 parent_group_id = 20;
|
||||
string name = 30;
|
||||
string password = 40;
|
||||
string full_name = 42;
|
||||
string company = 44;
|
||||
bool is_active = 50;
|
||||
LicenseData license_data = 60;
|
||||
LicenseEntitlements license_entitlements = 70;
|
||||
bool can_create = 55;
|
||||
LicenseData license_data = 60; //unused
|
||||
LicenseEntitlements license_entitlements = 70; //unused
|
||||
BTSUserDerivableData user_data = 80;
|
||||
}
|
||||
|
||||
@@ -89,21 +92,23 @@ message LicenseEntitlements{
|
||||
}
|
||||
|
||||
message AlgoTradingPermissionsUnit{
|
||||
bool submit_iceberg_orders = 10;
|
||||
bool submit_time_box_orders = 20;
|
||||
bool submit_spreader_orders = 30;
|
||||
bool submit_iceberg_orders = 10; //unused
|
||||
bool submit_time_box_orders = 20; //unused
|
||||
bool submit_spreader_orders = 30; //unused
|
||||
}
|
||||
|
||||
message TradingPermissionUnit{
|
||||
bool submit_market_orders = 10;
|
||||
bool submit_gtc_orders = 20;
|
||||
AlgoTradingPermissionsUnit algo_trading_permission = 30;
|
||||
bool has_permissions = 5;
|
||||
bool submit_market_orders = 10; //unused
|
||||
bool submit_gtc_orders = 20; //unused
|
||||
AlgoTradingPermissionsUnit algo_trading_permission = 30; //unused
|
||||
}
|
||||
|
||||
message AdminPermissionUnit{
|
||||
// TODO: needs to be more ellaborate (account writing,
|
||||
// reading etc, routing etc)
|
||||
bool has_permissions = 10;
|
||||
bool has_md_permissions = 20;
|
||||
}
|
||||
|
||||
// this is the functionality permissions
|
||||
@@ -113,6 +118,7 @@ message UserAccountPermissionUnit{
|
||||
}
|
||||
|
||||
message UserAccountPermissions{
|
||||
//uint32 = account_id
|
||||
map<uint32, UserAccountPermissionUnit> account_permissions = 10;
|
||||
}
|
||||
|
||||
@@ -141,6 +147,12 @@ message BTSAccount{
|
||||
AccountSecurityClipLimits security_clip_limits = 90;
|
||||
AccountExchangeConnections connections = 100;
|
||||
ExchangeAccountData exchange_account_data = 110;
|
||||
// extra parameters for risk enforcement
|
||||
RiskLimitEnforcement risk_limit_enforcement=120;
|
||||
}
|
||||
|
||||
message RiskLimitEnforcement{
|
||||
bool product_limit_in_net_terms = 10;
|
||||
}
|
||||
|
||||
message AccountProductPositionLimitUnit{
|
||||
@@ -277,6 +289,18 @@ message SIMAccountData {
|
||||
string clearing_account = 40;
|
||||
}
|
||||
|
||||
enum ProfessionalDesignation
|
||||
{
|
||||
PROFESSIONALDESIGNATION_PRO = 0;
|
||||
PROFESSIONALDESIGNATION_NONPRO = 1;
|
||||
}
|
||||
|
||||
enum DisplayDesignation
|
||||
{
|
||||
DISPLAYDESIGNATION_DISPLAY = 0;
|
||||
DISPLAYDESIGNATION_NONDISPLAY = 1;
|
||||
}
|
||||
|
||||
message CMEUserData{
|
||||
string operator_id = 10;
|
||||
string ats_operator_id = 20;
|
||||
@@ -287,7 +311,11 @@ message CMEUserData{
|
||||
string smp_instruction = 70;
|
||||
string max_order_rate_per_connection = 80;
|
||||
string location = 90;
|
||||
// add suff here
|
||||
ProfessionalDesignation pro_nonpro = 100;
|
||||
DisplayDesignation display_nondisplay = 110;
|
||||
|
||||
enum AdminDisplay { All = 0; MD = 1; Routing = 2; None = 100; }
|
||||
AdminDisplay admin_display_flag = 120;
|
||||
repeated CMEMicData md_permissions = 1000;
|
||||
}
|
||||
|
||||
@@ -371,6 +399,7 @@ message OrderCancelRequest{
|
||||
message MDEntitlementReportUnit{
|
||||
string record_id = 1 [(bts.api.key)=true];
|
||||
string user = 10;
|
||||
uint32 user_id=11;
|
||||
string exchange = 20;
|
||||
string mic = 30;
|
||||
bool enabled = 40;
|
||||
@@ -394,6 +423,7 @@ message AccountCreateAPIArgument{
|
||||
uint32 parent_account_id = 10;
|
||||
string account_name = 20;
|
||||
string description = 30;
|
||||
string creator_user = 40;
|
||||
}
|
||||
message AccountUpdateAPIArgument{
|
||||
BTSAccount complete_data=10;
|
||||
@@ -402,6 +432,8 @@ message UserCreateAPIArgument{
|
||||
uint32 parent_group_id = 20;
|
||||
string name = 30;
|
||||
string password = 40;
|
||||
string full_name = 42;
|
||||
string company = 44;
|
||||
LicenseData license_data = 50;
|
||||
LicenseEntitlements license_entitlements = 70;
|
||||
}
|
||||
@@ -427,6 +459,10 @@ message AdminServiceCreateAccountResult {
|
||||
uint32 new_id = 30;
|
||||
}
|
||||
|
||||
message FilteredAdminDataRequest {
|
||||
string token = 1;
|
||||
}
|
||||
|
||||
service AdminService {
|
||||
option (bts.api.service_description) = "Provides a management interface to the user model";
|
||||
// account
|
||||
@@ -440,6 +476,7 @@ service AdminService {
|
||||
// subscription
|
||||
rpc admin_data(bts.api.VoidMessage) returns (stream AdminData);
|
||||
rpc get_admin_data(bts.api.VoidMessage) returns (AdminData);
|
||||
rpc get_filtered_admin_data(FilteredAdminDataRequest) returns (AdminData);
|
||||
// orders
|
||||
rpc get_order_summary(bts.api.VoidMessage) returns (OrdersSummary);
|
||||
rpc cancel_orders(OrderCancelRequest) returns (bts.api.VoidMessage);
|
||||
|
||||
@@ -204,7 +204,7 @@ message OrderState {
|
||||
CoverOrderState cover = 22;
|
||||
OffsetOrderState offset = 24;
|
||||
|
||||
DynamicOrderState dynamic = 1000;
|
||||
DynamicOrderState dynamic = 255; // do not use anything bigger than 255, or things will break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ message LimitOrderState {NativeOrderState native_state = 1;}
|
||||
message StopOrderState {NativeOrderState native_state = 1;}
|
||||
message StopLimitOrderState {NativeOrderState native_state = 1;}
|
||||
message IcebergOrderState {}
|
||||
message SpreaderOrderState {SpreaderChildKind child_kind = 1;}
|
||||
message SpreaderOrderState {}
|
||||
message TimeBoxOrderState {}
|
||||
message TickOrderState {}
|
||||
message LeanOrderState {}
|
||||
@@ -276,9 +276,7 @@ message TopOrderState {}
|
||||
message TriggerOrderState {}
|
||||
message CoverOrderState {}
|
||||
message OffsetOrderState {}
|
||||
message DynamicOrderState {
|
||||
map<string,string> state = 1;
|
||||
}
|
||||
message DynamicOrderState {}
|
||||
|
||||
enum OrderStatus {
|
||||
|
||||
@@ -403,12 +401,6 @@ enum ExecType
|
||||
EXEC_TYPE_TRADE_CANCEL = 72 ;
|
||||
}
|
||||
|
||||
enum SpreaderChildKind {
|
||||
SPREADER_CHILD_KIND_UNDEFINED = 0;
|
||||
SPREADER_CHILD_KIND_SPREADER_HEDGING = 1;
|
||||
SPREADER_CHILD_KIND_SPREADER_QUOTING = 2;
|
||||
}
|
||||
|
||||
enum OrderError
|
||||
{
|
||||
ORDER_ERROR_UNDEFINED = 0;
|
||||
|
||||
@@ -47,6 +47,7 @@ message AuthenticateLoginResponse {
|
||||
string reason = 2;
|
||||
AuthToken token = 3;
|
||||
uint32 user_id = 4;
|
||||
bool can_create = 5;
|
||||
}
|
||||
message AuthenticateTokenRequest {AuthToken token = 1;}
|
||||
message AuthenticateTokenResponse {bool is_valid = 1; string reason = 2; User user = 3;}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include "lib/config_proto_files.h"
|
||||
#include "lib/config_defaults.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -77,12 +78,6 @@ ConfigurationState::~ConfigurationState(void)
|
||||
{
|
||||
}
|
||||
|
||||
std::string ConfigurationState::defaults_path()
|
||||
{
|
||||
std::string appdir = os::get_install_path();
|
||||
return appdir + "/defaults/";
|
||||
}
|
||||
|
||||
std::string get_command_argument(const char* key)
|
||||
{
|
||||
std::vector<std::string> cmd_line = os::get_command_line();
|
||||
@@ -127,18 +122,18 @@ void ConfigurationState::initialize_defaults(IConfigLog& log)
|
||||
|
||||
std::shared_ptr<proto::Message> new_message(_prototype->New());
|
||||
ErrorsOnlyLog elog(log);
|
||||
load_message(defaults_path(), *new_message.get(), elog, *_deferred_queue.get());
|
||||
|
||||
std::string defaults;
|
||||
for (const char* str : config_static_defaults) {
|
||||
defaults += str;
|
||||
defaults += "\n";
|
||||
}
|
||||
|
||||
proto::io::ArrayInputStream input_stream(defaults.c_str(), (int)defaults.length());
|
||||
parse_stream("static_defaults.conf", input_stream, *new_message.get(), elog, *_deferred_queue.get());
|
||||
_defaults = new_message;
|
||||
|
||||
// If defaults has an include process that now
|
||||
// FEATURE: Unlike settings loaded from ~/sparkdata/ these includes
|
||||
// take precedence over the settings in the file which includes them.
|
||||
// While this seems backwards it is always the behavior you want
|
||||
std::string include = get_include(*_defaults.get());
|
||||
if (!include.empty())
|
||||
{
|
||||
load(include, "", log);
|
||||
}
|
||||
// do not process 'include' for static defaults
|
||||
|
||||
_is_initialized = true;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ namespace internal {
|
||||
void generate_all_config_proto(IConfigLog&);
|
||||
const proto::Message* try_get_value(const std::string& field_name, const proto::Message& message) const;
|
||||
|
||||
std::string defaults_path();
|
||||
std::string settings_path();
|
||||
|
||||
bool _is_initialized;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
ExecutorCfg
|
||||
{
|
||||
value
|
||||
{
|
||||
# executor for latency sensitive code
|
||||
executor { affinity: 0 yield_cpu: false }
|
||||
|
||||
# normal executor
|
||||
executor { affinity: -1 yield_cpu: true }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,4 +8,5 @@ message OrdermanCfg {
|
||||
repeated string hosted_actor = 3;
|
||||
}
|
||||
repeated Executor executor = 1;
|
||||
optional uint32 default_iceberg_pause_secs = 2 [default = 0];
|
||||
}
|
||||
@@ -80,6 +80,10 @@ inline Price round_to_quote_price(api::Security const&sec, Price in, api::Side s
|
||||
else
|
||||
return Price(raw_round_to_quote_price(p,sec.contract_spec().low_tick(),side));
|
||||
}
|
||||
|
||||
// Looking to round md::IntPrice? Look in IntPrice.h
|
||||
|
||||
|
||||
// computes the difference between 2 prices in ticks.
|
||||
// the result is an a signed int so the order of args
|
||||
// matter, its second price - first price
|
||||
|
||||
@@ -53,7 +53,11 @@ enum CMEMics {
|
||||
}
|
||||
|
||||
enum ICEMics{
|
||||
ICE_FUTURES_CANADA=0;
|
||||
ICE_UNSET=0;
|
||||
ICE_US = 1;
|
||||
ICE_EU = 2;
|
||||
ICE_LIFFE = 3;
|
||||
ICE_CA = 4;
|
||||
}
|
||||
|
||||
enum Side {
|
||||
|
||||
@@ -163,6 +163,7 @@ void AsyncReader::dispatch ()
|
||||
|
||||
for (auto &msg : framed_msgs) {
|
||||
msg.set_trace(trace);
|
||||
LOG(Latency, Diag, "perf_event AsyncReader.on_fix");
|
||||
tracepoint(bts_trace, trace_order, (char *)"AsyncReader.on_fix", 0,
|
||||
msg.get_seq_num(), 0);
|
||||
me->sink.in_msg_raw (msg);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "lib/utils/TimeStamp.h"
|
||||
#include "lib/utils/bts_assert.h"
|
||||
#include "lib/utils/helper_macros.h"
|
||||
#include "lib/orderman/orderman_utils/PerfTraceLog.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <fstream>
|
||||
@@ -84,6 +83,7 @@ int SocketConnection::read(char *to_buffer, size_t read_count) {
|
||||
|
||||
bts_assert(_fd >= 0);
|
||||
auto result = ::read(_fd, to_buffer, read_count);
|
||||
LOG(Latency, Diag, "perf_event after_socket_read");
|
||||
if (_log && result > 0) {
|
||||
_in_log.write(to_buffer, result);
|
||||
_in_log.flush();
|
||||
@@ -123,18 +123,20 @@ int SocketConnection::write(WriteVec const &vec, size_t vec_size,
|
||||
trace.md_sn, s2s.microseconds());
|
||||
}
|
||||
|
||||
LOG(Latency, Diag, "perf_event before_socket_write");
|
||||
auto result = ::writev(_fd, iv, (int)vec_size);
|
||||
|
||||
if (trace.md.to_uint64()) {
|
||||
LOG(Latency, Info,
|
||||
"perf_event:tick_to_order s2s_us:{} fix_socket_r:{} md:{} "
|
||||
"perf_event:tick_to_order s2s_us:{} do_work_begin:{} fix_socket_r:{} "
|
||||
"md:{} "
|
||||
"md_src:{} spreader_on_book:{} spreader_modify_order:{} "
|
||||
"spreader_on_child_order_update:{} "
|
||||
"order_update:{} exe_gw:{} fix_socket_w:{} md_sn:{} order_key:{} "
|
||||
"send_fix_buffer:{}",
|
||||
s2s.microseconds(), trace_cpy.fix_socket_r.to_uint64(),
|
||||
trace_cpy.md.to_uint64(), trace_cpy.md_src.to_uint64(),
|
||||
trace_cpy.spreader_on_book.to_uint64(),
|
||||
s2s.microseconds(), trace_cpy.do_work_begin.to_uint64(),
|
||||
trace_cpy.fix_socket_r.to_uint64(), trace_cpy.md.to_uint64(),
|
||||
trace_cpy.md_src.to_uint64(), trace_cpy.spreader_on_book.to_uint64(),
|
||||
trace_cpy.spreader_modify_order.to_uint64(),
|
||||
trace_cpy.spreader_on_child_order_update.to_uint64(),
|
||||
trace_cpy.order_update.to_uint64(), trace_cpy.exe_gw.to_uint64(),
|
||||
@@ -145,19 +147,20 @@ int SocketConnection::write(WriteVec const &vec, size_t vec_size,
|
||||
|
||||
if (trace.fix_socket_r.to_uint64()) {
|
||||
LOG(Latency, Info,
|
||||
"perf_event:fill_to_order s2s_us:{} fix_socket_r:{} md:{} md_src:{} "
|
||||
"perf_event:fill_to_order s2s_us:{} do_work_begin:{} fix_socket_r:{} "
|
||||
"md:{} md_src:{} "
|
||||
"spreader_on_book:{} spreader_modify_order:{} "
|
||||
"spreader_on_child_order_update:{} "
|
||||
"order_update:{} exe_gw:{} fix_socket_w:{} md_sn:{} order_key:{} "
|
||||
"send_fix_buffer:{} ",
|
||||
s2s.microseconds(), trace_cpy.fix_socket_r.to_uint64(),
|
||||
trace_cpy.md.to_uint64(), trace_cpy.md_src.to_uint64(),
|
||||
trace_cpy.spreader_on_book.to_uint64(),
|
||||
s2s.microseconds(), trace_cpy.do_work_begin.to_uint64(),
|
||||
trace_cpy.fix_socket_r.to_uint64(), trace_cpy.md.to_uint64(),
|
||||
trace_cpy.md_src.to_uint64(), trace_cpy.spreader_on_book.to_uint64(),
|
||||
trace_cpy.spreader_modify_order.to_uint64(),
|
||||
trace_cpy.spreader_on_child_order_update.to_uint64(),
|
||||
trace_cpy.order_update.to_uint64(), trace_cpy.exe_gw.to_uint64(),
|
||||
trace_cpy.fix_socket_w.to_uint64(), trace_cpy.md_sn, trace.order_key,
|
||||
trace.send_fix_buffer.to_uint64());
|
||||
trace_cpy.fix_socket_w.to_uint64(), trace_cpy.md_sn, trace_cpy.order_key,
|
||||
trace_cpy.send_fix_buffer.to_uint64());
|
||||
_perf_log.log(trace_cpy);
|
||||
}
|
||||
|
||||
|
||||
@@ -394,6 +394,7 @@ void CoreGateway::sync_reader_disconnected(EventData const &) {
|
||||
}
|
||||
|
||||
void CoreGateway::sync_in_msg_raw(EventData const &ev) {
|
||||
LOG(Latency, Diag, "perf_event sync_in_msg_raw");
|
||||
switch (me->state) {
|
||||
case State::OFF:
|
||||
case State::PAUSED:
|
||||
@@ -412,6 +413,7 @@ void CoreGateway::sync_in_msg_raw(EventData const &ev) {
|
||||
}
|
||||
|
||||
void CoreGateway::sync_in_msg_sequenced(EventData const &ev) {
|
||||
LOG(Latency, Diag, "perf_event sync_in_msg_sequenced");
|
||||
switch (me->state) {
|
||||
case State::OFF:
|
||||
case State::PAUSED:
|
||||
|
||||
@@ -83,8 +83,10 @@ private:
|
||||
|
||||
void dispatch (InMsgBuffer const&in_msg) override
|
||||
{
|
||||
LOG(Latency, Diag, "perf_event JetFIXGateway::before_parse");
|
||||
msg.read (in_msg.data (),in_msg.size ());
|
||||
msg.set_trace(in_msg.trace());
|
||||
LOG(Latency, Diag, "perf_event JetFIXGateway::after_parse");
|
||||
handler (msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -467,6 +467,7 @@ void Session::on_hb(InMsgBuffer const &msg) {
|
||||
}
|
||||
|
||||
void Session::on_app(InMsgBuffer const &msg) {
|
||||
LOG(Latency, Diag, "perf_event on_app");
|
||||
switch (me->state) {
|
||||
case State::WLOGON:
|
||||
terminate_session(
|
||||
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
|
||||
~Logger()
|
||||
{
|
||||
#ifndef WIN32
|
||||
#ifdef false //This breaks .net core and windows
|
||||
assert(!_active);
|
||||
assert(_wcursor == 0);
|
||||
#endif
|
||||
|
||||
@@ -193,7 +193,7 @@ LoggingConfigPoller::~LoggingConfigPoller ()
|
||||
_poller.stop();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
namespace interop {
|
||||
|
||||
const char* intern(const char* str) {
|
||||
@@ -205,7 +205,11 @@ const char* intern(const char* str) {
|
||||
return *iter;
|
||||
}
|
||||
else {
|
||||
#ifdef _WIN32
|
||||
const char* v = _strdup(str);
|
||||
#else
|
||||
const char* v = strdup(str);
|
||||
#endif
|
||||
set.insert(v);
|
||||
return v;
|
||||
}
|
||||
@@ -218,7 +222,6 @@ extern "C" BTS_EXPORT void Logger_log (int level, int subsystem, const char *mes
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}}
|
||||
@@ -42,7 +42,8 @@ constexpr log::Subsystem Mercury {ExSim.ordinal+1 };
|
||||
constexpr log::Subsystem Testing {Mercury.ordinal+1 };
|
||||
constexpr log::Subsystem Latency {Testing.ordinal+1 };
|
||||
constexpr log::Subsystem DataFlow {Latency.ordinal+1 };
|
||||
constexpr log::Subsystem Plugin {DataFlow.ordinal+1 };
|
||||
constexpr log::Subsystem Plugin {DataFlow.ordinal+1 };
|
||||
constexpr log::Subsystem ClientSdk {Plugin.ordinal+1 };
|
||||
|
||||
struct LoggerHandle {
|
||||
LoggerHandle(LoggerHandle const&) = delete;
|
||||
@@ -54,6 +55,15 @@ struct LoggerHandle {
|
||||
Logger *logger;
|
||||
};
|
||||
|
||||
struct CharPtrWrapper
|
||||
{const char* ptr;};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream&s,CharPtrWrapper const&ptr)
|
||||
{
|
||||
s << ptr.ptr;
|
||||
return s;
|
||||
}
|
||||
|
||||
extern thread_local LoggerHandle _thread_logger;
|
||||
void configure_logging(LoggingConfig const&cfg);
|
||||
void configure_logging(bts::config::Logging const&cfg,bts::config::ThreadGroupCfg const&);
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
#include "MDPeriodicDumper.h"
|
||||
#include "lib/md/MDConsumer.h"
|
||||
#include "lib/utils/TimeStamp.h"
|
||||
#include "lib/utils/Dispatcher.h"
|
||||
#include "lib/utils/datetime.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
/*
|
||||
* Design considerations
|
||||
*
|
||||
* - We want this test to be 'fair'
|
||||
* - We want a manageable amount of data
|
||||
* -
|
||||
*/
|
||||
|
||||
struct Entry {
|
||||
uint32_t seq;
|
||||
MDConsumerHandle handle;
|
||||
std::unique_ptr<api::Security> security;
|
||||
};
|
||||
|
||||
std::string print_book(
|
||||
PrintFormat format,
|
||||
const Entry& e,
|
||||
utils::TimeStamp twrite,
|
||||
utils::TimeStamp tread,
|
||||
uint32_t seq,
|
||||
bool ambiguous,
|
||||
const std::array<PriceSize,COCONUT_MAX_DEPTH>& bid,
|
||||
const std::array<PriceSize,COCONUT_MAX_DEPTH>& ask) {
|
||||
|
||||
std::stringstream ss;
|
||||
if(format == PrintFormat::Human) {
|
||||
ss << std::endl;
|
||||
ss << e.security->glbx().security_desc() << " (" << e.handle.key() << ")" << std::endl;
|
||||
ss << "Sequence: " << seq;
|
||||
if (ambiguous) ss << "*";
|
||||
ss << std::endl;
|
||||
ss << "TWrit: " << twrite.to_uint64() << " ns" << std::endl;
|
||||
ss << "TRead: " << tread.to_uint64() << " ns" << std::endl;
|
||||
char buffer[512];
|
||||
|
||||
snprintf(buffer, 512, "%-5s %-14s | %-14s %-5s\n", "sz", "bid", "ask", "sz");
|
||||
ss << buffer;
|
||||
ss << "-------------------- - -------------------- \n";
|
||||
for (auto x = COCONUT_MAX_DEPTH; x != 0; --x) {
|
||||
auto a = ask[x-1];
|
||||
if (!os::is_nan(a.price())) {
|
||||
snprintf(buffer, 512, "%5s %14s | %14.7f %5d\n", "", "", a.price(), a.size());
|
||||
ss << buffer;
|
||||
}
|
||||
}
|
||||
ss << "-------------------- - -------------------- \n";
|
||||
for (uint32_t x = 0; x < COCONUT_MAX_DEPTH; ++x) {
|
||||
auto b = bid[x];
|
||||
if (!os::is_nan(b.price())) {
|
||||
snprintf(buffer, 512, "%5d %14.7f | \n", b.size(), b.price());
|
||||
ss << buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (format == PrintFormat::CSV) {
|
||||
// Symbol, Id, Sequence, Ambiguous, TWrite, TRead, BidBook, AskBook
|
||||
ss << e.security->glbx().security_desc() << ","
|
||||
<< e.security->id() << ","
|
||||
<< seq << ","
|
||||
<< (ambiguous ? "true," : "false,")
|
||||
<< twrite.to_uint64() << ","
|
||||
<< tread.to_uint64() << ",";
|
||||
for (size_t x = 0; x < COCONUT_MAX_DEPTH; ++x) {
|
||||
if (!bid[x].is_nan()) {
|
||||
ss << " " << std::setprecision(11) << bid[x].price() << "-";
|
||||
if (bid[x].implied_size() > 0) { ss << "*"; }
|
||||
ss << bid[x].size();
|
||||
}
|
||||
}
|
||||
ss << ",";
|
||||
for (size_t x = 0; x < COCONUT_MAX_DEPTH; ++x) {
|
||||
if (!ask[x].is_nan()) {
|
||||
ss << " " << std::setprecision(11) << ask[x].price() << "-";
|
||||
if (ask[x].implied_size() > 0) { ss << "*"; }
|
||||
ss << ask[x].size();
|
||||
}
|
||||
}
|
||||
ss << std::endl;
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
datetime::Date expiration(const api::Security& sec) {
|
||||
auto f = sec.future();
|
||||
return { (uint16_t)f.expiration_year(), (uint8_t)f.expiration_month(), (uint8_t)f.expiration_day() };
|
||||
}
|
||||
|
||||
std::vector<Entry> filter_entries(std::vector<Entry>& entries) {
|
||||
// Choose the front month for all symbols
|
||||
auto today = datetime::today();
|
||||
std::map<UserSymbol, Entry*> map;
|
||||
for (auto& e : entries) {
|
||||
auto type = securitytype_of(*e.security);
|
||||
// Only futures because front month is complicated
|
||||
if (type != api::SECURITYTYPE_FUTURE) continue;
|
||||
UserSymbol key { e.security->symbol(), e.security->exchange(), type };
|
||||
auto& current_entry = map[key];
|
||||
if (current_entry == nullptr) {
|
||||
current_entry = &e;
|
||||
}
|
||||
else {
|
||||
auto cur = expiration(*current_entry->security);
|
||||
auto next = expiration(*e.security);
|
||||
if (next > today && next < cur) {
|
||||
current_entry = &e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Entry> result;
|
||||
for (const auto& pair : map) {
|
||||
result.push_back(std::move(*pair.second));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void write_header(PrintFormat format, long seq_mod, const std::vector<Entry>& entries) {
|
||||
if (format == PrintFormat::Human) {
|
||||
std::cout << "Dumping every sequence % " << seq_mod << " == 0 for\n";
|
||||
std::cout << "Selected securities: " << std::endl;
|
||||
for (const auto& e : entries) {
|
||||
std::cout << e.security->glbx().security_desc() << std::endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// CSV header
|
||||
std::cout << "Symbol,Id,Sequence,Ambiguous,TWrite,TRead,BidBook,AskBook";
|
||||
// for (size_t x = 0; x < COCONUT_MAX_DEPTH; ++x) {
|
||||
// std::cout << "," << "Bid" << x << ", DirectBidSize" << x << ", ImpliedBidSize" << x;
|
||||
// }
|
||||
// for (size_t x = 0; x < COCONUT_MAX_DEPTH; ++x) {
|
||||
// std::cout << "," << "Ask" << x << ", AskSize" << x << ", ImpliedAskSize" << x;
|
||||
// }
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void run_periodic_dumper(const std::set<UserSymbol>& symbols, uint32_t seq_mod, PrintFormat format) {
|
||||
|
||||
MDConsumer consumer(symbols, nullptr);
|
||||
|
||||
// read all securities into a vector
|
||||
std::vector<Entry> entries;
|
||||
consumer.walk_security_list([&](const api::Security& sec, MDConsumerHandle handle) {
|
||||
entries.push_back({ 0, handle, std::make_unique<api::Security>(sec) });
|
||||
});
|
||||
|
||||
entries = filter_entries(entries);
|
||||
|
||||
write_header(format, seq_mod, entries);
|
||||
|
||||
auto& disp = utils::Dispatcher::background();
|
||||
|
||||
// spin around on the vector detecting changes
|
||||
std::array<PriceSize,COCONUT_MAX_DEPTH> bid,ask;
|
||||
while(true) {
|
||||
for(auto& e : entries) {
|
||||
auto sequence = e.handle.sequence();
|
||||
if (sequence != e.seq && sequence % seq_mod == 0) {
|
||||
e.seq = sequence;
|
||||
auto tread = TimeStamp::now();
|
||||
utils::TimeStamp twrite;
|
||||
e.handle.get_book(twrite, COCONUT_MAX_DEPTH, bid.data(), ask.data());
|
||||
auto seq2 = e.handle.sequence();
|
||||
// print book to stdout (async?)
|
||||
disp.post([=,&e]() {
|
||||
std::cout << print_book(format, e, twrite, tread, sequence, (sequence != seq2), bid, ask);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}}//ns
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "lib/md/UserSymbol.h"
|
||||
#include <set>
|
||||
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
enum class PrintFormat {
|
||||
Human,
|
||||
CSV
|
||||
};
|
||||
|
||||
void run_periodic_dumper(const std::set<UserSymbol>&, uint32_t seq_mod, PrintFormat format);
|
||||
|
||||
|
||||
}}//ns
|
||||
@@ -1,69 +0,0 @@
|
||||
#ifndef NO_CPP0X
|
||||
#include "MDPriceLantencyTester.h"
|
||||
#include "../MDConsumer.h"
|
||||
#include "lib/utils/Dispatcher.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
struct HandleData {
|
||||
MDConsumerHandle handle;
|
||||
utils::TimeStamp time;
|
||||
utils::TimeStamp last_price_change;
|
||||
float bid, ask;
|
||||
};
|
||||
|
||||
void run_md_price_latency_test(UserSymbol symbol) {
|
||||
set<UserSymbol> symbols;
|
||||
symbols.insert(symbol);
|
||||
std::shared_ptr<api::ISyntheticSecurityService> null;
|
||||
MDConsumer consumer(symbols, null);
|
||||
|
||||
vector<HandleData> handles;
|
||||
|
||||
consumer.walk_security_list([&](const Security&, MDConsumerHandle handle) {
|
||||
HandleData entry = { handle, TimeStamp(), TimeStamp(), 0, 0 };
|
||||
if (!entry.handle.is_initialized()) {
|
||||
cout << "Please start the md publisher before running this command." << endl;
|
||||
return;
|
||||
}
|
||||
handles.push_back(entry);
|
||||
});
|
||||
|
||||
cout << "key, sequence, handover, delta, bid price, ask price" << endl;
|
||||
while (true) {
|
||||
for(auto& entry : handles) {
|
||||
PriceSize bid, ask;
|
||||
if (entry.handle.get_direct_book(entry.time, 1, &bid, &ask) == HandleReadResult::SUCCESS) {
|
||||
auto bid_price = bid.price();
|
||||
auto ask_price = ask.price();
|
||||
if (bid_price != entry.bid || ask_price != entry.ask) {
|
||||
auto now = TimeStamp::now();
|
||||
auto handover = (now - entry.time);
|
||||
auto delta = (now - entry.last_price_change);
|
||||
entry.last_price_change = entry.time;
|
||||
entry.bid = bid_price;
|
||||
entry.ask = ask_price;
|
||||
utils::Dispatcher::background().post([=]() {
|
||||
cout <<
|
||||
entry.handle.key() << ','
|
||||
<< entry.handle.sequence() << ','
|
||||
<< handover.microseconds() << ','
|
||||
<< delta.microseconds() << ','
|
||||
<< bid_price << ',' << ask_price
|
||||
<< endl;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}}//namespace
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "lib/utils/bts_export.h"
|
||||
#include "../common.h"
|
||||
#include "../UserSymbol.h"
|
||||
#include <string>
|
||||
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
BTS_EXPORT void run_md_price_latency_test(UserSymbol);
|
||||
|
||||
|
||||
}}//namespace
|
||||
|
||||
@@ -116,6 +116,7 @@ string dump_security(const FixedSecurity& security) {
|
||||
auto& leg = psec->legs[x];
|
||||
if (x > 0) res << ",";
|
||||
res << "{ 'key': " << leg.key
|
||||
<< ", 'exkey': " << leg.exchange_key
|
||||
<< ", 'quantity': " << leg.leg_quantity
|
||||
<< ", 'leg_price': " << leg.leg_price
|
||||
<< ", 'delta': " << leg.leg_delta
|
||||
|
||||
+82
-10
@@ -1,10 +1,13 @@
|
||||
#pragma once
|
||||
#include "lib/utils/bts_assert.h"
|
||||
#include "lib/utils/bts_array_size.h"
|
||||
#include "lib/domain_model/Security.pb.h"
|
||||
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
const extern double NO_PRICE;
|
||||
|
||||
static const double powers_10[] = {
|
||||
1E-20, 1E-19, 1E-18, 1E-17, 1E-16, 1E-15, 1E-14, 1E-13, 1E-12, 1E-11, 1E-10, 1E-9, 1E-8, 1E-7, 1E-6, 1E-5, 1E-4, 1E-3, 1E-2, 1E-1,
|
||||
1E0,
|
||||
@@ -35,14 +38,12 @@ class IntPrice {
|
||||
IntPrice(const IntPrice& other) : _mantissa(other._mantissa), _exponent(other._exponent) {}
|
||||
|
||||
bool operator==(const IntPrice& other) const {
|
||||
// this requires both mantissa and exponent to be equal
|
||||
// logically 100*pow10(1) == 10*pow10(2)
|
||||
// HOWEVER, once converted to double there are subtelties that can make them not equal so
|
||||
// this function is conservative
|
||||
if(_exponent == other._exponent)
|
||||
if(_exponent == other._exponent) {
|
||||
return _mantissa == other._mantissa;
|
||||
else
|
||||
}
|
||||
else {
|
||||
return price()==other.price();
|
||||
}
|
||||
}
|
||||
bool operator!=(const IntPrice& other) const {
|
||||
return !(*this == other);
|
||||
@@ -65,16 +66,40 @@ class IntPrice {
|
||||
bts_assert_d(o.exponent() <= 0 && _exponent <= 0);
|
||||
if (o.exponent() < _exponent) {
|
||||
int8_t delta = _exponent - o.exponent();
|
||||
auto m = _mantissa * pow10(delta);
|
||||
return IntPrice(m - o.mantissa(), o.exponent());
|
||||
int64_t m = _mantissa * pow10(delta);
|
||||
return { m - o.mantissa(), o.exponent() };
|
||||
}
|
||||
else {
|
||||
int8_t delta = o.exponent() - _exponent;
|
||||
auto m = o.mantissa() * pow10(delta);
|
||||
return IntPrice(_mantissa - m, _exponent);
|
||||
int64_t m = o.mantissa() * pow10(delta);
|
||||
return { _mantissa - m, exponent() };
|
||||
}
|
||||
}
|
||||
}
|
||||
IntPrice operator + (const IntPrice& o) const {
|
||||
if (_exponent==o._exponent) {
|
||||
return IntPrice { _mantissa+o.mantissa(), exponent() };
|
||||
}
|
||||
else {
|
||||
if (is_nan() || o.is_nan()) return IntPrice();
|
||||
bts_assert_d(o.exponent() <= 0 && _exponent <= 0);
|
||||
if (o.exponent() < _exponent) {
|
||||
int8_t delta = _exponent - o.exponent();
|
||||
int64_t m = _mantissa * pow10(delta);
|
||||
return { m + o.mantissa(), o.exponent() };
|
||||
}
|
||||
else {
|
||||
int8_t delta = o.exponent() - _exponent;
|
||||
int64_t m = o.mantissa() * pow10(delta);
|
||||
return { _mantissa + m, exponent() };
|
||||
}
|
||||
}
|
||||
}
|
||||
IntPrice sign_extend(int8_t new_exponent) const {
|
||||
int8_t delta = _exponent - new_exponent;
|
||||
int64_t m = _mantissa * pow10(delta);
|
||||
return { m, new_exponent };
|
||||
}
|
||||
int64_t mantissa() const { return _mantissa; }
|
||||
int8_t exponent() const { return _exponent; }
|
||||
double price() const {
|
||||
@@ -85,6 +110,7 @@ class IntPrice {
|
||||
};
|
||||
static_assert(sizeof(IntPrice) == 8, "IntPrice should be this big |--------|");
|
||||
extern IntPrice INT_NAN;
|
||||
extern IntPrice INT_ZERO;
|
||||
|
||||
template <uint8_t PRECISION>
|
||||
IntPrice IntPrice_from_double(double price) {
|
||||
@@ -98,6 +124,52 @@ IntPrice IntPrice_from_double(double price) {
|
||||
}
|
||||
return {(int64_t)price, 0};
|
||||
}
|
||||
// inline IntPrice IntPrice_from_double(double price, int8_t precision) {
|
||||
// if (os::is_nan(price)) return INT_NAN;
|
||||
// return { (int64_t)(price * pow10(-precision)), precision };
|
||||
// }
|
||||
|
||||
inline md::IntPrice round_to_quote_price(const IntPrice& tick, const IntPrice& price, api::Side side) {
|
||||
bts_assert_d(tick.mantissa() != 0);
|
||||
if (price.is_nan()) return price;
|
||||
bts_assert_d(price.exponent() <= 0 && tick.exponent() <= 0);
|
||||
if (price.exponent() == tick.exponent()) {
|
||||
auto mod = price.mantissa() % tick.mantissa();
|
||||
if (mod == 0) return price;
|
||||
else if (side == api::SIDE_BUY) {
|
||||
// buy, round down
|
||||
if (price.mantissa() > 0) {
|
||||
return { price.mantissa() - mod, price.exponent() };
|
||||
}
|
||||
else {
|
||||
return { price.mantissa() - mod - tick.mantissa(), price.exponent() };
|
||||
}
|
||||
}
|
||||
else if (side == api::SIDE_SELL) {
|
||||
// sell, round up
|
||||
if (price.mantissa() > 0) {
|
||||
return { price.mantissa() - mod + tick.mantissa(), price.exponent() };
|
||||
}
|
||||
else {
|
||||
return { price.mantissa() - mod, price.exponent() };
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Uncommon path
|
||||
// Math is reversed because exponents are negative
|
||||
if (tick.exponent() < price.exponent()) {
|
||||
return round_to_quote_price(tick, price.sign_extend(tick.exponent()), side);
|
||||
}
|
||||
else {
|
||||
// Extend tick to price's exponent
|
||||
return round_to_quote_price(tick.sign_extend(price.exponent()), price, side);
|
||||
}
|
||||
}
|
||||
|
||||
return price;
|
||||
}
|
||||
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, const IntPrice& p) {
|
||||
os << p.price();
|
||||
|
||||
@@ -85,7 +85,7 @@ TimeStamp copy_depth(
|
||||
/////////////////////////////
|
||||
struct Level {
|
||||
double price;
|
||||
uint16_t size;
|
||||
double size;
|
||||
};
|
||||
struct DepthTraversal {
|
||||
std::array<Level, COCONUT_MAX_DEPTH> levels;
|
||||
@@ -100,42 +100,92 @@ struct DepthTraversal {
|
||||
levels[x].size = depth[x].size();
|
||||
}
|
||||
}
|
||||
double try_take1() {
|
||||
if (head >= levels.size()) return os::nan();
|
||||
if (levels[head].size >= qty) {
|
||||
levels[head].size -= qty;
|
||||
return levels[head].price * price_mult;
|
||||
}
|
||||
else {
|
||||
double price = 0;
|
||||
size_t count = 0;
|
||||
while(count < qty) {
|
||||
if (levels[head].size >= 1) {
|
||||
price += levels[head].price;
|
||||
levels[head].size -= 1;
|
||||
count += 1;
|
||||
}
|
||||
else {
|
||||
head++;
|
||||
if (head >= levels.size()) return os::nan();
|
||||
}
|
||||
}
|
||||
return (price / qty) * price_mult;
|
||||
#ifdef PRECISE_SYNTHETICS
|
||||
double available_size() const {
|
||||
double available = 0.0;
|
||||
auto cur = head;
|
||||
bool partial = false;
|
||||
while(cur < levels.size() && available < 1) {
|
||||
available += levels[cur].size / qty;
|
||||
if (available < 1.0) partial = true;
|
||||
++cur;
|
||||
}
|
||||
if (partial && available >= 1.0) return 1.0;
|
||||
return available;
|
||||
}
|
||||
double consume(double size) {
|
||||
bts_assert_d(size <= available_size());
|
||||
double take = size * qty;
|
||||
double price = 0.0;
|
||||
while(take > 0) {
|
||||
if (levels[head].size >= take) {
|
||||
price += levels[head].price * price_mult * (take/qty);
|
||||
levels[head].size -= take;
|
||||
if (levels[head].size <= 0) ++head;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
double available = levels[head].size;
|
||||
price += levels[head].price * price_mult * (available/qty);
|
||||
levels[head].size = 0;
|
||||
++head;
|
||||
take -= available;
|
||||
}
|
||||
}
|
||||
return price/size;
|
||||
}
|
||||
#else
|
||||
double available_size() const {
|
||||
double available = 0.0;
|
||||
auto cur = head;
|
||||
while(cur < levels.size() && available < 1) {
|
||||
available += levels[cur].size / qty;
|
||||
++cur;
|
||||
}
|
||||
return available;
|
||||
}
|
||||
double consume(double size) {
|
||||
bts_assert_d(size <= available_size());
|
||||
double take = size * qty;
|
||||
double price = 0.0;
|
||||
while(take > 0) {
|
||||
if (levels[head].size >= take) {
|
||||
price = levels[head].price * price_mult;
|
||||
levels[head].size -= take;
|
||||
if (levels[head].size <= 0) ++head;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
double available = levels[head].size;
|
||||
price = levels[head].price * price_mult;
|
||||
levels[head].size = 0;
|
||||
++head;
|
||||
take -= available;
|
||||
}
|
||||
}
|
||||
return price;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
void copy_depth(size_t count, api::Side side, const api::ContractSpecification& spec, small_vector<DepthTraversal>& leg_travs, Level* out_price) {
|
||||
void copy_synthetic_side(size_t count, api::Side side, const api::ContractSpecification& spec, small_vector<DepthTraversal>& leg_travs, Level* out_price) {
|
||||
size_t out_index = 0;
|
||||
bool first = true;
|
||||
while(out_index < count) {
|
||||
double price = 0.0;
|
||||
for (auto& dt : leg_travs) {
|
||||
double temp = dt.try_take1();
|
||||
price += temp;
|
||||
}
|
||||
|
||||
if (os::is_nan(price)) {
|
||||
double price = 0.0;
|
||||
// Find the leg with the minimum available size
|
||||
double size = std::numeric_limits<double>().max();
|
||||
|
||||
for (const auto& dt : leg_travs) {
|
||||
auto sz = dt.available_size();
|
||||
// If we can't get 1.0 from any leg we're done
|
||||
if (sz <= size) size = sz;
|
||||
if (size < 1.0) break;
|
||||
}
|
||||
size = (int64_t)size;
|
||||
|
||||
if (size < 1.0) {
|
||||
// We've run out of book so we nan out any remaining levels and finish
|
||||
size_t start = first ? out_index : out_index+1;
|
||||
for (size_t x=start; x < count; ++x) {
|
||||
@@ -145,6 +195,13 @@ void copy_depth(size_t count, api::Side side, const api::ContractSpecification&
|
||||
return;
|
||||
}
|
||||
|
||||
// Take that size from each leg
|
||||
for (auto& dt : leg_travs) {
|
||||
double temp = dt.consume(size);
|
||||
price += temp;
|
||||
}
|
||||
bts_assert_d(!os::is_nan(price));
|
||||
|
||||
// Round to tick size
|
||||
price = securities::checked_round_to_quote_price(spec, price, side);
|
||||
|
||||
@@ -154,19 +211,19 @@ void copy_depth(size_t count, api::Side side, const api::ContractSpecification&
|
||||
}
|
||||
|
||||
if (price == out_price[out_index].price) {
|
||||
out_price[out_index].size += 1;
|
||||
out_price[out_index].size += size;
|
||||
}
|
||||
else {
|
||||
out_index += 1;
|
||||
if (out_index < count) {
|
||||
out_price[out_index].price = price;
|
||||
out_price[out_index].size = 1;
|
||||
out_price[out_index].size = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TimeStamp copy_depth(const SyntheticStrategy& synth, size_t count, PriceSize* bid, PriceSize* ask) {
|
||||
TimeStamp copy_synthetic_depth(const SyntheticStrategy& synth, size_t count, PriceSize* bid, PriceSize* ask) {
|
||||
small_vector<DepthTraversal> bid_leg_travs;
|
||||
small_vector<DepthTraversal> ask_leg_travs;
|
||||
bid_leg_travs.reserve(synth.legs.size());
|
||||
@@ -210,12 +267,12 @@ TimeStamp copy_depth(const SyntheticStrategy& synth, size_t count, PriceSize* bi
|
||||
}
|
||||
std::array<Level, COCONUT_MAX_DEPTH> scratch {};
|
||||
const auto& spec = synth.security.contract_spec();
|
||||
copy_depth(count, api::SIDE_BUY, spec, bid_leg_travs, scratch.data());
|
||||
copy_synthetic_side(count, api::SIDE_BUY, spec, bid_leg_travs, scratch.data());
|
||||
for (size_t x = 0; x < count; ++x) {
|
||||
bid[x] = PriceSize_from_double<7>(scratch[x].price, scratch[x].size);
|
||||
}
|
||||
memset(scratch.data(), 0, sizeof(scratch));
|
||||
copy_depth(count, api::SIDE_SELL, spec, ask_leg_travs, scratch.data());
|
||||
copy_synthetic_side(count, api::SIDE_SELL, spec, ask_leg_travs, scratch.data());
|
||||
for (size_t x = 0; x < count; ++x) {
|
||||
ask[x] = PriceSize_from_double<7>(scratch[x].price, scratch[x].size);
|
||||
}
|
||||
@@ -305,17 +362,6 @@ CoconutSecurityStatus MDConsumerHandle::status() const {
|
||||
}
|
||||
never;
|
||||
}
|
||||
uint16_t MDConsumerHandle::sequence() const {
|
||||
switch(_type) {
|
||||
case HANDLETYPE_VOID: return 0;
|
||||
case HANDLETYPE_DEPTH: return book.hot->sequence;
|
||||
case HANDLETYPE_BBO: return bbo.hot->sequence;
|
||||
case HANDLETYPE_SYNTHETIC:
|
||||
bts_assert(!synthetic.def->legs.empty());
|
||||
return sane::min_by<MDConsumerHandle, TimeStamp>(synthetic.def->legs, [](const MDConsumerHandle& h) { return h.last_market_update(); })->sequence();
|
||||
}
|
||||
never;
|
||||
}
|
||||
|
||||
}}//namespace
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ struct SyntheticStrategy {
|
||||
|
||||
TimeStamp copy_bbo(const HotEntry& src, PriceSize& out_bid, PriceSize& out_ask);
|
||||
TimeStamp copy_depth(const HotDepthEntry&, size_t count, PriceSize* bid, PriceSize* ask);
|
||||
TimeStamp copy_depth(const SyntheticStrategy&, size_t count, PriceSize* bid, PriceSize* ask);
|
||||
TimeStamp copy_synthetic_depth(const SyntheticStrategy&, size_t count, PriceSize* bid, PriceSize* ask);
|
||||
|
||||
enum class HandleReadResult {
|
||||
NO_CHANGE,
|
||||
@@ -159,7 +159,17 @@ public:
|
||||
bool is_heart_beating() const;
|
||||
TimeStamp heartbeat() const;
|
||||
CoconutSecurityStatus status() const;
|
||||
uint16_t sequence() const;
|
||||
uint32_t sequence() const {
|
||||
switch(_type) {
|
||||
case HANDLETYPE_VOID: return 0;
|
||||
case HANDLETYPE_DEPTH: return book.hot->sequence;
|
||||
case HANDLETYPE_BBO: return bbo.hot->sequence;
|
||||
case HANDLETYPE_SYNTHETIC:
|
||||
bts_assert(!synthetic.def->legs.empty());
|
||||
return sane::min_by<MDConsumerHandle, TimeStamp>(synthetic.def->legs, [](const MDConsumerHandle& h) { return h.last_market_update(); })->sequence();
|
||||
}
|
||||
bts_assert(false);
|
||||
}
|
||||
security_key key() const {
|
||||
switch(_type) {
|
||||
case HANDLETYPE_VOID: return invalid_security_key;
|
||||
@@ -271,7 +281,7 @@ private:
|
||||
case HANDLETYPE_SYNTHETIC:
|
||||
auto t = last_market_update();
|
||||
if (t > time || t == TimeStamp::invalid()) {
|
||||
TimeStamp temp = copy_depth(*synthetic.def, std::min(copydepth, COCONUT_MAX_DEPTH), bids, asks);
|
||||
TimeStamp temp = copy_synthetic_depth(*synthetic.def, std::min(copydepth, COCONUT_MAX_DEPTH), bids, asks);
|
||||
if (temp == TimeStamp::invalid()) { return HandleReadResult::BUSY; }
|
||||
time = temp;
|
||||
return HandleReadResult::SUCCESS;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "lib/utils/WaitFreeQueue.h"
|
||||
#include "Shm/MDStructure.h"
|
||||
#include "MemorySegmentUtils.h"
|
||||
#include "SecurityIDRecorder.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -102,12 +103,21 @@ private:
|
||||
//
|
||||
|
||||
MDProducer::MDProducer(Platform platform, bool shared) :
|
||||
_mutex(new Mutex()),
|
||||
_mutex(new std::mutex()),
|
||||
_producers(),
|
||||
_id_recorder(),
|
||||
_platform(platform),
|
||||
_shared(shared)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
#ifndef WIN32
|
||||
MDProducer::MDProducer(Platform platform, SecurityIDRecorder recorder, bool shared) :
|
||||
_mutex(new std::mutex()),
|
||||
_producers(),
|
||||
_id_recorder(std::make_unique<SecurityIDRecorder>(recorder)),
|
||||
_platform(platform),
|
||||
_shared(shared)
|
||||
{ }
|
||||
#endif
|
||||
MDProducer::MDProducer(MDProducer&& other) :
|
||||
_mutex(std::move(other._mutex)),
|
||||
_producers(std::move(other._producers)),
|
||||
@@ -143,15 +153,18 @@ MDProducerImpl& MDProducer::get_producer(const char* symbol, SecurityType type,
|
||||
MDProducerHandle MDProducer::add_security(const FixedSecurity& security) {
|
||||
bts_assert_d(strlen(security.symbol()) > 0);
|
||||
bts_assert(security.size >= sizeof(FixedSecurity));
|
||||
Mutex::scoped_lock lock(*_mutex);
|
||||
std::lock_guard<std::mutex> lock(*_mutex);
|
||||
auto& impl = get_producer(security.symbol(), security.type, security.exchange);
|
||||
auto result = impl.add_security(security);
|
||||
if (security.key != invalid_security_key) { result.set_key(security.key); }
|
||||
else if(_id_recorder) {
|
||||
_id_recorder->ensure_key(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
MDProducerChannel MDProducer::get_channel(const char* symbol, SecurityType type, Venue exchange) {
|
||||
Mutex::scoped_lock lock(*_mutex);
|
||||
std::lock_guard<std::mutex> lock(*_mutex);
|
||||
return MDProducerChannel(get_producer(symbol, type, exchange));
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 232 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user