Merge branch 'master' of bitbucket.org:bluetradesys/spark into ice_exec3

This commit is contained in:
Kevin Darby committed 2019-09-16 17:09:52 -04:00
commit 48dfded132
49 files changed
+683 -204

No files matched your search

+16
View File
@@ -4,6 +4,22 @@ weight = 3
sort_by = "weight"
insert_anchor_links = "right"
+++
## 2.10.0
### User Visible Changes
- Fills now include information about the algo that originated the fill
### API Changes
- Added security state information (pre open, halted, normal, closed, etc)
## 2.9.1
### Bug Fixes
- Fixed an issue with trade sound alerts, where in some cases the use of a "In Between" condition could lead to a UI failure.
- Fixed an issue with the display of the new raw position column in the market view window.
- Fixed the popup label that describes the raw position information in the ladder
### Internal Changes
- Avoided shipping production configuration defaults that lead to trying to download a position file for the development sftp server.
### Api
- C# API sample now uses synchronous calls.
## 2.9.0
### User Visible Changes
- Improved Workspace management User Interface
+1 -1
View File
@@ -151,7 +151,7 @@ namespace mbts.ui {
public static ImageSource CheckMark => create_icon(CheckMarkGeometryKey);
public static ImageSource Clock { get { return load_resource_and_freeze("Clock"); } }
public static ImageSource CopyWF => create_icon(CopyWFGeometryKey);
public static ImageSource DataEdit => create_icon(DataEditGeometryKey, Brushes.White, new Pen(Brushes.Black, 1).frozen());
public static ImageSource DataEdit => create_icon(DataEditGeometryKey);
public static ImageSource Defrag { get { return load_resource_and_freeze("Defrag"); } }
public static ImageSource DetachAlgos => create_icon_and_rotate(DetachAlgosKey, Brushes.Red);
public static ImageSource Disk => create_icon(DiskGeometryKey);
+30 -32
View File
@@ -1,7 +1,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mbts="clr-namespace:mbts.ui"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
>
@@ -18,9 +18,7 @@
Ttile: Add free icon
Credit: Icon made by Gregor Cresnar from www.flaticon.com-->
<sys:String x:Key="{x:Static mbts:Icons.AddBoxesGeometryKey}">
M393,480.3c0-5-4.1-9.1-9.1-9.1H18.2V105.5c0-5-4.1-9.1-9.1-9.1S0,100.5,0,105.5v374.8c0,5,4.1,9.1,9.1,9.1h374.8 C388.9,489.4,393,485.3,393,480.3z
M373.9,187.5H302v-71.9c0-5-4.1-9.1-9.1-9.1s-9.1,4.1-9.1,9.1v71.9h-71.9c-5,0-9.1,4.1-9.1,9.1s4.1,9.1,9.1,9.1h71.9v71.9 c0,5,4.1,9.1,9.1,9.1s9.1-4.1,9.1-9.1v-71.9h71.9c5,0,9.1-4.1,9.1-9.1C382.9,191.5,378.9,187.5,373.9,187.5z
M105.5,393h374.8c5,0,9.1-4.1,9.1-9.1V9.1c0-5-4.1-9.1-9.1-9.1H105.5c-5,0-9.1,4.1-9.1,9.1v374.8 C96.4,388.9,100.5,393,105.5,393z M114.5,18.2h356.7v356.7H114.5V18.2z
M 87.5 10 C 80.313542 10 74.400391 15.913151 74.400391 23.099609 V 397.90039 C 74.400391 405.08685 80.313541 411 87.5 411 h 374.80078 c 7.18646 0 13.09961 -5.91315 13.09961 -13.09961 V 23.099609 C 475.40039 15.913151 469.48724 10 462.30078 10 Z m 13 26.199219 H 449.19922 V 384.90039 H 100.5 Z M 21.099609 76.400391 C 13.912943 76.400391 8 82.313333 8 89.5 v 374.80078 c 0 7.18667 5.912943 13.09961 13.099609 13.09961 H 395.90039 c 7.18667 0 13.09961 -5.91294 13.09961 -13.09961 0 -7.18667 -5.91294 -13.10156 -13.09961 -13.10156 H 34.199219 V 89.5 c 0 -7.186667 -5.912943 -13.099609 -13.09961 -13.099609 z M 274.90039 116.5 c -7.18667 0 -13.09961 5.91294 -13.09961 13.09961 V 197.5 h -67.90039 c -7.18667 0 -13.09961 5.91294 -13.09961 13.09961 0 7.18667 5.91294 13.09961 13.09961 13.09961 h 67.90039 v 67.90039 c 0 7.18667 5.91294 13.09961 13.09961 13.09961 7.18667 0 13.09961 -5.91294 13.09961 -13.09961 v -67.90039 h 67.90039 c 7.18667 0 13.09961 -5.91294 13.09961 -13.09961 v -0.0391 -0.0391 C 368.85982 203.37217 363.03372 197.5 355.90039 197.5 H 288 V 129.59961 C 288 122.41294 282.08706 116.5 274.90039 116.5 Z
</sys:String>
<!--File (the icon is free to use if we include this information in our credit section)
@@ -116,7 +114,7 @@
</sys:String>
<sys:String x:Key="{x:Static mbts:Icons.DataEditGeometryKey}">
M17.997977,17.396268C18.197928,17.396268,18.297904,17.496276,18.497975,17.596284L19.497972,18.295283C19.99797,18.595292,20.697919,19.195308,21.197917,19.495299L22.196937,20.195323C22.696935,20.495315,22.596959,20.995322,22.096961,21.195338L20.997966,21.695346C20.497968,21.89434,19.597947,22.294355,19.097949,22.494355L17.997977,22.994363C17.497979,23.194362,17.097957,22.894355,17.197932,22.394347L17.297908,21.195338C17.398005,20.595323,17.497979,19.695315,17.497979,19.195308L17.597955,17.995277C17.497979,17.695283,17.69793,17.396268,17.997977,17.396268z M1.799981,13.597213L19.697923,13.597213 17.997977,15.896244C17.797906,16.096259 17.69793,16.396253 17.69793,16.69626 17.197932,16.796268 16.79791,17.296275 16.697934,17.895284L16.597959,19.195308 1.799981,19.195308C0.79998477,19.195308,0,18.395291,0,17.396268L0,15.396237C0,14.396221,0.79998477,13.597213,1.799981,13.597213z M1.799981,6.7981106L21.796914,6.7981106C22.696935,6.7981106,23.49698,7.498118,23.596955,8.3981257L20.697919,12.397197 1.799981,12.397197C0.79998477,12.397197,0,11.597181,0,10.597165L0,8.5981418C0,7.598126,0.79998477,6.7981106,1.799981,6.7981106z M27.796891,4.3990708C27.996963,4.3990708,28.096938,4.3990708,28.296889,4.5990711L31.695924,7.0981179C31.995851,7.3981105,32.095948,7.7981258,31.895875,8.0981341L23.296908,19.795308C23.096957,20.095315,22.596959,20.195323,22.196937,19.895314L18.797902,17.396268C18.497975,17.096274,18.398002,16.69626,18.597951,16.396253L27.196918,4.6990786C27.396869,4.4990784,27.59694,4.3990708,27.796891,4.3990708z M1.799981,0L21.796914,0C22.79691,4.9549271E-08,23.596955,0.8000156,23.596955,1.800031L23.596955,3.7990554C23.596955,4.7990709,22.79691,5.5990864,21.796914,5.5990864L1.799981,5.5990864C0.79998477,5.4990941,0,4.6990786,0,3.6990629L0,1.7000236C0,0.8000156,0.79998477,4.9549271E-08,1.799981,0z
M 22.589844 14.470703 H 0.82421875 C 0.36896661 14.470586 -1.1747368e-4 14.83967 0 15.294922 v 4.669922 c -1.1747368e-4 0.455252 0.36896661 0.824336 0.82421875 0.824218 H 16.940231 l 0.425003 -1.09375 0.554688 -0.554687 H 1.6484375 V 16.119141 H 20.941406 Z M 27.462891 9.5976562 V 8.0742188 A 0.8240064 0.8240064 0 0 0 26.638672 7.25 H 0.82421875 A 0.8240064 0.8240064 0 0 0 0 8.0742188 v 4.6699222 a 0.8240064 0.8240064 0 0 0 0.82421875 0.824218 H 23.492188 l 1.648437 -1.648437 H 1.6484375 V 8.8984375 H 25.814453 V 11.246094 Z M 0.82421878 2.736881e-8 A 0.8240064 0.8240064 0 0 0 2.7433281e-8 0.82421879 V 5.4941406 A 0.8240064 0.8240064 0 0 0 0.82421878 6.3183594 H 26.638672 A 0.8240064 0.8240064 0 0 0 27.46289 5.4941406 V 0.82421879 A 0.8240064 0.8240064 0 0 0 26.638672 2.736881e-8 Z M 1.6484375 1.6484375 H 25.814453 V 4.6699219 H 1.6484375 Z M 31.628051 7.2558423 19.165575 19.718635 23.70324 24.256618 36.166032 11.793823 Z m -0.0013 3.5965607 0.941422 0.94142 -8.866233 8.866232 -0.94142 -0.94142 z m -13.240122 9.708458 -1.636234 6.110706 6.109329 -1.637606 z
</sys:String>
<sys:String x:Key="{x:Static mbts:Icons.DiskGeometryKey}">
M403.213,20H0v472h512V128.787L403.213,20z M131,50h180v100h10h20h10V50h30v130H131V50z M381,462H131V315
@@ -345,7 +343,7 @@
</sys:String>
<sys:String x:Key="{x:Static mbts:Icons.TrashGeometryKey}">
M0,12.568994L23.662999,12.568994 20.910989,31.999999 2.7520113,31.999999z M8.0689915,1.6269979L8.0689915,4.6679968 15.594984,4.6679968 15.594984,1.6269979z M6.4420097,0L17.221997,0 17.221997,4.6679968 23.662999,4.6679968 23.662999,8.7949938 0,8.7949938 0,4.6679968 6.4420097,4.6679968z
M15.000001,8.0000272L17,8.0000272 17,27.000028 15.000001,27.000028z M11.000001,8.0000272L13.000001,8.0000272 13.000001,27.000028 11.000001,27.000028z M7.0000005,8.0000272L9.000001,8.0000272 9.000001,27.000028 7.0000005,27.000028z M3.0790101,5.0000274L4.9959994,29.922999 19.000006,30.000026 20.918949,5.0000274z M13.771989,1.9959999L10.198989,2.0000001C10.158989,2.025,9.9989892,2.241,9.9989892,2.6000001L9.9989892,3.0000258 13.998989,3.0000258 13.998989,2.6000001C13.998989,2.241,13.838988,2.025,13.771989,1.9959999z M10.198989,0L13.798988,0C15.031989,0,15.998989,1.142,15.998989,2.6000001L15.998989,3.0000258 23.07898,3.0000258 24,3.0000272 24,5.0000274 22.925121,5.0000274 20.995976,30.076991C20.999027,31.102992,20.100956,32.000026,18.999029,32.000026L4.9990512,32.000026C3.8960255,32.000026,2.9990543,31.102992,2.999054,30.000026L1.073059,5.0000274 0,5.0000274 0,3.0000272 0.91897895,3.0000272 7.9989887,3.0000258 7.9989887,2.6000001C7.9989887,1.142,8.9659892,0,10.198989,0z
</sys:String>
<!--UndoCircular (the icon is free to use if we include this information in our credit/about section)
@@ -405,10 +403,10 @@
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Geometry="
M 32.868601,3.8869994 C31.026201,3.8869996 29.534,5.3791947 29.534,7.2190399 29.534,9.0588851 31.026201,10.553 32.868601,10.553 34.7085,10.553 36.202,9.0588851 36.202,7.2190399 36.202,5.3791947 34.7085,3.8869996 32.868601,3.8869994z
M 42.868601,3.8869994 C41.026201,3.8869996 39.534,5.3791947 39.534,7.2190399 39.534,9.0588851 41.026201,10.553 42.868601,10.553 44.7085,10.553 46.202,9.0588851 46.202,7.2190399 46.202,5.3791947 44.7085,3.8869996 42.868601,3.8869994z
M 52.868601,3.8869994 C51.026201,3.8869996 49.534,5.3791947 49.534,7.2190399 49.534,9.0588851 51.026201,10.553 52.868601,10.553 54.7085,10.553 56.202,9.0588851 56.202,7.2190399 56.202,5.3791947 54.7085,3.8869996 52.868601,3.8869994z
M5.2010002,14.812L5.2010002,43.573997 56.098,43.573997 56.098,14.812z
M 32.868601,3.8869994 C31.026201,3.8869996 29.534,5.3791947 29.534,7.2190399 29.534,9.0588851 31.026201,10.553 32.868601,10.553 34.7085,10.553 36.202,9.0588851 36.202,7.2190399 36.202,5.3791947 34.7085,3.8869996 32.868601,3.8869994z
M 42.868601,3.8869994 C41.026201,3.8869996 39.534,5.3791947 39.534,7.2190399 39.534,9.0588851 41.026201,10.553 42.868601,10.553 44.7085,10.553 46.202,9.0588851 46.202,7.2190399 46.202,5.3791947 44.7085,3.8869996 42.868601,3.8869994z
M 52.868601,3.8869994 C51.026201,3.8869996 49.534,5.3791947 49.534,7.2190399 49.534,9.0588851 51.026201,10.553 52.868601,10.553 54.7085,10.553 56.202,9.0588851 56.202,7.2190399 56.202,5.3791947 54.7085,3.8869996 52.868601,3.8869994z
M5.2010002,14.812L5.2010002,43.573997 56.098,43.573997 56.098,14.812z
M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<GeometryDrawing.Pen>
<Pen Thickness="1" Brush="Black" />
@@ -424,10 +422,10 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="Black" Geometry="
M 32.868601,3.8869994 C31.026201,3.8869996 29.534,5.3791947 29.534,7.2190399 29.534,9.0588851 31.026201,10.553 32.868601,10.553 34.7085,10.553 36.202,9.0588851 36.202,7.2190399 36.202,5.3791947 34.7085,3.8869996 32.868601,3.8869994z
M 42.868601,3.8869994 C41.026201,3.8869996 39.534,5.3791947 39.534,7.2190399 39.534,9.0588851 41.026201,10.553 42.868601,10.553 44.7085,10.553 46.202,9.0588851 46.202,7.2190399 46.202,5.3791947 44.7085,3.8869996 42.868601,3.8869994z
M 52.868601,3.8869994 C51.026201,3.8869996 49.534,5.3791947 49.534,7.2190399 49.534,9.0588851 51.026201,10.553 52.868601,10.553 54.7085,10.553 56.202,9.0588851 56.202,7.2190399 56.202,5.3791947 54.7085,3.8869996 52.868601,3.8869994z
M5.2010002,14.812L5.2010002,43.573997 56.098,43.573997 56.098,14.812z
M 32.868601,3.8869994 C31.026201,3.8869996 29.534,5.3791947 29.534,7.2190399 29.534,9.0588851 31.026201,10.553 32.868601,10.553 34.7085,10.553 36.202,9.0588851 36.202,7.2190399 36.202,5.3791947 34.7085,3.8869996 32.868601,3.8869994z
M 42.868601,3.8869994 C41.026201,3.8869996 39.534,5.3791947 39.534,7.2190399 39.534,9.0588851 41.026201,10.553 42.868601,10.553 44.7085,10.553 46.202,9.0588851 46.202,7.2190399 46.202,5.3791947 44.7085,3.8869996 42.868601,3.8869994z
M 52.868601,3.8869994 C51.026201,3.8869996 49.534,5.3791947 49.534,7.2190399 49.534,9.0588851 51.026201,10.553 52.868601,10.553 54.7085,10.553 56.202,9.0588851 56.202,7.2190399 56.202,5.3791947 54.7085,3.8869996 52.868601,3.8869994z
M5.2010002,14.812L5.2010002,43.573997 56.098,43.573997 56.098,14.812z
M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<GeometryDrawing.Pen>
<Pen Thickness="1" Brush="Black" />
@@ -843,7 +841,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="M23,14C24.10498,14 25,14.89502 25,16 25,17.10498 24.10498,18 23,18 21.89502,18 21,17.10498 21,16 21,14.89502 21.89502,14 23,14z M16,14C17.105,14 18,14.895 18,16 18,17.105 17.105,18 16,18 14.895,18 14,17.105 14,16 14,14.895 14.895,14 16,14z M9,14C10.105,14 11,14.895 11,16 11,17.105 10.105,18 9,18 7.8950005,18 7,17.105 7,16 7,14.895 7.8950005,14 9,14z M16,2C8.2799997,2 2,8.2800002 2,16 2,23.72 8.2799997,30 16,30 23.72,30 30,23.72 30,16 30,8.2800002 23.72,2 16,2z M16,0C24.822,0 32,7.178 32,16 32,24.822 24.822,32 16,32 7.1780005,32 0,24.822 0,16 0,7.178 7.1780005,0 16,0z" />
</DrawingGroup.Children>
@@ -856,7 +854,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="M299.152955025434,0L496.426178902388,0 268.890046089888,280.247772216797 198.190201729536,367.407897949219 199.87503144145,369.495361328125 271.502137154341,457.706451416016 498.999970406294,738 301.717621773481,738 101.234124153852,491.008697509766 99.5304498374462,488.936553955078 98.6409082114697,490.003173828125 0,368.488952636719 98.6409082114697,246.945526123047z" />
</DrawingGroup.Children>
@@ -868,7 +866,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="{mbts:BTSColor MarketData.bid}"
Geometry="m 24.706673 31.196264 -3.086182 3.086182 5.965481 5.963348 -5.965481 5.96548 3.086182 3.084049 5.963348 -5.963348 5.96548 5.963348 3.084049 -3.084049 -5.963347 -5.96548 5.963347 -5.963348 -3.084049 -3.086182 -5.96548 5.965481 z M 5.3507926 32.045363 H 17.816449 v 2.401501 H 5.3507926 Z m 0 -4.937233 H 24.132994 v 2.401501 H 5.3507926 Z m 0 9.874466 h 5.5381524 v 2.401501 H 5.3507926 Z M 1.3730469 0 A 1.3741374 1.3741374 0 0 0 0 1.3730469 V 45.630859 a 1.3741374 1.3741374 0 0 0 1.3730469 1.373047 H 16.853516 a 17.906029 17.906029 0 0 1 -0.05859 -1.373047 17.906029 17.906029 0 0 1 0.06836 -1.375 H 2.7480469 V 2.7480469 H 33.326172 V 27.783203 a 17.906029 17.906029 0 0 1 1.375 -0.05859 17.906029 17.906029 0 0 1 1.373047 0.06836 V 1.3730469 A 1.3741374 1.3741374 0 0 0 34.701172 0 Z M 10.662215 24.759265 V 5.1202697 h 7.148923 q 3.286862 0 5.05355 1.2051818 1.766687 1.2051838 1.766687 3.3964241 0 1.5886494 -1.081924 2.7801354 -1.068231 1.191488 -2.739053 1.657126 v 0.05479 q 2.095375 0.26021 3.341644 1.547564 1.259962 1.287354 1.259962 3.136214 0 2.697964 -1.93103 4.286613 -1.931032 1.574956 -5.272673 1.574956 z M 15.085783 8.3797408 v 4.6563852 h 1.944726 q 1.369526 0 2.150155 -0.657372 0.794325 -0.671068 0.794325 -1.835164 0 -2.1638492 -3.23208 -2.1638492 z m 0 7.9432472 v 5.176805 h 2.39667 q 1.533868 0 2.39667 -0.712152 0.876495 -0.712155 0.876495 -1.944728 0 -1.17779 -0.862802 -1.848858 -0.849105 -0.671067 -2.382974 -0.671067 z" />
</DrawingGroup.Children>
@@ -880,7 +878,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="{mbts:BTSColor MarketData.ask}"
Geometry="m 19.060265 26.797642 v -2.144583 q 0.583058 0.489233 1.266644 0.737201 0.683586 0.241265 1.380576 0.241265 0.408811 0 0.710393 -0.07372 0.308284 -0.07372 0.509339 -0.201055 0.207756 -0.134036 0.308284 -0.308283 0.100527 -0.18095 0.100527 -0.388706 0 -0.281477 -0.160844 -0.502637 -0.160844 -0.22116 -0.44232 -0.408811 -0.274775 -0.187651 -0.656779 -0.361898 -0.382004 -0.174248 -0.824324 -0.355197 -1.125906 -0.469128 -1.682158 -1.146012 -0.549549 -0.676884 -0.549549 -1.635245 0 -0.750604 0.301582 -1.28675 0.301582 -0.542847 0.817622 -0.891342 0.522743 -0.348495 1.206328 -0.509339 0.683586 -0.167545 1.447594 -0.167545 0.750604 0 1.326961 0.09383 0.583059 0.08712 1.072292 0.274775 v 2.003845 q -0.241266 -0.167545 -0.529444 -0.29488 -0.281477 -0.127335 -0.583059 -0.207757 -0.301582 -0.08712 -0.603164 -0.127334 -0.29488 -0.04021 -0.562953 -0.04021 -0.3686 0 -0.670182 0.07372 -0.301582 0.06702 -0.509339 0.194353 -0.207756 0.127334 -0.321687 0.308284 -0.113931 0.174247 -0.113931 0.395407 0 0.241266 0.127334 0.435619 0.127335 0.187651 0.361899 0.361898 0.234564 0.167546 0.569655 0.335091 0.335091 0.160844 0.757306 0.335091 0.576356 0.241266 1.03208 0.516041 0.462426 0.268073 0.790816 0.609866 0.328389 0.341793 0.502636 0.784113 0.174248 0.435618 0.174248 1.018677 0 0.804219 -0.308284 1.353768 -0.301582 0.542848 -0.824324 0.884641 -0.522743 0.335091 -1.219732 0.482531 -0.690288 0.14744 -1.460998 0.14744 -0.790815 0 -1.50791 -0.134036 -0.710393 -0.134037 -1.233135 -0.40211 z m 6.620223 3.788289 -1.556212 1.556212 3.008102 3.007026 -3.008102 3.008101 1.556212 1.555136 3.007026 -3.007026 3.008101 3.007026 1.555136 -1.555136 -3.007026 -3.008101 3.007026 -3.007026 -1.555136 -1.556212 -3.008101 3.008102 z m -9.76023 2.917766 h 2.792621 v 1.21096 h -2.792621 z m 0 -2.489606 h 6.285825 v 1.21096 h -6.285825 z m 0 -2.489607 h 9.470951 v 1.210961 H 15.920258 Z M 13.914475 14.855173 a 0.69291063 0.69291063 0 0 0 -0.692361 0.692361 v 22.317061 a 0.69291063 0.69291063 0 0 0 0.692361 0.692361 h 7.806047 a 9.0291392 9.0291392 0 0 1 -0.02954 -0.692361 9.0291392 9.0291392 0 0 1 0.03447 -0.693345 H 14.60782 V 16.24088 h 15.419061 v 12.624011 a 9.0291392 9.0291392 0 0 1 0.693346 -0.02954 9.0291392 9.0291392 0 0 1 0.692361 0.03447 V 15.547534 a 0.69291063 0.69291063 0 0 0 -0.692361 -0.692361 z" />
</DrawingGroup.Children>
@@ -893,7 +891,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="M 5.3507926 32.045363 H 17.81645 v 2.401501 H 5.3507926 Z m 0 -4.937233 H 24.132995 v 2.401501 H 5.3507926 Z M 18.799228 22.222041 v 2.32929 h -1.567173 v -2.264886 q -2.179014 -0.01073 -4.057475 -0.987533 v -2.973336 q 0.622575 0.504501 1.856993 0.933864 1.234417 0.429362 2.200482 0.493766 v -3.907198 q -2.511771 -0.933863 -3.4349 -2.018003 -0.912395 -1.094874 -0.912395 -2.662047 0 -1.685248 1.191482 -2.8659947 1.19148 -1.1914807 3.155813 -1.3846939 V 4.918734 h 1.567173 v 1.9535992 q 2.264887 0.1073411 3.38123 0.7299162 V 10.500446 Q 20.677689 9.5880506 18.799228 9.3841034 v 4.0682086 q 2.35076 0.847992 3.370495 1.942866 1.019736 1.08414 1.019736 2.629845 0 1.781854 -1.137811 2.876728 -1.13781 1.08414 -3.25242 1.32029 z M 17.232055 12.829737 V 9.4270397 q -1.492034 0.2683516 -1.492034 1.5564393 0 1.105608 1.492034 1.846258 z m 1.567173 3.628113 v 3.25242 q 1.53497 -0.236149 1.53497 -1.53497 0 -1.051939 -1.53497 -1.71745 z m 13.258587 13.65074 h -3.954117 l 0.0014 7.641804 -7.643169 -10e-7 0.0014 3.952751 h 7.640439 l 0.0014 7.641803 h 3.951385 l 0.0014 -7.641802 7.640437 -10e-7 0.0014 -3.952751 -7.643169 10e-7 z M 5.3507926 36.982596 h 5.5381524 v 2.401501 H 5.3507926 Z M 1.3730469 0 A 1.3741374 1.3741374 0 0 0 0 1.3730469 V 45.630859 a 1.3741374 1.3741374 0 0 0 1.3730469 1.373047 H 16.853516 a 17.906029 17.906029 0 0 1 -0.05859 -1.373047 17.906029 17.906029 0 0 1 0.06836 -1.375 H 2.7480469 V 2.7480469 H 33.326172 V 27.783203 a 17.906029 17.906029 0 0 1 1.375 -0.05859 17.906029 17.906029 0 0 1 1.373047 0.06836 V 1.3730469 A 1.3741374 1.3741374 0 0 0 34.701172 0 Z" />
</DrawingGroup.Children>
@@ -905,7 +903,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="m 26.463403 27.963318 h -2.359042 l -0.683586 -2.137882 h -3.417929 l -0.676884 2.137882 h -2.345638 l 3.498351 -9.610414 h 2.566798 z M 22.92484 24.163384 21.89276 20.933106 q -0.113931 -0.361899 -0.160844 -0.864535 h -0.05361 q -0.03351 0.422214 -0.167545 0.837727 l -1.045485 3.257086 z m 2.065112 7.055953 -1.51223 1.51223 2.923087 2.922042 -2.923087 2.923086 1.51223 1.511185 2.922042 -2.922042 2.923086 2.922042 1.511185 -1.511185 -2.922041 -2.923086 2.922041 -2.922042 -1.511185 -1.51223 -2.923086 2.923087 z m -9.484387 0.416058 h 6.108175 v 1.176737 h -6.108175 z m 0 -2.419244 h 9.203284 v 1.176735 h -9.203284 z m 0 4.83849 h 2.713696 v 1.176736 H 15.505565 Z M 13.556469 15.93316 a 0.67332766 0.67332766 0 0 0 -0.672794 0.672793 v 21.686339 a 0.67332766 0.67332766 0 0 0 0.672794 0.672793 h 7.585433 a 8.7739586 8.7739586 0 0 1 -0.02871 -0.672793 8.7739586 8.7739586 0 0 1 0.0335 -0.673751 H 14.230219 V 17.279703 h 14.983289 v 12.267233 a 8.7739586 8.7739586 0 0 1 0.67375 -0.02871 8.7739586 8.7739586 0 0 1 0.672794 0.0335 V 16.605953 A 0.67332766 0.67332766 0 0 0 29.887258 15.93316 Z" />
</DrawingGroup.Children>
@@ -917,7 +915,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="m 24.706673 31.196264 -3.086181 3.086182 5.96548 5.963348 -5.96548 5.96548 3.086181 3.084049 5.963348 -5.963348 5.96548 5.963348 3.084049 -3.084049 -5.963347 -5.96548 5.963347 -5.963348 -3.084049 -3.086182 -5.96548 5.965481 z M 5.3507926 32.045363 H 17.81645 v 2.401501 H 5.3507926 Z m 0 -4.937233 H 24.132994 v 2.401501 H 5.3507926 Z M 26.434166 6.0031559 14.993666 17.443656 9.6399578 12.089946 6.0100982 15.719802 c 2.9622322 2.959826 6.0772448 6.092263 8.9969908 8.970151 L 30.064121 9.6329208 Z M 5.3507926 36.982596 h 5.5381524 v 2.401501 H 5.3507926 Z M 1.3730469 0 A 1.3741374 1.3741374 0 0 0 0 1.3730469 V 45.630859 a 1.3741374 1.3741374 0 0 0 1.3730469 1.373047 H 16.853516 a 17.906029 17.906029 0 0 1 -0.05859 -1.373047 17.906029 17.906029 0 0 1 0.06836 -1.375 H 2.7480469 V 2.7480469 H 33.326172 V 27.783203 a 17.906029 17.906029 0 0 1 1.375 -0.05859 17.906029 17.906029 0 0 1 1.373047 0.06836 V 1.3730469 A 1.3741374 1.3741374 0 0 0 34.701172 0 Z" />
</DrawingGroup.Children>
@@ -940,7 +938,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="{mbts:BTSColor MarketData.bid}"
Geometry="M 9.9417804 -0.02293875 1.9154138 8.0034278 17.4301 23.512569 1.9154138 39.027256 9.9417804 47.048077 25.450922 31.538936 40.965607 47.048077 48.986428 39.027256 33.47729 23.512569 48.986428 8.0034278 40.965607 -0.02293875 25.450922 15.491746 Z" />
</DrawingGroup.Children>
@@ -952,7 +950,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="{mbts:BTSColor MarketData.ask}"
Geometry="M 9.9417804 -0.02293875 1.9154138 8.0034278 17.4301 23.512569 1.9154138 39.027256 9.9417804 47.048077 25.450922 31.538936 40.965607 47.048077 48.986428 39.027256 33.47729 23.512569 48.986428 8.0034278 40.965607 -0.02293875 25.450922 15.491746 Z" />
</DrawingGroup.Children>
@@ -964,7 +962,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="M 9.9417804 -0.02293875 1.9154138 8.0034278 17.4301 23.512569 1.9154138 39.027256 9.9417804 47.048077 25.450922 31.538936 40.965607 47.048077 48.986428 39.027256 33.47729 23.512569 48.986428 8.0034278 40.965607 -0.02293875 25.450922 15.491746 Z" />
</DrawingGroup.Children>
@@ -977,7 +975,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="m 69.641861 87.129943 a 36.813842 36.813842 0 0 0 -36.813776 36.813767 36.813842 36.813842 0 0 0 31.044618 36.31355 l 1.208194 21.35839 1.804543 31.90967 a 41.092964 41.092964 0 0 0 -29.828154 39.50509 41.092964 41.092964 0 0 0 41.09258 41.0931 41.092964 41.092964 0 0 0 41.093104 -41.0931 41.092964 41.092964 0 0 0 -0.10284 -2.9068 41.092964 41.092964 0 0 0 -38.048841 -38.03902 l -2.962092 -52.36321 a 36.813842 36.813842 0 0 0 20.093347 -12.61939 l 33.150946 15.70705 v 5.3e-4 a 27.542416 27.542416 0 0 0 -0.12557 2.49907 27.542416 27.542416 0 0 0 27.54251 27.54249 27.542416 27.542416 0 0 0 27.5425 -27.5425 27.542416 27.542416 0 0 0 -27.5425 -27.5425 27.542416 27.542416 0 0 0 -22.44618 11.61479 l -31.44563 -14.89935 a 36.813842 36.813842 0 0 0 1.55701 -10.53786 36.813842 36.813842 0 0 0 -36.813769 -36.813767 z" />
</DrawingGroup.Children>
@@ -989,7 +987,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="M 36.50044 86.999995 A 36.813842 36.813842 0 0 0 -0.3133356 123.81377 36.813842 36.813842 0 0 0 30.731282 160.12732 l 1.208194 21.35839 1.804543 31.90967 a 41.092964 41.092964 0 0 0 -29.8281546 39.50509 41.092964 41.092964 0 0 0 41.0925806 41.0931 41.092964 41.092964 0 0 0 41.093099 -41.0931 41.092964 41.092964 0 0 0 -0.102836 -2.9068 41.092964 41.092964 0 0 0 -38.04884 -38.03902 l -2.962092 -52.36321 a 36.813842 36.813842 0 0 0 20.093347 -12.61939 l 33.150948 15.70705 v 5.3e-4 a 27.542416 27.542416 0 0 0 -0.125574 2.49907 27.542416 27.542416 0 0 0 27.542513 27.54249 27.542416 27.542416 0 0 0 27.5425 -27.5425 27.542416 27.542416 0 0 0 -27.5425 -27.5425 27.542416 27.542416 0 0 0 -22.44618 11.61479 L 71.757201 134.35163 A 36.813842 36.813842 0 0 0 73.314213 123.81377 36.813842 36.813842 0 0 0 36.50044 86.999995 Z m 116.60981 115.628085 0.007 37.48967 h -37.49716 l 0.007 19.39257 h 37.48344 L 153.11751 297 h 19.38493 l 0.007 -37.48968 h 37.48342 L 210 240.11775 h -37.49727 l 0.007 -37.48967 z" />
</DrawingGroup.Children>
@@ -1014,7 +1012,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="M 37.03498 86.999995 A 36.813842 36.813842 0 0 0 0.2212037 123.81377 36.813842 36.813842 0 0 0 31.265822 160.12732 l 1.208194 21.35839 1.804543 31.90967 a 41.092964 41.092964 0 0 0 -29.8281553 39.50509 41.092964 41.092964 0 0 0 41.0925813 41.0931 41.092964 41.092964 0 0 0 41.093099 -41.0931 41.092964 41.092964 0 0 0 -0.102836 -2.9068 41.092964 41.092964 0 0 0 -38.04884 -38.03902 l -2.962092 -52.36321 a 36.813842 36.813842 0 0 0 20.093347 -12.61939 l 33.150948 15.70705 v 5.3e-4 a 27.542416 27.542416 0 0 0 -0.125574 2.49907 27.542416 27.542416 0 0 0 27.542503 27.54249 27.542416 27.542416 0 0 0 27.5425 -27.5425 27.542416 27.542416 0 0 0 -27.5425 -27.5425 27.542416 27.542416 0 0 0 -22.44618 11.61479 L 72.291741 134.35163 A 36.813842 36.813842 0 0 0 73.848753 123.81377 36.813842 36.813842 0 0 0 37.03498 86.999995 Z m 145.03189 90.486735 -76.71431 76.71435 27.93311 27.93293 L 210 205.41986 Z m -0.008 22.13769 5.79522 5.79544 -54.57645 54.57644 -5.7952 -5.79522 z m -81.50016 59.76108 -10.071854 37.61451 37.606034 -10.0803 z" />
</DrawingGroup.Children>
@@ -1026,7 +1024,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing
<GeometryDrawing
Brush="Black"
Geometry="m 139.80129 180.78831 a 20.783495 20.783495 0 0 0 -20.78345 20.78346 20.783495 20.783495 0 0 0 17.52643 20.50105 l 0.68209 12.05803 1.01877 18.01482 a 23.1993 23.1993 0 0 0 -16.83968 22.30284 23.1993 23.1993 0 0 0 23.1991 23.19938 23.1993 23.1993 0 0 0 23.19935 -23.19938 23.1993 23.1993 0 0 0 -0.058 -1.64105 23.1993 23.1993 0 0 0 -21.4807 -21.47518 l -1.67225 -29.56198 a 20.783495 20.783495 0 0 0 11.34383 -7.12437 l 18.71558 8.86752 v 3.1e-4 a 15.549251 15.549251 0 0 0 -0.0708 1.41086 15.549251 15.549251 0 0 0 15.5493 15.54927 15.549251 15.549251 0 0 0 15.54931 -15.54927 15.549251 15.549251 0 0 0 -15.54931 -15.54932 15.549251 15.549251 0 0 0 -12.67213 6.5572 l -17.75282 -8.41152 a 20.783495 20.783495 0 0 0 0.87902 -5.94921 20.783495 20.783495 0 0 0 -20.78345 -20.78346 z M 31.983713 88.265691 A 30.676234 30.676234 0 0 0 1.3075339 118.94187 30.676234 30.676234 0 0 0 27.17639 149.20122 l 1.006764 17.79752 1.503689 26.58969 A 34.241941 34.241941 0 0 0 4.8316412 226.50722 34.241941 34.241941 0 0 0 39.073263 260.74928 34.241941 34.241941 0 0 0 73.315316 226.50722 34.241941 34.241941 0 0 0 73.229625 224.08505 34.241941 34.241941 0 0 0 41.524291 192.3879 L 39.05604 148.75469 A 30.676234 30.676234 0 0 0 55.799422 138.2392 l 27.624018 13.08837 v 4.4e-4 a 22.950541 22.950541 0 0 0 -0.104638 2.08242 22.950541 22.950541 0 0 0 22.950618 22.9506 22.950541 22.950541 0 0 0 22.95062 -22.9506 22.950541 22.950541 0 0 0 -22.95062 -22.95061 22.950541 22.950541 0 0 0 -18.703946 9.67837 L 61.362463 127.72286 A 30.676234 30.676234 0 0 0 62.65989 118.94187 30.676234 30.676234 0 0 0 31.983713 88.265691 Z" />
</DrawingGroup.Children>
@@ -1150,7 +1148,7 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
<DrawingGroup.Children>
<GeometryDrawing
Brush="Black"
Geometry="M17.740002,11.999007C17.254002,11.999007,16.859001,12.394008,16.859001,12.879008L16.859001,24.458791 16.860127,24.479386C16.861003,24.607261 16.813003,24.735511 16.716002,24.834012 16.667502,24.883012 16.611378,24.91995 16.551394,24.944762L16.521562,24.955436 16.507633,24.960536 16.506465,24.960837 16.50574,24.961097 16.49194,24.964574 16.459728,24.972863C16.42719,24.979527,16.393502,24.983027,16.359002,24.983027L16.316763,24.980893 16.315716,24.980851 16.307903,24.980445C16.223895,24.971904,16.146014,24.942538,16.07951,24.897597L16.067752,24.887895 16.047276,24.873078 16.015234,24.844558 16.005502,24.836528 16.001236,24.831357 13.737002,22.600011C13.267003,22.134011 12.502003,22.135011 12.031003,22.600011 11.805003,22.82301 11.680003,23.120011 11.680003,23.436011 11.680003,23.751012 11.805003,24.048011 12.031003,24.272012L16.842003,29.031013C19.311003,31.189013 21.546002,31.119014 22.656003,30.886014 23.939002,30.614013 25.015002,29.846013 25.464002,28.880013 25.857001,28.036012 26.301002,27.080012 26.263001,26.195012 26.262002,26.178012 26.268003,26.074012 26.269002,26.056012L26.268003,20.974011C26.268003,20.55601 25.922002,20.215011 25.496001,20.215011 25.335502,20.215011 25.239001,20.246511 25.179877,20.283135L25.144,20.309762 25.144,21.215013C25.144,21.491012 24.919999,21.715013 24.644,21.715013 24.367999,21.715013 24.144,21.491012 24.144,21.215013L24.144,19.278017C24.144,18.793018 23.749,18.399019 23.263,18.399019 22.808312,18.399019 22.432727,18.745308 22.387555,19.18822L22.383004,19.277944 22.383004,19.716007C22.383004,19.992006 22.159003,20.216004 21.883002,20.216004 21.607003,20.216004 21.383002,19.992006 21.383002,19.716007L21.383002,19.278054 21.383002,18.504013C21.383002,18.018016 20.988002,17.623017 20.502002,17.623017 20.016002,17.623017 19.621001,18.018016 19.621001,18.504013L19.621001,20.24402C19.621001,20.52102 19.397001,20.74402 19.121001,20.74402 18.844001,20.74402 18.621001,20.52102 18.621001,20.24402L18.621001,18.504035 18.621001,12.879008C18.621001,12.394008,18.226001,11.999007,17.740002,11.999007z M17.740002,10.999005C18.777001,10.999005,19.621001,11.843007,19.621001,12.879008L19.621001,16.842839 19.687315,16.808824C19.933955,16.689783 20.210345,16.623022 20.502002,16.623022 21.247346,16.623022 21.892987,17.059031 22.197202,17.689331L22.211675,17.721288 22.212884,17.720384C22.513,17.517568 22.874499,17.399021 23.263,17.399021 24.267594,17.399021 25.091062,18.190155 25.141547,19.181478L25.143222,19.247425 25.174827,19.241074C25.276639,19.223799 25.383876,19.21501 25.496001,19.21501 26.473002,19.21501 27.268003,20.00401 27.268003,20.974011L27.268003,26.087012C27.268003,26.098012 27.262002,26.194013 27.262002,26.205012 27.311002,27.281013 26.790002,28.401013 26.371001,29.302012 25.783002,30.566012 24.472001,31.523013 22.863002,31.864013 22.513001,31.938014 22.067002,31.999013 21.547002,31.999013 20.149003,31.999013 18.216002,31.561013 16.161002,29.763013L11.328003,24.983012C10.910003,24.570012 10.680003,24.020011 10.680003,23.436011 10.680003,22.85101 10.910003,22.302011 11.328003,21.88901 12.187003,21.040011 13.583003,21.041011 14.440002,21.88901L15.859002,23.287391 15.859002,12.879008C15.859002,11.843007,16.703002,10.999005,17.740002,10.999005z M6.8659983,4.0500388L19.083997,4.0500388C20.668996,4.0500388,21.957997,5.3460296,21.957997,6.9390478L21.957997,14.653042C21.957997,14.93005 21.734998,15.153042 21.457997,15.153042 21.181996,15.153042 20.957997,14.93005 20.957997,14.653042L20.957997,6.9390478C20.957997,5.8980318,20.116998,5.0500394,19.083997,5.0500394L6.8659983,5.0500394C5.8319979,5.0500394,4.9909983,5.8980318,4.9909984,6.9390478L4.9909984,26.116061C4.9909983,27.157046,5.8319979,28.00504,6.8659983,28.00504L11.696996,28.00504C11.972997,28.00504 12.196996,28.229039 12.196996,28.50504 12.196996,28.781041 11.972997,29.00504 11.696996,29.00504L6.8659983,29.00504C5.2809954,29.00504,3.9909983,27.70905,3.9909983,26.116061L3.9909983,6.9390478C3.9909983,5.3460296,5.2809954,4.0500388,6.8659983,4.0500388z M6.4360008,0L17.467001,0C17.743001,0 17.967001,0.22300029 17.967001,0.50000024 17.967001,0.77600098 17.743001,1.0000012 17.467001,1.0000012L6.4360008,1.0000012C3.4380004,1.0000012,1.0000002,3.4210042,1.0000002,6.3970079L1.0000002,20.617026C1.0000002,20.893025 0.77600026,21.117026 0.50000048,21.117026 0.22400022,21.117026 2.3841858E-07,20.893025 0,20.617026L0,6.3970079C2.3841858E-07,2.8700035,2.8870004,0,6.4360008,0z"
Geometry="M 0.814453 2e-6 C 0.365092 -7.56e-4 3.21e-4 0.36314 0 0.812502 v 23.945313 c 0.788895 1.126154 1.626953 -0.02112 1.626953 -0.02112 V 1.625002 h 16.241843 c 0 0 0.80538 -0.934678 -0.124651 -1.625002 z M 3.750875 3.43624 C 3.301514 3.435482 2.936743 3.799378 2.936422 4.24874 v 23.945313 c -7.6e-4 0.450124 0.364329 0.815213 0.814453 0.814453 h 7.439453 C 11.042745 28.716852 10.90913 28.418337 10.789937 28.113975 10.699431 27.872971 10.617994 27.628659 10.545796 27.381553 H 4.563375 V 5.06124 h 15.304687 v 7.039063 c 0.173002 -0.01023 0.346234 -0.01609 0.519531 -0.01758 0.343731 -2.6e-4 0.68726 0.01669 1.029297 0.05078 0.02606 0.0038 0.0521 0.0077 0.07813 0.01172 V 4.248738 C 21.494699 3.799376 21.129928 3.43548 20.680567 3.436238 Z m 13.332031 6.884766 c -1.226661 0 -2.230469 1.002456 -2.230469 2.228516 v 9.572265 l -0.824219 -0.8125 v 0.002 c -0.991917 -0.9815 -2.60964 -0.982302 -3.603515 0 -0.48293 0.477155 -0.751953 1.119962 -0.751953 1.796875 0 0.67607 0.269215 1.317958 0.751953 1.794922 l 4.841797 4.78711 0.0078 0.0078 c 2.115591 1.851014 4.144077 2.322266 5.615234 2.322266 0.547268 0 1.017683 -0.06414 1.388672 -0.142578 1.701281 -0.360558 3.108561 -1.372782 3.751954 -2.75586 0.419048 -0.9011 0.978455 -2.062137 0.923828 -3.261718 4.09e-4 -0.01025 0.0011 -0.0075 0.002 -0.02344 0.0015 -0.02655 0.0039 -0.01047 0.0039 -0.07813 v -5.113281 c 0 -1.161114 -0.955476 -2.109375 -2.121094 -2.109375 -0.04803 0 -0.09044 0.0088 -0.136719 0.01172 -0.207784 -1.015547 -1.021531 -1.826172 -2.095703 -1.826172 -0.343265 0 -0.63914 0.145124 -0.93164 0.285156 -0.397916 -0.616533 -1.045784 -1.0625 -1.830078 -1.0625 -0.189487 0 -0.354735 0.07615 -0.53125 0.121094 v -3.515625 c 0 -1.22606 -1.003809 -2.228516 -2.230469 -2.228516 z m 0 1.699219 c 0.148476 0 0.278642 0.05997 0.375 0.15625 0.09685 0.09678 0.15625 0.225142 0.15625 0.373047 v 5.625 1.740234 c 0 0.464846 0.384763 0.849609 0.849609 0.849609 0.464527 0 0.84961 -0.383921 0.84961 -0.849609 v -1.740234 c 0 -0.148598 0.05896 -0.275762 0.15625 -0.373047 0.09729 -0.09729 0.228277 -0.158203 0.375 -0.158203 0.146722 0 0.277709 0.06091 0.375 0.158203 0.09729 0.09729 0.15625 0.224449 0.15625 0.373047 v 0.77539 0.4375 c 0 0.465373 0.384236 0.84961 0.849609 0.84961 0.465373 0 0.849609 -0.384239 0.849609 -0.84961 v -0.425781 l 0.0059 -0.06836 c 0.0286 -0.265146 0.249414 -0.472657 0.52539 -0.472657 0.148238 0 0.278481 0.05996 0.375 0.15625 0.09649 0.09627 0.15625 0.225145 0.15625 0.373047 v 1.935547 c 0 0.465371 0.384237 0.84961 0.84961 0.84961 0.465372 0 0.849609 -0.384237 0.849609 -0.84961 v -0.65039 c 0.0016 -9e-6 2.95e-4 0 0.002 0 0.238806 0 0.421875 0.185008 0.421875 0.410156 l 0.002 5.0625 c -4.64e-4 0.0084 -0.0023 0.0401 -0.0039 0.07227 -0.0015 0.03041 -0.0059 0.02687 -0.002 0.101563 0.03253 0.757506 -0.372777 1.677807 -0.765625 2.521484 h -0.002 c -0.194342 0.418116 -0.532821 0.810028 -0.976563 1.126953 -0.443595 0.316821 -0.990203 0.55925 -1.585937 0.685547 -0.515602 0.10823 -1.298166 0.179402 -2.248047 -0.03125 -0.47546 -0.105441 -0.991926 -0.281044 -1.539063 -0.560547 -0.547306 -0.279588 -1.127683 -0.66381 -1.724609 -1.185547 L 11.620061 23.69601 c -0.162198 -0.160763 -0.248047 -0.365899 -0.248047 -0.587891 0 -0.223284 0.08648 -0.426518 0.248047 -0.585937 0.168295 -0.166151 0.386826 -0.249911 0.607422 -0.25 0.220595 -9e-5 0.437432 0.08144 0.605469 0.248047 l 2.240234 2.207031 0.01367 0.02148 0.04687 0.03516 0.03711 0.0332 0.02539 0.01758 0.01563 0.01367 0.01563 0.0098 c 0.114637 0.07747 0.248043 0.126397 0.388672 0.140625 l -0.04883 -0.0078 0.04102 0.0098 0.08594 0.0039 h 0.0078 c 0.06844 0 0.126002 -0.0085 0.169922 -0.01758 l 0.0059 -0.002 0.01953 -0.0039 h 0.02539 l 0.06641 -0.02734 0.02734 -0.0098 0.0098 -0.0039 c 0.102105 -0.04223 0.198238 -0.105586 0.28125 -0.189454 h 0.002 c 0.163006 -0.165519 0.243191 -0.385955 0.242188 -0.599609 v -0.002 -0.01953 -11.580078 c 0 -0.147904 0.0594 -0.276271 0.15625 -0.373047 0.09636 -0.09628 0.226522 -0.15625 0.375 -0.15625 z"
/>
</DrawingGroup.Children>
</DrawingGroup>
@@ -1158,10 +1156,10 @@ M0,0L63.999001,0 63.999001,48.792999 0,48.792999z">
</DrawingImage>
<!-- Pin
<!-- Pin
<Path Data="F1M3,11L3,7 0,7 0,6 1,6 1,1 1,0 6,0 6,1 6,6 7,6 7,7 4,7 4,11 3,11z M2,1L2,6 4,6 4,1 2,1z" />
Unpin
Unpin
<Path Data="F1M0,3L4,3 4,0 5,0 5,1 10,1 11,1 11,6 10,6 5,6 5,7 4,7 4,4 0,4 0,3z M10,2L5,2 5,4 10,4 10,2z" />
-->
</ResourceDictionary>
</ResourceDictionary>
@@ -92,7 +92,10 @@ namespace mbts.spark {
_dispose = Disposable.Create(
_orders_model.on_security_root_orders(security.Id).OnDispatcher().Subscribe(_on_orders),
_position.OnDispatcher().Subscribe(v => _animation.animate_position(v.newval > v.oldval)),
_orders_model.on_security_positions(security.Id).OnDispatcher().Subscribe(t => Set(ref _raw_day_position, t.state.Values.Sum(p => p.Item2.raw_day_pos()), nameof(raw_day_position))),
_orders_model.on_security_positions(security.Id).OnDispatcher().Subscribe(t => {
if (Set(ref _raw_day_position, t.state.Values.Sum(p => p.Item2.raw_day_pos()), nameof(raw_day_position)))
raise_invalidated();
}),
_inside_bids.OnDispatcher().Subscribe(v => _animation.animate_working_bids_inside(v.newval)),
_inside_asks.OnDispatcher().Subscribe(v => _animation.animate_working_asks_inside(v.newval)),
_day_change.OnDispatcher().Subscribe(v => _animation.animate_day_change(v.newval > v.oldval)),
@@ -19,6 +19,8 @@ namespace mbts.spark {
this.key = key;
}
public static AlgoData empty => from_custom_def(new CustomOrderDefinitionImmutable(new CustomOrderDefinition()));
/// <summary>
/// This is the only <see cref="AlgoData"/> factory method that allows callers to explicitly specify a name.
/// It should only be used within the context of creating, or renaming, studio algos.
@@ -65,6 +67,8 @@ namespace mbts.spark {
}
struct AlgoDataVM : IEquatable<AlgoDataVM> {
public static readonly Func<AlgoDataVM, AlgoID> id_fn = vm => AlgoID.from_algo_key(vm.data.key);
public readonly AlgoData data;
public readonly AlgoDefinitionMetadata? meta;
@@ -68,13 +68,51 @@ namespace mbts.spark {
nameof(OrderBookRowVM.symbol)),
DataGridFilterKnownTemplates.DiscreteValues,
DefaultColumnWidths.Symbol);
// algo items view (common resources)
var algo_items_comp = AlgoCollectionHelper.algo_data_vm_comparer.to_non_generic();
var algo_items_group_desc = new PropertyGroupDescription(nameof(AlgoDataVM.group));
// order type
var order_type_filter = dv_filter(OrderDataHelper.all_order_types, r => r.order?.order_type() ?? OrderType.None);
var order_type_filter = DiscreteValuesFilterVM.CreateTableUpdate<FillTuple, AlgoDataVM, AlgoID, OrderType[]>(
ft => new AlgoDataVM(ft.algo ?? AlgoData.empty),
AlgoDataVM.id_fn,
ots => Array.ConvertAll(ots ?? Array.Empty<OrderType>(), ot => AlgoID.from_algo_key(AlgoKey.from_known_type(ot))),
ids => ids.empty_if_null().Select(AlgoID.to_algo_key).Where(k => k.mode == AlgoKey.Mode.Factory).Select(k => k.factory).ToArray(),
out var order_type_observer,
out var order_type_items_view);
order_type_items_view.CustomSort = algo_items_comp;
order_type_items_view.GroupDescriptions.Add(algo_items_group_desc);
order_type_observer.OnNext(TableUpdate<AlgoDataVM, AlgoID>.mk_empty(AlgoDataVM.id_fn)
.with_added(OrderDataHelper.all_order_types
.Select(OrderDataHelper.Defaults.CustomOrderDefinitionImmutable)
.Select(AlgoData.from_custom_def)
.Select(d => new AlgoDataVM(d))));
add_col_expl(Columns.OrderType,
new OrderTypeColumn<Columns>(Columns.OrderType, new Binding(nameof(Row.badge_fill)), new Binding(nameof(Row.display_name)), order_type_filter) {
id = col_id(Columns.OrderType),
sort_member_path = nameof(Row.order_type)
}, order_type_filter);
// root algo type
var root_algo_type_filter = DiscreteValuesFilterVM.CreateTableUpdate<FillTuple, AlgoDataVM, AlgoID>(
ft => new AlgoDataVM(ft.root_algo ?? AlgoData.empty),
AlgoDataVM.id_fn,
out var root_algo_type_observer,
out var root_algo_type_items_view);
root_algo_type_items_view.CustomSort = algo_items_comp;
root_algo_type_items_view.GroupDescriptions.Add(algo_items_group_desc);
add_col_expl(Columns.RootAlgoType,
new OrderTypeColumn<Columns>(
Columns.RootAlgoType,
new Binding(nameof(Row.root_algo_badge_color)) { Converter = new ui.converters.ColorToBrushConverter() },
new Binding(nameof(Row.root_algo_display_name)),
root_algo_type_filter,
DefaultColumnHeaders.RootAlgoType) {
id = col_id(Columns.RootAlgoType),
sort_member_path = nameof(Row.root_algo_order_type)
}, root_algo_type_filter);
// side
var side_filter = dv_filter(new[] { Side.Buy, Side.Sell }, r => r.fill.Side);
add_col_expl(Columns.Side, new SideColumn<Row, Columns>(Columns.Side, r => r.side, side_filter) { id = col_id(Columns.Side) }, side_filter);
@@ -129,6 +167,7 @@ namespace mbts.spark {
};
_rows_manager.on_settings(fs, s.sorting_criterion);
}),
model.subscribe_all_algos().SelectKeyValue(AlgoDataVM.from_data, d => AlgoID.from_algo_key(d.data.key)).OnDispatcher().Subscribe(root_algo_type_observer),
settings_manager == null ? Disposable.empty : settings_manager.subscribe_current().OnDispatcher().Subscribe(grid_settings_manager)
);
// local methods
@@ -176,8 +215,8 @@ namespace mbts.spark {
static IObservable<TableUpdate<FillTuple, string>> _get_observable(IBus bus, OrdersModel model, FillsSettings state) {
if (!state.orders.is_null_or_empty()) {
var orders_hash = new HashSet<uint>(state.orders);
return model.on_fill_tuples.Filter(f => orders_hash.Contains(f.fill.OrderKey));
} else return model.on_fill_tuples;
return model.on_fill_tuples_with_root.Filter(f => orders_hash.Contains(f.fill.OrderKey));
} else return model.on_fill_tuples_with_root;
}
static IObservable<TableUpdate<FillTuple, string>> _get_observable(IBus bus, OrdersModel model, IObservable<FillsSettings> state) =>
@@ -193,6 +232,7 @@ namespace mbts.spark {
case Columns.FillTime: return wrap(ft => ft.fill.Timestamp.to_local_time());
case Columns.OrderKey: return wrap(ft => ft.fill.OrderKey);
case Columns.OrderType: return wrap_default(ft => ft.order?.order_type() ?? OrderType.None);
case Columns.RootAlgoType: return wrap_default(ft => ft.root_algo.HasValue ? ft.root_algo.Value.value.CustomCase : OrderType.None);
case Columns.Price: return wrap(ft => ft.fill.LastPrice);
case Columns.Security: return wrap(ft => ft.security ?? SecurityDataHelper.Defaults.SecurityImmutable);
case Columns.SecurityKey: return wrap(ft => ft.fill.SecurityKey);
@@ -226,7 +266,10 @@ namespace mbts.spark {
readonly OrdersModel _model;
readonly FillImmutable _fill;
readonly OrderRecordImmutable _order;
AlgoData? _root_algo => fill_tuple.root_algo;
AlgoDefinitionMetadata? _root_algo_meta => fill_tuple.root_algo_meta;
Brush _badge_fill;
Color? _root_algo_badge_color;
OrderMetadata _order_metadata;
public Row(FillTuple fill_tuple, OrdersModel model) :
@@ -241,6 +284,7 @@ namespace mbts.spark {
public DateTime fill_time => _fill.Timestamp.to_local_time();
public TimeInForce time_in_force => _order.time_in_force();
public OrderType order_type => _order.order_type();
//public OrderType root_algo_type => _or
public string display_name => OrderUtils.display_name(_order, fill_tuple.algo);
public OrderMetadata order_metadata => _order_metadata ?? (_order_metadata = _model.factory.get_metadata(_order.Def.CustomDef.CustomCase));
public Brush badge_fill => _badge_fill ?? (_badge_fill = OrderUtils.badge_fill(fill_tuple.algo_meta, order_metadata));
@@ -255,6 +299,12 @@ namespace mbts.spark {
public string fill_key => _fill.FillKey;
public string order_key => _order.Key.ToString();
// Root Algo
public OrderType root_algo_order_type => _root_algo.HasValue ? _root_algo.Value.value.CustomCase : OrderType.None;
public OrderMetadata root_algo_order_metadata => _model.factory.get_metadata(root_algo_order_type);
public Color root_algo_badge_color => _root_algo_badge_color ?? (_root_algo_badge_color = OrderUtils.badge_color(_root_algo_meta, root_algo_order_metadata)).Value;
public string root_algo_display_name => _root_algo?.name ?? root_algo_order_type.display_name();
public bool Equals(Row other) => other != null && other._fill.Equals(_fill) && other._order.Equals(_order);
public override bool Equals(object obj) => Equals(obj as Row);
public override int GetHashCode() => _fill.FillKey.GetHashCode() ^ _order.Key.GetHashCode();
@@ -16,6 +16,7 @@ namespace mbts.ui.spark {
Symbol,
TimeInForce,
OrderType,
RootAlgoType,
Side,
Price,
Size,
@@ -1,19 +1,15 @@
using bts.api;
using bts.api.orderman;
using bts.settings;
using bts.shell.fills;
using mbts.persist;
using mbts.spark;
using mbts.spark.filters;
using mbts.ui;
using mbts.ui.controls;
using mbts.ui.settings;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel.Composition;
using System.Reactive.Linq;
using System.Threading.Tasks;
using static mbts.ui.controls.DIYGrid;
using static mbts.ui.spark.FillsView;
namespace bts.shell {
@@ -34,13 +30,15 @@ namespace bts.shell {
{ nameof(FillsVM.Row.fill_time), Columns.FillTime },
{ nameof(FillsVM.Row.order_key), Columns.OrderKey },
{ nameof(FillsVM.Row.order_type), Columns.OrderType },
{ nameof(FillsVM.Row.root_algo_order_type), Columns.RootAlgoType },
{ nameof(FillsVM.Row.price), Columns.Price },
{ nameof(FillsVM.Row.security), Columns.Security },
{ nameof(FillsVM.Row.security_key), Columns.SecurityKey },
{ nameof(FillsVM.Row.side), Columns.Side },
{ nameof(FillsVM.Row.size), Columns.Size },
{ nameof(FillsVM.Row.time_in_force), Columns.TimeInForce },
{ nameof(FillsVM.Row.user), Columns.User }
{ nameof(FillsVM.Row.user), Columns.User },
{ nameof(FillsVM.Row.fill_status ), Columns.FillStatus },
};
public FillsWindowFactory(TradingShellModule module, IBus bus, UserSettingsHub settings_hub, OrdersModel orders_model)
@@ -67,8 +65,12 @@ namespace bts.shell {
set: (us, gs) => us.with(provided_fills_gridsettings: gs));
return new FillsWindow(this, _bus, _orders_model, state, settings_manager);
}
[ProtoMember(15)]
[DIYGridColumnID(nameof(Columns.FillStatus))]
public Fill.Types.FillStatus[] fill_status { get; set; }
// migration rules
[Export(typeof(IFillsGridSettingsMigrationRule))]
class AddMissingColumnsMigrationRule : IFillsGridSettingsMigrationRule {
public bool apply(GridSettings settings, out GridSettings new_settings) =>
settings.add_missing_columns(FillsSettings.DefaultGridSettings.columns, out new_settings);
}
}
}
@@ -23,6 +23,10 @@ namespace bts.shell.fills {
[DIYGridColumnID(nameof(Columns.OrderType))]
public CustomOrderDefinition.CustomOneofCase[] order_type { get; set; }
[ProtoMember(16)]
[DIYGridColumnID(nameof(Columns.RootAlgoType))]
public AlgoID[] root_algo_type { get; set; }
[ProtoMember(4)]
[DIYGridColumnID(nameof(Columns.Account))]
public string[] account { get; set; }
@@ -92,6 +96,7 @@ namespace bts.shell.fills {
pb.add_discrete_values(fs.exchange, ft => ft.exchange());
pb.add_discrete_values(fs.time_in_force, ft => ft.time_in_force());
pb.add_discrete_values(fs.order_type, ft => ft.order_type());
pb.add_discrete_values(fs.root_algo_type, ft => AlgoID.from_algo_key((ft.root_algo ?? AlgoData.empty).key));
pb.add_discrete_values(fs.side, ft => ft.fill.Side);
pb.add_discrete_values(fs.fill_kind, ft => ft.fill.FillKind);
pb.add_discrete_values(fs.symbol, ft => ft.security?.Symbol ?? string.Empty);
@@ -47,6 +47,7 @@ namespace bts.shell.fills {
public static GridColumnSettings exchange => new GridColumnSettings(col_id(Columns.Exchange), DefaultColumnHeaders.Exchange, width: DefaultColumnWidths.Exchange);
public static GridColumnSettings time_in_force => new GridColumnSettings(col_id(Columns.TimeInForce), DefaultColumnHeaders.TimeInForce, width: DefaultColumnWidths.TimeInForce);
public static GridColumnSettings order_type => new GridColumnSettings(col_id(Columns.OrderType), DefaultColumnHeaders.OrderType, width: DefaultColumnWidths.OrderType);
public static GridColumnSettings root_algo_type => new GridColumnSettings(col_id(Columns.RootAlgoType), DefaultColumnHeaders.RootAlgoType, width: DefaultColumnWidths.OrderType);
public static GridColumnSettings side => new GridColumnSettings(col_id(Columns.Side), DefaultColumnHeaders.Side, width: DefaultColumnWidths.Side);
public static GridColumnSettings quantity => new GridColumnSettings(col_id(Columns.Size), DefaultColumnHeaders.Size, width: DefaultColumnWidths.Size, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings price => new GridColumnSettings(col_id(Columns.Price), DefaultColumnHeaders.Price, width: DefaultColumnWidths.Price, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
@@ -70,6 +71,7 @@ namespace bts.shell.fills {
yield return exchange;
yield return time_in_force;
yield return order_type;
yield return root_algo_type;
yield return side;
yield return quantity;
yield return price;
@@ -138,7 +138,7 @@ namespace mbts.spark {
//
//_window_height = backing(nameof(window_height), settings_manager.subscribe_current().OnDispatcher().Select(s => s.zoom_factor), (scale) => scale * 600);
//_window_width = backing(nameof(window_width), settings_manager.subscribe_current().OnDispatcher().Select(s => s.zoom_factor), (scale) => scale * 420);
position_click_command = new DelegateCommand(() => size_calculator.value = DoubleHelper.safe_convert_to_uint(Math.Abs(_show_day_position ? day_position : position)));
position_click_command = new DelegateCommand(() => size_calculator.value = DoubleHelper.safe_convert_to_uint(Math.Abs(_show_day_position ? day_position : (_show_raw_day_position ? _raw_day_position : position))));
send_order_command = new AsyncCommand<(double price, Side? side, MouseButton button)>(send_order_async);
cancel_command = new AsyncCommand<LadderModel.CancelType>(_model.cancel_orders, true);
show_book_command = new DelegateCommand(_show_book);
@@ -487,6 +487,7 @@
<MultiBinding Converter="{x:Static spark:LadderView.PositionToolTipConverter}">
<Binding Path="order_properties_vm.selected_account"/>
<Binding Path="show_day_position"/>
<Binding Path="show_raw_day_position"/>
<Binding Path="show_account_position"/>
</MultiBinding>
</TextBlock.Text>
@@ -18,32 +18,60 @@ namespace mbts.spark {
MaxZoomFactor = 1.5;
public static IMultiValueConverter PositionToolTipConverter =
ValueConverter.create<AccountTuple?, bool, bool, string>((account, show_day_pos, show_total_pos) => {
const string day_pos_text = "day", total_pos_text = "total";
ValueConverter.create<AccountTuple?, bool, bool, bool, string>((account, show_day_pos, show_raw_day_pos, show_total_pos) => {
const string day_pos_text = "day", raw_day_pos_text = "raw day", total_pos_text = "total";
if (!account.HasValue)
return string.Empty;
var sb = new StringBuilderEx(account.Value.name);
string primary_pos;
if (show_day_pos) {
primary_pos = day_pos_text;
if (show_total_pos) {
sb.Add(" '", primary_pos, " ");
sb.Add("(", total_pos_text, ")' ");
} else {
sb.Add(" ", primary_pos, " ");
}
} else if (show_total_pos) {
primary_pos = total_pos_text;
sb.Add(" ", primary_pos, " ");
/// Note: 'day,' and 'raw day,' are interchangeable wrt the string format, 'total' however is treated differently.
/// Different Formats:
// No parts are visible:
// null
//
// 1 part 'foo' is visible:
// "<account> foo position
// click to copy to size"
//
// 2 parts 'day' and 'raw day' are visible:
// "<account> 'day / raw day' position
// click to copy day to size"
//
// 2 parts 'day' and 'total' are visible:
// "<account> 'day (total)' position
// click to copy day to size"
//
string primary_pos = null;
// part count is incremented in the 'add_part' method
int part_count = 0;
var sb = new StringBuilderEx();
if (show_day_pos) add_part(day_pos_text, " / ");
if (show_raw_day_pos) add_part(raw_day_pos_text, " / ");
if (show_total_pos) add_part(total_pos_text, " (", ")");
//
if (part_count > 1) {
// This is a complex expression (showing more than 1 value) - wrap it in single quotes.
// Explicitly state which value will be copied to the size input.
sb.Insert(0, "'");
sb.Add("'");
sb.Add(" position\n(click to copy ", primary_pos, " to size)");
} else {
// unexpected code path (the button for which this tooltip is destined should be invisible in this case), but no need to throw an exception.
return string.Empty;
// Only showing 1 value, no need for single quotes,
// nor an explicit statement that indicates which value will be copied to the size input.
sb.Add(" position\n(click to copy to size)");
}
sb.Add("position\n(click to copy ");
if (show_day_pos && show_total_pos)
sb.Add(primary_pos, " position ");
sb.Add("to size)");
return sb.ToString();
void add_part(string part_name, string separator = null, string separator_suffix = null) {
if (part_count++ > 0) {
sb.Add(separator);
sb.Add(part_name);
sb.Add(separator_suffix);
} else {
primary_pos = part_name;
sb.Add($"{account.Value.name} {part_name}");
}
}
});
internal LadderView(LadderVM vm) {
+31 -17
View File
@@ -2,28 +2,40 @@
using bts.api.orderman;
using bts.utils;
using System;
using static bts.api.orderman.Fill.Types;
namespace mbts.spark {
class FillTuple : IEquatable<FillTuple> {
public static readonly Func<FillTuple, string> key_fn = ft => ft.fill.FillKey;
public readonly FillImmutable fill;
public readonly OrderRecordImmutable? order;
public readonly SecurityImmutable? security;
public readonly AlgoData? algo;
public readonly AlgoDefinitionMetadata? algo_meta;
public FillTuple((SecurityImmutable? sec, FillImmutable val) fill, OrderSecurity? order_tuple) {
this.fill = fill.val;
this.security = fill.sec;
if (order_tuple is OrderSecurity osam) {
order = osam.order;
algo = osam.algo;
algo_meta = osam.meta;
}
OrderSecurityRootPair? _order_tuple;
public FillTuple(FillImmutable fill, SecurityImmutable? security, OrderSecurityRootPair? order_tuple) {
this.fill = fill;
this.security = security;
_order_tuple = order_tuple;
}
public FillTuple((SecurityImmutable? sec, FillImmutable val) fill, OrderSecurity? order_tuple)
: this(fill.val, fill.sec, OrderSecurityRootPair.from_order_security(order_tuple.Value)) { }
public AlgoData? algo =>
_order_tuple.HasValue ? _order_tuple.Value.order.algo : (AlgoData?)null;
public AlgoDefinitionMetadata? algo_meta =>
_order_tuple.HasValue ? _order_tuple.Value.order.meta : null;
public OrderRecordImmutable? order =>
_order_tuple.HasValue ? _order_tuple.Value.order.order : (OrderRecordImmutable?)null;
public AlgoData? root_algo =>
_order_tuple.HasValue ? _order_tuple.Value.root.algo : (AlgoData?)null;
public AlgoDefinitionMetadata? root_algo_meta =>
_order_tuple.HasValue ? _order_tuple.Value.root.meta : null;
public string account {
get {
var account_string = string.Empty;
@@ -33,12 +45,14 @@ namespace mbts.spark {
}
}
public bool Equals(FillTuple other) => other != null
&& other.order.HasValue == order.HasValue
&& other.security.HasValue == security.HasValue
&& other.fill.Equals(fill);
public bool Equals(FillTuple other) =>
other != null &&
_order_tuple.Equals(other._order_tuple) &&
security.HasValue == other.security.HasValue &&
fill.Equals(other.fill);
public override bool Equals(object obj) => Equals(obj as FillTuple);
public override bool Equals(object obj) =>
Equals(obj as FillTuple);
public override int GetHashCode() =>
EqualityComparer.aggregate_hash(
+12 -1
View File
@@ -132,7 +132,7 @@ namespace mbts.spark {
OrderSecurityRootPair.from_order_security,
OrderSecurityHelper.root_pair_key_fn
).Cache();
// fills
// fill tuples
var on_fills =
_service.subscribei_fills()
.Naggle(interval, scheduler)
@@ -148,6 +148,16 @@ namespace mbts.spark {
(f, fk, ok) => new FillTuple(f, null),
f => f.fill.FillKey);
on_fill_tuples = fill_order_tuples_join.Cache();
// fill tuples with root (algo)
var fill_order_tuples_with_root_join = on_fills.LeftJoin(
on_order_tuples_with_root,
f => f.val.FillKey,
OrderSecurityHelper.root_pair_key_fn,
f => f.val.OrderKey,
(f, fk, o, ok) => new FillTuple(f.val, f.sec, o),
(f, fk, ok) => new FillTuple(f.val, f.sec, null),
FillTuple.key_fn);
on_fill_tuples_with_root = fill_order_tuples_with_root_join.Cache();
// manual fills
on_manual_fills_securities = _position_service.subscribei_manual_fills()
.Naggle(interval, scheduler)
@@ -211,6 +221,7 @@ namespace mbts.spark {
public IObservable<TableUpdate<KeyValuePair<uint, bool>, uint>> on_orders_can_attach { get; }
public IObservable<IIncrementalUpdate<SecurityImmutable, uint>> on_order_securities { get; }
public IObservable<TableUpdate<FillTuple, string>> on_fill_tuples { get; }
public IObservable<TableUpdate<FillTuple, string>> on_fill_tuples_with_root { get; }
public IObservable<IReadOnlyDictionary<uint,OrderSecurity>> working_orders { get; }
public IObservable<TableUpdate<(SecurityImmutable?, PositionUnitImmutable), int>> on_positions { get; }
public IObservable<TableUpdate<(AlgoData algo, AlgoDefinitionMetadata? meta), AlgoKey>> studio_algos_with_meta { get; }
+13 -2
View File
@@ -215,7 +215,7 @@ namespace mbts {
_second.Equals(other._second);
public override bool Equals(object obj) =>
Equals(obj is OrTrigger<T>);
Equals(obj as OrTrigger<T>);
public override int GetHashCode() =>
EqualityComparer.aggregate_hash(
@@ -256,7 +256,7 @@ namespace mbts {
$"OrTrigger ({_first}, {_second})";
}
class GreaterThanTrigger<T> : IPredicate<T> {
class GreaterThanTrigger<T> : IPredicate<T>, IEquatable<GreaterThanTrigger<T>> {
readonly T _value;
readonly IComparer<T> _comparer;
@@ -268,6 +268,17 @@ namespace mbts {
public bool trigger(T value) =>
_comparer.Compare(value, _value) > 0;
public bool Equals(GreaterThanTrigger<T> other) =>
other != null &&
_comparer.Equals(other._comparer) &&
_comparer.Compare(_value, other._value) == 0;
public override bool Equals(object obj) =>
Equals(obj as GreaterThanTrigger<T>);
public override int GetHashCode() =>
_value.GetHashCode();
public override string ToString() =>
$"GreaterThanTrigger ({_value})";
}
@@ -200,17 +200,20 @@ namespace mbts.collections {
public ObservableCollectionEx<T> selected_items { get; } = new ObservableCollectionEx<T>();
public IEnumerable<TKey> selected_keys => selected_items.Select(_key_selector);
public bool try_select(TKey key) {
public bool try_select(TKey key) =>
try_select(key, true);
public bool try_select(TKey key, bool reattempt_on_collection_change) {
if (items.TryGetFirst(i => _key_selector(i).Equals(key), out T result)) {
selected_items.Add(result);
return true;
} else {
} else if (reattempt_on_collection_change) {
if (_desired_keys.Count == 0) {
items.CollectionChanged += _on_items_CollectionChanged;
}
_desired_keys.Add(key);
return false;
}
return false;
}
void _on_items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) {
@@ -1,4 +1,5 @@
using mbts.ui.settings;
using bts.utils;
using mbts.ui.settings;
using System;
using System.Collections.Generic;
@@ -11,8 +12,9 @@ namespace bts.settings {
// should be exposed through explicitly named interfaces that inherit ISettingsMigrationRule<T>.
// This avoids magic const names in the MEF import/export contracts, which would otherwise be needed to
// determine the various windows to which such rules apply.
interface IPAndLGridSettingsMigrationRule : ISettingsMigrationRule<GridSettings> { }
interface IFillsGridSettingsMigrationRule : ISettingsMigrationRule<GridSettings> { }
interface IMarketViewGridSettingsMigrationRule : ISettingsMigrationRule<GridSettings> { }
interface IPAndLGridSettingsMigrationRule : ISettingsMigrationRule<GridSettings> { }
static class SettingsMigrationHelper {
public static bool apply<T>(T settings, IEnumerable<ISettingsMigrationRule<T>> migration_rules, out T new_settings) {
@@ -35,6 +37,9 @@ namespace bts.settings {
public static ISettingsMigrationRule<T> merge<T>(this IEnumerable<ISettingsMigrationRule<T>> rules) =>
new MergeWrapper<T>(rules);
public static ISettingsMigrationRule<TOuter> wrap<TInner, TOuter>(this ISettingsMigrationRule<TInner> rule, IImmutableProperty<TOuter, TInner> propi) =>
new SelectorWrapper<TInner, TOuter>(rule, propi.get, propi.set);
public static ISettingsMigrationRule<TOuter> wrap<TInner, TOuter>(this ISettingsMigrationRule<TInner> rule, Func<TOuter, TInner> get, Func<TOuter, TInner, TOuter> set) =>
new SelectorWrapper<TInner, TOuter>(rule, get, set);
@@ -20,22 +20,32 @@ namespace mbts.persist {
class UserSettingsHub {
// do NOT CHANGE these consts, they represent a file path on the server
const string NAME_SPACE = "settings", DEFAULT_KEY = "default";
IUserPersist _persist;
UserSettings _default_settings;
readonly BehaviorSubject<UserSettings> _default_settings_subject = new BehaviorSubject<UserSettings>(UserSettings.factory_defaults);
static readonly IImmutableProperty<UserSettings, GridSettings>
_fills_propi = ImmutableProperty.create<UserSettings, GridSettings>(us => us.fills_grid, (us, gs) => us.with(provided_fills_gridsettings: gs)),
_mview_propi = ImmutableProperty.create<UserSettings, GridSettings>(us => us.market_view_grid, (us, gs) => us.with(provided_market_view_gridsettings: gs)),
_pandl_propi = ImmutableProperty.create<UserSettings, GridSettings>(us => us.pnl_grid, (us, gs) => us.with(provided_pnl_gridsettings: gs));
readonly object _default_settings_lock = new object();
readonly IEnumerable<IPAndLGridSettingsMigrationRule> _pandl_migration_rules;
readonly BehaviorSubject<UserSettings> _default_settings_subject = new BehaviorSubject<UserSettings>(UserSettings.factory_defaults);
readonly IEnumerable<IFillsGridSettingsMigrationRule> _fills_migration_rules;
readonly IEnumerable<IMarketViewGridSettingsMigrationRule> _mview_migration_rules;
readonly IEnumerable<IPAndLGridSettingsMigrationRule> _pandl_migration_rules;
readonly IUserPersist _persist;
UserSettings _default_settings;
[ImportingConstructor]
public UserSettingsHub(
IUserPersist persist,
[ImportMany]IEnumerable<IPAndLGridSettingsMigrationRule> pandl_migration_rules,
[ImportMany]IEnumerable<IMarketViewGridSettingsMigrationRule> mview_migration_rules) {
[ImportMany]IEnumerable<IFillsGridSettingsMigrationRule> fills_migration_rules,
[ImportMany]IEnumerable<IMarketViewGridSettingsMigrationRule> mview_migration_rules,
[ImportMany]IEnumerable<IPAndLGridSettingsMigrationRule> pandl_migration_rules) {
//
_persist = persist;
_pandl_migration_rules = pandl_migration_rules ?? Enumerable.Empty<IPAndLGridSettingsMigrationRule>();
_fills_migration_rules = fills_migration_rules ?? Enumerable.Empty<IFillsGridSettingsMigrationRule>();
_mview_migration_rules = mview_migration_rules ?? Enumerable.Empty<IMarketViewGridSettingsMigrationRule>();
_pandl_migration_rules = pandl_migration_rules ?? Enumerable.Empty<IPAndLGridSettingsMigrationRule>();
init();
async void init() {
UserSettings s;
@@ -43,8 +53,9 @@ namespace mbts.persist {
s = await _persist.get<UserSettings>(NAME_SPACE, DEFAULT_KEY);
if (s != null) {
var wrapped_rules = new[] {
_pandl_migration_rules.merge().wrap<GridSettings, UserSettings>(us => us.pnl_grid, (us, gs) => us.with(provided_pnl_gridsettings: gs)),
_mview_migration_rules.merge().wrap<GridSettings, UserSettings>(us => us.market_view_grid, (us, gs) => us.with(provided_market_view_gridsettings: gs))
_fills_migration_rules.merge().wrap(_fills_propi),
_mview_migration_rules.merge().wrap(_mview_propi),
_pandl_migration_rules.merge().wrap(_pandl_propi)
};
SettingsMigrationHelper.apply_quiet(ref s, wrapped_rules);
// TODO: move ladder sanitization logic into ISettingsMigrationRule
@@ -80,13 +91,6 @@ namespace mbts.persist {
}
}
// indicates whether or not the settings have been loaded from the server (this happens once, on startup - see the constructor for details)
public bool initialized { get; private set; }
/// Subscribing via _persist.subscribe may be cleaner in theory, however using a local event allows observers to be notified immediately.
/// Assuming there aren't any rogue agents saving UserSettings by themselves, there should never be any discrepancies.
public IObservable<UserSettings> subscribe_default_settings() => _default_settings_subject.AsObservable();
internal UserSettings current {
get {
lock (_default_settings_lock)
@@ -94,19 +98,30 @@ namespace mbts.persist {
}
}
public IWindowSettingsManager<GridSettings> create_pandl_settings_manager(GridSettings instance_settings) =>
// indicates whether or not the settings have been loaded from the server (this happens once, on startup - see the constructor for details)
public bool initialized { get; private set; }
/// Subscribing via _persist.subscribe may be cleaner in theory, however using a local event allows observers to be notified immediately.
/// Assuming there aren't any rogue agents saving UserSettings by themselves, there should never be any discrepancies.
public IObservable<UserSettings> subscribe_default_settings() => _default_settings_subject.AsObservable();
public IWindowSettingsManager<GridSettings> create_fills_settings_manager(GridSettings instance_settings) =>
_create_settings_manager(
instance_settings,
_pandl_migration_rules,
us => us.pnl_grid,
(us, gs) => us.with(provided_pnl_gridsettings: gs));
_fills_migration_rules,
_fills_propi);
public IWindowSettingsManager<GridSettings> create_mview_settings_manager(GridSettings instance_settings) =>
_create_settings_manager(
instance_settings,
_mview_migration_rules,
us => us.market_view_grid,
(us, gs) => us.with(provided_market_view_gridsettings: gs));
_mview_propi);
public IWindowSettingsManager<GridSettings> create_pandl_settings_manager(GridSettings instance_settings) =>
_create_settings_manager(
instance_settings,
_pandl_migration_rules,
_pandl_propi);
public async Task save_default(UserSettings value) {
// notify observers before persisting so the changes are reflected immediately in the ui
@@ -116,10 +131,10 @@ namespace mbts.persist {
await _persist_async();
}
IWindowSettingsManager<T> _create_settings_manager<T>(T instance_settings, IEnumerable<ISettingsMigrationRule<T>> migration_rules, Func<UserSettings, T> get, Func<UserSettings, T, UserSettings> set) where T : class {
IWindowSettingsManager<T> _create_settings_manager<T>(T instance_settings, IEnumerable<ISettingsMigrationRule<T>> migration_rules, IImmutableProperty<UserSettings, T> propi) where T : class {
if (instance_settings != null && migration_rules.merge().apply(instance_settings, out var new_settings))
instance_settings = new_settings;
return new WindowSettingsManager<T>(this, instance_settings, get, set);
return new WindowSettingsManager<T>(this, instance_settings, propi.get, propi.set);
}
async Task _persist_async() {
@@ -0,0 +1,31 @@
using System;
namespace bts.utils {
/// <summary>
/// A property-like interface (with get/set accessors) in the immutable pattern. The 'set' method returns a new instance of <typeparamref name="TSource"/>, rather than mutating the original.
/// </summary>
/// <typeparam name="TSource">The type of source, from which the value is read, and to which it is written.</typeparam>
/// <typeparam name="T">The type of value read from, and written to, the source.</typeparam>
interface IImmutableProperty<TSource, T> {
T get(TSource source);
TSource set(TSource source, T value);
}
static class ImmutableProperty {
public static IImmutableProperty<TSource, T> create<TSource, T>(Func<TSource, T> get, Func<TSource, T, TSource> set) =>
new Impl<TSource, T>(get, set);
class Impl<TSource, T> : IImmutableProperty<TSource, T> {
readonly Func<TSource, T> _get;
readonly Func<TSource, T, TSource> _set;
public Impl(Func<TSource, T> get, Func<TSource, T, TSource> set) {
_get = get;
_set = set;
}
public T get(TSource source) => _get(source);
public TSource set(TSource source, T value) => _set(source, value);
}
}
}
@@ -16,7 +16,7 @@ namespace mbts.ui.controls {
}
public IDataGridColumnFilter filter { get; }
public virtual string filter_template => DataGridFilterKnownTemplates.DiscreteValues;
public virtual string filter_template => DataGridFilterKnownTemplates.AlgoType;
public BindingBase font_weight_binding { get; set; }
public override FrameworkElement view_factory() {
@@ -63,8 +63,24 @@ namespace mbts.spark.filters {
) => new DynamicItemsFilter<TRow, TValue, TState>(items, get_row_val, get_state, load_state, prop_name, equality_comparer ?? EqualityComparer<TValue>.Default, comparer);
public static IDataGridColumnPersistentFilter<TRow, TKey[]> CreateTableUpdate<TRow, TValue, TKey>(
Func<TRow, TValue> factory, Func<TValue, TKey> key, out IObserver<TableUpdate<TValue, TKey>> items_observer, out ListCollectionView<TValue> items_view) where TKey : struct, IEquatable<TKey> {
var filter = new TableUpdateItemsFilter<TRow, TValue, TKey, TKey[]>(factory, key, keys => keys, keys => keys.ToArray());
Func<TRow, TValue> factory,
Func<TValue, TKey> key,
out IObserver<TableUpdate<TValue, TKey>> items_observer,
out ListCollectionView<TValue> items_view)
where TKey : struct, IEquatable<TKey> =>
//
CreateTableUpdate(factory, key, keys => keys, keys => keys.ToArray(), out items_observer, out items_view);
public static IDataGridColumnPersistentFilter<TRow, TState> CreateTableUpdate<TRow, TValue, TKey, TState>(
Func<TRow, TValue> factory,
Func<TValue, TKey> key,
Func<TState, IEnumerable<TKey>> load_state,
Func<IEnumerable<TKey>, TState> get_state,
out IObserver<TableUpdate<TValue, TKey>> items_observer,
out ListCollectionView<TValue> items_view)
where TKey : struct, IEquatable<TKey> {
//
var filter = new TableUpdateItemsFilter<TRow, TValue, TKey, TState>(factory, key, load_state, get_state);
items_observer = filter;
items_view = filter.items_view;
return filter;
@@ -297,7 +313,7 @@ namespace mbts.spark.filters {
_items.Replace(_key(ch.Old), ch.New);
foreach (var v in table.added)
_items.Add(v);
var newly_selected_keys = _desired_keys.Where(_selection_model.try_select).ToList();
var newly_selected_keys = _desired_keys.Where(k => _selection_model.try_select(k, false)).ToList();
if (newly_selected_keys.Count > 0) {
_selected_keys.AddRange(newly_selected_keys);
_desired_keys.removeRange(newly_selected_keys);
@@ -323,7 +339,7 @@ namespace mbts.spark.filters {
protected override bool _filter(TValue value) => _selected_keys.Contains(_key(value));
protected override void _load_state_internal(TState state) {
foreach (var k in _load_state(state).empty_if_null()) {
if (!_selection_model.try_select(k))
if (!_selection_model.try_select(k, false))
_desired_keys.Add(k);
}
}
@@ -16,6 +16,9 @@ namespace mbts.ui.converters {
public static IMultiValueConverter create<TIn1, TIn2, TIn3, TOut>(Func<TIn1, TIn2, TIn3, TOut> convert) =>
new AnonymousMultiValueConverter<TIn1, TIn2, TIn3, TOut>(convert);
public static IMultiValueConverter create<TIn1, TIn2, TIn3, TIn4, TOut>(Func<TIn1, TIn2, TIn3, TIn4, TOut> convert) =>
new AnonymousMultiValueConverter<TIn1, TIn2, TIn3, TIn4, TOut>(convert);
}
static class ValueConverters {
@@ -92,4 +95,17 @@ namespace mbts.ui.converters {
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
}
class AnonymousMultiValueConverter<TIn1, TIn2, TIn3, TIn4, TOut> : IMultiValueConverter {
readonly Func<TIn1, TIn2, TIn3, TIn4, TOut> _convert;
public AnonymousMultiValueConverter(Func<TIn1, TIn2, TIn3, TIn4, TOut> convert) => _convert = convert;
public TOut ErrorValue { get; set; }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) =>
ConvertUtils.try_convert_args(values, out TIn1 a, out TIn2 b, out TIn3 c, out TIn4 d) ? _convert(a, b, c, d) : ErrorValue;
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
}
}
+11 -3
View File
@@ -213,10 +213,18 @@ namespace bts.md
return _data.Values.Where(filt);
}
public SecurityImmutable? find_security(Func<SecurityImmutable, bool> filter)
public SecurityImmutable? find_security(Func<SecurityImmutable, bool> filter, TimeSpan? timeout = null)
{
var fnd = find(filter).TryFirst();
return fnd?.security;
var deadline = DateTime.UtcNow;
if (timeout.HasValue) deadline += timeout.Value;
do {
var fnd = find(filter).TryFirst();
if (fnd.HasValue) {
return fnd?.security;
}
Thread.Sleep(100);
} while (DateTime.UtcNow < deadline);
return null;
}
public async Task<SecurityImmutable?> find_security_async(Func<SecurityImmutable, bool> filter, TimeSpan? timeout = null)
+14 -15
View File
@@ -36,7 +36,7 @@ namespace bts.sdk
Console.WriteLine();
}
public async Task<Result<Response>> send_order(string user, string account ,
public Response send_order(string user, string account ,
string exch, string sectype, string symbol, string security_desc, string qty, string price = null)
{
Venue ven = MarketDataSample.parse_venue(exch);
@@ -49,7 +49,7 @@ namespace bts.sdk
int quan = int.Parse(qty);
Create cr = new Create();
await order_setup(cr, user, account);
order_setup(cr, user, account);
cr.Price = px;
cr.Quantity = Convert.ToUInt32(Math.Abs(quan));
cr.NewOrder.Side = quan < 0 ? Side.Sell : Side.Buy;
@@ -57,12 +57,15 @@ namespace bts.sdk
cr.NewOrder.CustomDef = new CustomOrderDefinition() { Limit = new LimitOrderDefinition() };
else
cr.NewOrder.CustomDef = new CustomOrderDefinition() { Market = new MarketOrderDefinition() };
var sec = await _md.find_security_async(x => x.Glbx.SecurityDesc == security_desc.ToUpper());
Console.WriteLine("Fetching security details...");
var sec = _md.find_security(x => x.Glbx.SecurityDesc == security_desc.ToUpper(), TimeSpan.FromSeconds(30));
if (!sec.HasValue) {
Console.WriteLine($"Failed to find security {security_desc}.");
return null;
}
cr.NewOrder.SecurityKey = sec.Value.Id;
Result<Response> resp = await _orders.Value.create_order_async(cr);
Response resp = _orders.Value.create_order(cr);
print_update(resp);
if(resp.value != null)
print_update(resp.value);
//subscribei_ subscribes to a stream of Immutable (in this case FillImmutable) which is nice if you know you don't want to change the fills, which you dont'
_disps.Add(_orders.Value.subscribei_fills().Subscribe(x =>
{
@@ -80,7 +83,7 @@ namespace bts.sdk
return resp;
}
static async Task order_setup(Create cr, string username, string accountname)
static void order_setup(Create cr, string username, string accountname)
{
cr.NewOrder = new OrderDefinition();
cr.NewOrder.ManualOrderIndicator = ManualOrderIndicator.Yes;
@@ -88,12 +91,8 @@ namespace bts.sdk
cr.NewOrder.CustomerOrFirm = CustomerOrFirm.Firm;
cr.NewOrder.SubType = OrderSubType.None;
cr.NewOrder.TimeInForce = TimeInForce.Day;
var admin = await _admin.Value.get_admin_data_async(new VoidMessage());
if (!admin.success) {
Console.Error.WriteLine(admin.error_message);
return;
}
BTSUser user = admin.value.Users.FirstOrDefault( x=> username != null ? x.Name.ToLowerInvariant() == username.ToLowerInvariant() : true );
var admin = _admin.Value.get_admin_data(new VoidMessage());
BTSUser user = admin.Users.FirstOrDefault( x=> username != null ? x.Name.ToLowerInvariant() == username.ToLowerInvariant() : true );
if (user != null)
{
cr.NewOrder.UserId = (uint)user.Id;
@@ -102,11 +101,11 @@ namespace bts.sdk
{
var accid = user.UserData.AccountPermissions.AccountPermissions.FirstOrDefault();
cr.NewOrder.AccountId = (uint)accid.Key;
cr.NewOrder.Account = admin.value.Accounts.First(x => x.Id == accid.Key).Name;
cr.NewOrder.Account = admin.Accounts.First(x => x.Id == accid.Key).Name;
}
else
{
var acc = admin.value.Accounts.FirstOrDefault(x => x.Name.ToLowerInvariant() == accountname.ToLowerInvariant());
var acc = admin.Accounts.FirstOrDefault(x => x.Name.ToLowerInvariant() == accountname.ToLowerInvariant());
if (acc != null)
{
cr.NewOrder.Account = acc.Name;
+34 -37
View File
@@ -13,28 +13,25 @@ namespace bts.sdk
public class SDKMain
{
static async Task<LoginResult> login(string user, string pass)
{
return await Locator.login(user, pass);
}
private static void user_test()
private static void user_test(ServiceContext ctx)
{
var s = Locator.locate<api.user.AuthService>();
var s = ctx.locate<api.user.AuthService>();
var r = new api.user.GetUsersRequest();
var resp = s.get_users(r);
Console.WriteLine("{0}", resp);
}
public async static Task Main(string[] args)
public static void Main(string[] args)
{
BTS.init();
Log.ClientSdk.info("Welcome to the BTS Client Side SDK example");
var ctx = new ServiceContext();
string u = args.FirstOrDefault(x => x.Contains("--user="));
string p = args.FirstOrDefault(x => x.Contains("--pass="));
u = u?.Replace("--user=", string.Empty) ?? string.Empty;
p = p?.Replace("--pass=", string.Empty) ?? string.Empty;
var lr = await login(u, p);
var lr = ctx.login(u,p).Result;
if (!lr.success)
{
Console.WriteLine("Login failure: " + lr.reason);
@@ -43,7 +40,7 @@ namespace bts.sdk
if (args.FirstOrDefault() == "users")
{
user_test();
user_test(ctx);
}
else
{
@@ -52,55 +49,56 @@ namespace bts.sdk
if (pu != null)
ms = uint.Parse(p.Replace("--pump=", string.Empty));
MarketDataClient client = new MarketDataClient(ms, Locator.token);
CompositeDisposable disp = new CompositeDisposable(client);
if (args.Length > 0 && args.FirstOrDefault().Contains("md"))
{
var s = new MarketDataSample(client);
if (args.FirstOrDefault() == "md")
MarketDataClient client = new MarketDataClient(ms, ctx.token);
using(var disp = new CompositeDisposable(client)) {
if (args.Length > 0 && args.FirstOrDefault().Contains("md"))
{
if (args.Length >= 5)
var s = new MarketDataSample(client);
if (args.FirstOrDefault() == "md")
{
s.print_security(args[1], args[2], args[3], args[4]);
}
else if (args.Length >= 4)
{
s.print_product(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_product(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, u, args);
}
else
md_help();
}
else if (args.FirstOrDefault() == "order")
{
OrderSample os = new OrderSample(client);
disp.Add(os);
order_sample(os, u, args);
}
else
help();
help();
wait_for_stop(disp);
wait_for_stop();
}
}
}
static async void order_sample(OrderSample os, string user, string[] args)
static void order_sample(OrderSample os, string user, string[] args)
{
if (args.Length >= 10) //--user and --pass are in args[]
{
await os.send_order(user, args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
os.send_order(user, args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
}
else if (args.Length >= 9)
{
await os.send_order(user, args[1], args[2], args[3], args[4], args[5], args[6]);
os.send_order(user, args[1], args[2], args[3], args[4], args[5], args[6]);
}
else
order_help();
}
static void wait_for_stop(IDisposable disp)
static void wait_for_stop()
{
Console.WriteLine("Hit q to stop");
ConsoleKeyInfo c;
@@ -109,7 +107,6 @@ namespace bts.sdk
c = Console.ReadKey();
Console.WriteLine();
} while (c.KeyChar != 'q');
disp.Dispose();
}
static void help()
+1 -1
View File
@@ -4,7 +4,7 @@ Logging {
console { default_level: "Error" }
syslog { default_level: "Info" }
file { default_level: "Info" }
initial_queue_size: 128
initial_queue_size: 1024
max_queue_growth: 100
}
}
+12 -1
View File
@@ -6,4 +6,15 @@ GMI_SymbolMap {
sym { gmi: "05" spark: "ZS" venue: VENUE_GLBX price_multiplier: 100.0}
sym { gmi: "KW" spark: "KE" venue: VENUE_GLBX price_multiplier: 100.0}
}
}
}
GMI_Import {
rule: "DeploymentType.type == 'DEV'"
value {
sftp_host: "10.96.18.41"
sftp_port: 22222
sftp_user: "PaTeACYB"
sftp_password: "DLXKuVK8"
}
}
+5 -4
View File
@@ -4,10 +4,11 @@ package bts.config;
message GMI_Import
{
required string sftp_host = 10 [default = "10.96.18.41"];
optional uint32 sftp_port = 11 [default = 22222];
required string sftp_user = 12 [default = "sftp"];
required string sftp_password = 2 [default = "sftp"];
required string sftp_host = 10 ;
optional uint32 sftp_port = 11 ;
required string sftp_user = 12 ;
required string sftp_password = 2 ;
required int32 pause_between_downloads_seconds = 4 [default = 30];
required int32 download_timeout_seconds = 5 [default = 35];
optional string download_window_begin = 6 [default = "22:00"];
+1
View File
@@ -164,6 +164,7 @@ string dump_entry(const ColdEntry& entry) {
if (entry.misc.settlement_date.year > 0) res << "'settlement_date': " << dump(entry.misc.settlement_date) << ", ";
if (!(entry.misc.previous_settlement_price.is_nan())) res << "'previous_settlement_price': " << entry.misc.previous_settlement_price.price() << ", ";
if (entry.misc.previous_settlement_date.year > 0) res << "'previous_settlement_date': " << dump(entry.misc.previous_settlement_date) << ", ";
res << "'status': " << co2::TradingStatus_Name(entry.exchange_status) << " ";
res << "'deleted': " << std::boolalpha << entry.deleted << " ";
res << "}";
return res.str();
+21
View File
@@ -213,6 +213,27 @@ public:
}
}
co2::TradingStatus trading_status() const {
switch(_type) {
case HANDLETYPE_DEPTH: return book.cdata->exchange_status;
case HANDLETYPE_BBO: return bbo.cdata->exchange_status;
case HANDLETYPE_SYNTHETIC: {
// Return the status if all legs match otherwise return TRADINGSTATUS_UNKNOWN
if (synthetic.def->legs.size() > 0) {
auto status = synthetic.def->legs.front().trading_status();
for (const auto& leg : synthetic.def->legs) {
if (leg.trading_status() != status) break;
}
return status;
}
return co2::TRADINGSTATUS_UNKNOWN;
}
default:
case HANDLETYPE_VOID:
return co2::TRADINGSTATUS_UNKNOWN;
}
}
TimeStamp last_market_update() const {
switch(_type) {
case HANDLETYPE_VOID:
+4 -2
View File
@@ -148,8 +148,10 @@ void MDProducerHandle::add_rfq(TimeStamp, const co2::QuoteRequestMessage& rfq) {
}
void MDProducerHandle::update_exchange_status(TimeStamp, TradingStatus status) {
cdata().exchange_status = status;
cheader().exchange_status_count++;
if (status != TRADINGSTATUS_NO_CHANGE) {
cdata().exchange_status = status;
cheader().exchange_status_count++;
}
}
void MDProducerHandle::update_settlement(TimeStamp time, IntPrice price, Date date) {
+1
View File
@@ -29,6 +29,7 @@ enum TradingStatus {
TRADINGSTATUS_NO_CANCEL = 12; // CME
TRADINGSTATUS_POST_CLOSE = 13;
TRADINGSTATUS_NO_CHANGE = 14;
TRADINGSTATUS_NOT_AVAILABLE = 15; // CME NotAvailableForTrading
}
+43 -2
View File
@@ -11,6 +11,7 @@
#include "lib/orderman/events/BookUpdateEvent.h"
#include "lib/orderman/events/MDRequestEvent.h"
#include "lib/orderman/events/TickerUpdateEvent.h"
#include "lib/orderman/events/StatusUpdateEvent.h"
#include "lib/tracing/PerfLog.h"
#include "lib/tracing/bts_trace.h"
#include "lib/utils/TimeStamp.h"
@@ -30,7 +31,8 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
public:
MDSource(md::MDConsumer &consumer, metrics::MetricsContainer &stats,
trace::PerfLog &log)
: _handles(), _md_consumer(consumer), _book_update(), _ticker_update(),
: _handles(), _status_subs(), _md_consumer(consumer),
_book_update(), _ticker_update(), _status_update(),
_perf_log(log), _stats(stats), _loop_timer() {
_trades_buffer.Reserve(1000);
@@ -65,15 +67,20 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
auto ticker_channel_cout_metric =
std::make_shared<metrics::CounterMetric<int>>(
"spark_mdsource_ticker_channel_count");
auto status_count_metric =
std::make_shared<metrics::CounterMetric<int>>(
"spark_mdsource_status_count");
_stats.publish(security_count_metric);
_stats.publish(synthetic_count_metric);
_stats.publish(ticker_channel_cout_metric);
_stats.publish(status_count_metric);
_book_update = make_stream<BookUpdateEvent>();
_ticker_update = make_stream<TickerUpdateEvent>();
_status_update = make_stream<StatusUpdateEvent>();
subscribe<MDRequestEvent>(
[this, security_count_metric, synthetic_count_metric,
ticker_channel_cout_metric](auto const &update) {
ticker_channel_cout_metric, status_count_metric](auto const &update) {
if (update.events) {
for (auto const &ev : *update.events) {
auto k = ev.security_key;
@@ -86,6 +93,10 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
case MDRequestType::TICKER:
on_ticker_sub(k, *ticker_channel_cout_metric);
break;
case MDRequestType::STATUS:
on_status_sub(k);
status_count_metric->set(_status_subs.size());
break;
}
}
}
@@ -146,6 +157,15 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
}
}
// Status updates
for (auto& s : _status_subs) {
auto status = s.handle.trading_status();
if (status != s.status) {
s.status = status;
publish(_status_update, SecurityKey { s.handle.key() }, status);
}
}
// Publish stats
auto stop = utils::TimeStamp::now();
_loop_timer->observe((start - stop).nanoseconds());
@@ -220,6 +240,20 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
c.securities.push_back(sk);
_channels.push_back(c);
}
void on_status_sub(SecurityKey sk) {
auto k = sk.value();
for (auto& h : _status_subs) {
if (h.handle.key() == k) {
// reset status so it get resent next on_poll
h.status = co2::TRADINGSTATUS_UNKNOWN;
return;
}
}
auto handle = _md_consumer.get_handle(k);
_status_subs.push_back(StatusRecord{ handle, co2::TRADINGSTATUS_UNKNOWN });
}
struct HandleRecord {
utils::TimeStamp last;
md::MDConsumerHandle handle;
@@ -237,9 +271,16 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
boost::container::small_vector<ChannelRecord, 3> _channels;
google::protobuf::RepeatedPtrField<co2::TradeMessage> _trades_buffer;
struct StatusRecord {
md::MDConsumerHandle handle;
co2::TradingStatus status;
};
boost::container::small_vector<StatusRecord,20> _status_subs;
md::MDConsumer _md_consumer;
mercury::Stream<BookUpdateEvent> _book_update;
mercury::Stream<TickerUpdateEvent> _ticker_update;
mercury::Stream<StatusUpdateEvent> _status_update;
trace::PerfLog &_perf_log;
metrics::MetricsContainer &_stats;
std::shared_ptr<metrics::HistogramMetric<30>> _loop_timer;
+6 -6
View File
@@ -24,14 +24,14 @@ _sod_time(sod_time){
LOG(persist, Info, "SODPosition::cons sod_time:{}", sod_time.tv_sec);
}
// returns the timeval for today's hh,mm,ss (in local machine terms)
// (timeval is the microseconds from epoch)
// returns the timeval (secs/usecs from epoch) for today's hh,mm,ss
// (in local machine time zone)
timeval SODPosition::to_timeval(uint16_t hh, uint16_t mm, uint16_t ss) {
// function does the conversion the following way:
// 1. gets the now secs from epoch using time
// 2. converts it into local time (so we have now local time)
// 3. overrides the hh, mm, ss passed
// 4. converts it back into secs from epoch using mktime
// 1. gets the secs from epoch (time_t)
// 2. converts it into local time
// 3. overrides the hh, mm, ss for local time with the func args
// 4. converts it back into timeval
bts_assert(hh < 24);
bts_assert(mm < 60);
bts_assert(ss < 60);
@@ -519,6 +519,9 @@ void OrderManager::init_order_services() {
std::function<void(SecurityKey)> on_ticker_sub = [this](SecurityKey k) {
publish(me->services_data.md_request_pub, k, MDRequestType::TICKER);
};
std::function<void(SecurityKey)> on_status_sub = [this](SecurityKey k) {
publish(me->services_data.md_request_pub, k, MDRequestType::STATUS);
};
std::function<void(SecurityKey)> on_settlement_sub = [this](SecurityKey k) {
publish(me->services_data.settlement_request_pub, k);
};
@@ -537,6 +540,9 @@ void OrderManager::init_order_services() {
me->services_data.ticker_subs =
std::make_unique<ContentSubscription<TickerUpdateEvent>>(
*this, on_ticker_sub, log);
me->services_data.status_subs =
std::make_unique<ContentSubscription<StatusUpdateEvent>>(
*this, on_status_sub, log);
me->services_data.settlement_subs =
std::make_unique<ContentSubscription<SettlementUpdateEvent>>(
*this, on_settlement_sub, log);
@@ -11,8 +11,8 @@ std::function<void(OrderOpResult const &)> OrderServices::ignore =
OrderServices::OrderServices(Order &owner)
: _busy(false), _pending_calls(), _owner(&owner), _data(), _parent(nullptr),
_child_update_cb([](auto const &) {}), _book_updates(), _ticker_updates(),
_settlement_updates(), _time_change(), _sessions() {
_child_update_cb([](auto const &) {}), _book_updates(), _ticker_updates(),
_status_updates(), _settlement_updates(), _time_change(), _sessions() {
_last_state_update.key = null_order_key();
}
@@ -29,6 +29,7 @@ void OrderServices::init(OrderServicesData &data) {
_data = &data;
_book_updates.init(*data.md_subs);
_ticker_updates.init(*data.ticker_subs);
_status_updates.init(*data.status_subs);
_settlement_updates.init(*data.settlement_subs);
_time_change.init(*data.time_subs);
if (_sessions.empty())
@@ -70,6 +71,7 @@ void OrderServices::report_state(const api::orderman::OrderState &state) {
unsubscribe_from_child_updates();
_book_updates.unsub_all();
_ticker_updates.unsub_all();
_status_updates.unsub_all();
_settlement_updates.unsub_all();
_time_change.unsub_all();
_create_order_reply.unsub_all();
@@ -7,6 +7,7 @@
#include "lib/orderman/actors/order_manager/OrderServicesData.h"
#include "lib/orderman/actors/order_manager/SessionServices.h"
#include "lib/orderman/events/TickerUpdateEvent.h"
#include "lib/orderman/events/StatusUpdateEvent.h"
#include "lib/orderman/governor/Governor.h"
#include "lib/orderman/orderman_utils/EventStream.h"
#include "lib/orderman/orders/Order.h"
@@ -96,6 +97,13 @@ class OrderServices {
k, [this, cb](auto const &ev) { this->on_external_event(ev, cb); });
}
void unsubscribe_from_ticker(TickerSubID sid) { _ticker_updates.unsub(sid); }
// Trading Status
using StatusSubID = EventStream<StatusUpdateEvent>::SubID;
template <class CB> StatusSubID subscribe_to_status(SecurityKey k, CB&& cb) {
return _status_updates.sub(
k, [this,cb](const auto& ev) { this->on_external_event(ev,cb); });
}
void unsubscribe_from_status(StatusSubID sid) { _status_updates.unsub(sid); }
// Settlement
using SettlementSubID = EventStream<SettlementUpdateEvent>::SubID;
template <class CB>
@@ -106,7 +114,6 @@ class OrderServices {
void unsubscribe_from_settlements(SettlementSubID sid) {
_settlement_updates.unsub(sid);
}
// Settlement
// Time
template <class CB> void subscribe_to_time(CB &&cb) {
@@ -288,6 +295,7 @@ class OrderServices {
OrderStateUpdateEvent _last_state_update;
EventStream<BookUpdateEvent> _book_updates;
EventStream<TickerUpdateEvent> _ticker_updates;
EventStream<StatusUpdateEvent> _status_updates;
EventStream<SettlementUpdateEvent> _settlement_updates;
EventStream<mercury::TimerEvent, mercury::NoKey> _time_change;
boost::container::small_vector<SessionServices, 20> _sessions;
@@ -13,6 +13,7 @@
#include "lib/orderman/events/ActivateOrderEvent.h"
#include "lib/orderman/events/BookUpdateEvent.h"
#include "lib/orderman/events/TickerUpdateEvent.h"
#include "lib/orderman/events/StatusUpdateEvent.h"
#include "lib/orderman/events/CancelOrderEvent.h"
#include "lib/orderman/events/CancelRejectEvent.h"
#include "lib/orderman/events/DetachOrderEvent.h"
@@ -91,6 +92,7 @@ class OrderServicesData {
OrderFactory order_factory;
std::unique_ptr<mercury::ContentSubscription<BookUpdateEvent>> md_subs;
std::unique_ptr<mercury::ContentSubscription<TickerUpdateEvent>> ticker_subs;
std::unique_ptr<mercury::ContentSubscription<StatusUpdateEvent>> status_subs;
trace::CorID cor_id;
std::unique_ptr<mercury::ContentSubscription<SettlementUpdateEvent>>
settlement_subs;
+1 -1
View File
@@ -8,7 +8,7 @@
namespace bts {
namespace orderman {
enum class MDRequestType { BOOK, TICKER };
enum class MDRequestType { BOOK, TICKER, STATUS };
class MDRequestEvent : public mercury::Event<MDRequestEvent> {
public:
@@ -0,0 +1,23 @@
#pragma once
#include <memory>
#include "lib/mercury/events/Event.h"
#include "lib/orderman/orderman_utils/Book.h"
#include "lib/orderman/orderman_utils/orderman_common.h"
#include "lib/tracing/PerfLog.h"
namespace bts {
namespace orderman {
class StatusUpdateEvent : public mercury::Event<StatusUpdateEvent> {
SecurityKey _key;
public:
using SynopsisPolicy = mercury::NoSynopsis;
co2::TradingStatus status;
trace::CorID trace;
SecurityKey key() const { return _key; }
StatusUpdateEvent(SecurityKey key, co2::TradingStatus status) :
_key(key), status(status), trace() { }
};
}}
@@ -57,6 +57,7 @@ struct AlgoWrapperOrder::PImpl {
Map<SecurityKey, OrderServices::BookSubID> book_subs;
Map<SecurityKey, OrderServices::TickerSubID> ticker_subs;
Map<SecurityKey, OrderServices::StatusSubID> status_subs;
Map<OrderKey, ChildRecord> children;
bool has_timer_sub = false;
@@ -434,6 +435,26 @@ void AlgoWrapperOrder::unsubscribe_ticker(SecurityKey k) {
if (auto it = me->ticker_subs.find(k); it != me->ticker_subs.end())
me->services->unsubscribe_from_ticker(it->second);
}
void AlgoWrapperOrder::subscribe_status(SecurityKey k) {
if (!is_working()) return;
bts_assert(me->status_subs.find(k) == me->status_subs.end());
me->status_subs[k] =
me->services->subscribe_to_status(k, [this,k](const auto& ev) {
ReportStateGuard _(*this);
me->algo->on_status(k, ev.status);
});
}
void AlgoWrapperOrder::unsubscribe_status(SecurityKey k) {
if (!is_working()) return;
bts_assert(me->status_subs.find(k) != me->status_subs.end());
auto it = me->status_subs.find(k);
if (it != me->status_subs.end()) {
me->services->unsubscribe_from_status(it->second);
}
}
void AlgoWrapperOrder::subscribe_child_change(OrderKey k) {
if (!is_working())
@@ -49,6 +49,9 @@ class AlgoWrapperOrder : public Order,
void unsubscribe_timer() override;
void subscribe_ticker(SecurityKey) override;
void unsubscribe_ticker(SecurityKey) override;
void subscribe_status(SecurityKey) override;
void unsubscribe_status(SecurityKey) override;
OrderKey launch_child(ChildTemplate &, Price, Quantity,
bool subscribe = true) override;
OrderKey launch_child(api::orderman::OrderDefinition const &, Price,
@@ -41,6 +41,9 @@ class IAlgoOrder {
// Trades stream for the specified security
virtual void on_ticker(SecurityKey, TradeVector const&) {};
// The trading status for the specified security has changed
virtual void on_status(SecurityKey, co2::TradingStatus) {};
// A periodic timer has fired
virtual void on_timer() {}
@@ -48,6 +48,10 @@ class IAlgoServices : public IBeforeLaunchAlgoServices {
virtual void subscribe_ticker(SecurityKey) = 0;
virtual void unsubscribe_ticker(SecurityKey) = 0;
// Subscribe to security trading status
virtual void subscribe_status(SecurityKey) = 0;
virtual void unsubscribe_status(SecurityKey) = 0;
// --------------------------------------------------------------
// Child management
// --------------------------------------------------------------
@@ -64,6 +64,7 @@ struct AlgoTestDriverBase::Impl : public RecursionCounter {
std::map<SecurityKey, Book> books;
std::map<SecurityKey, bool> book_subs;
std::map<SecurityKey, bool> ticker_subs;
std::map<SecurityKey, bool> status_subs;
bool sub_timer = false;
// Callbacks
@@ -163,6 +164,12 @@ void AlgoTestDriverBase::update_ticker(SecurityKey key, const TradeVector& data)
me->algo.on_ticker(key, data);
}
}
void AlgoTestDriverBase::update_status(SecurityKey key, co2::TradingStatus status) {
auto iter = me->status_subs.find(key);
if (iter != me->ticker_subs.end() && iter->second) {
me->algo.on_status(key,status);
}
}
void AlgoTestDriverBase::advance_time(Duration d, uint32_t steps) {
Duration dprime = d / steps;
for (uint32_t s = 0; s < steps; ++s) {
@@ -332,6 +339,13 @@ void AlgoTestDriverBase::unsubscribe_ticker(SecurityKey key) {
me->ticker_subs.erase(key);
}
void AlgoTestDriverBase::subscribe_status(SecurityKey key) {
me->status_subs[key] = true;
}
void AlgoTestDriverBase::unsubscribe_status(SecurityKey key) {
me->status_subs.erase(key);
}
void AlgoTestDriverBase::subscribe_child_change(OrderKey k) {
for (auto& child : me->orders) {
if (child.key == k) {
@@ -71,6 +71,7 @@ class AlgoTestDriverBase : private IAlgoServices {
void update_book(const Book&);
void update_ticker(SecurityKey, const TradeVector&);
void update_status(SecurityKey, co2::TradingStatus);
void advance_time(Duration, uint32_t steps=1);
IAlgoOrder::OnCancelResponse cancel();
@@ -117,6 +118,8 @@ private:
void unsubscribe_timer() override;
void subscribe_ticker(SecurityKey) override;
void unsubscribe_ticker(SecurityKey) override;
void subscribe_status(SecurityKey) override;
void unsubscribe_status(SecurityKey) override;
OrderKey launch_child(ChildTemplate &, Price, Quantity, bool) override;
OrderKey launch_child(api::orderman::OrderDefinition const &, Price,
@@ -242,12 +242,14 @@ void MDP3Listener::heartbeat() {
//
// Private functions
void MDP3Listener::add_security(const FixedSecurity& security) {
void MDP3Listener::add_security(const FixedSecurity& security, co2::TradingStatus status) {
bts_assert(security.numeric_id != 0);
// Set up the shared memory for this security
auto handle = _producer.add_security(security);
bts_assert(security.numeric_id != 0);
// Add it to the index so it can receive messages
_index.add_security(security.numeric_id, handle);
handle.update_exchange_status( utils::TimeStamp::now(), status);
}
void MDP3Listener::flush_books() {
@@ -64,6 +64,43 @@ inline inc::UpdateAction mbo_update_action(onixs::UpdateAction::Enum a) {
}
}
inline co2::TradingStatus map_status(onixs::SecurityTradingStatus::Enum ts) {
switch(ts) {
case onixs::SecurityTradingStatus::TradingHalt:
return co2::TRADINGSTATUS_HALTED;
case onixs::SecurityTradingStatus::Close:
return co2::TRADINGSTATUS_CLOSED;
case onixs::SecurityTradingStatus::NewPriceIndication:
return co2::TRADINGSTATUS_PRICE_INDICATION;
case onixs::SecurityTradingStatus::ReadyToTrade:
return co2::TRADINGSTATUS_NORMAL;
case onixs::SecurityTradingStatus::NotAvailableForTrading:
return co2::TRADINGSTATUS_NOT_AVAILABLE;
case onixs::SecurityTradingStatus::UnknownorInvalid:
return co2::TRADINGSTATUS_UNKNOWN;
case onixs::SecurityTradingStatus::PreOpen:
return co2::TRADINGSTATUS_PRE_OPEN;
case onixs::SecurityTradingStatus::PreCross:
return co2::TRADINGSTATUS_PRE_CROSS;
case onixs::SecurityTradingStatus::Cross:
return co2::TRADINGSTATUS_CROSS;
case onixs::SecurityTradingStatus::PostClose:
return co2::TRADINGSTATUS_POST_CLOSE;
case onixs::SecurityTradingStatus::NoChange:
return co2::TRADINGSTATUS_NO_CHANGE;
}
return co2::TRADINGSTATUS_UNKNOWN;
}
template <class T>
std::optional<co2::TradingStatus> security_trading_status(const T& t) {
onixs::SecurityTradingStatus::Enum status;
if (t.securityTradingStatus(status)) {
return { map_status(status) };
}
else return std::nullopt;
}
class MDP3Listener :
public onixs::HandlerListener,
@@ -153,6 +190,21 @@ public:
}
}
void onMessage(onixs::Handler&, const onixs::SecurityStatus30Args& args) override {
int exchange_id;
if (args.message().securityId(exchange_id)) {
auto data = _index.get_security(exchange_id);
if (data) {
auto status = security_trading_status(args.message());
if (status) {
data->handle.update_exchange_status(
utils::TimeStamp::now(),
status.value());
}
}
}
}
void onMessage(onixs::Handler&, const onixs::IncrementalRefreshOrderBook43Args& args) override {
onIncrementalRefreshOrderBook(args);
}
@@ -233,6 +285,24 @@ public:
}
void onMessage(onixs::Handler&, const onixs::SnapshotFullRefresh38Args& args) override {
onSnapshotFullRefresh(args.message());
}
void onMessage(onixs::Handler&, const onixs::SnapshotFullRefresh52Args& args) override {
onSnapshotFullRefresh(args.message());
}
template <typename SnapshotFullRefresh>
void onSnapshotFullRefresh(const SnapshotFullRefresh& message) {
auto data = _index.get_security(message.securityId());
if (data) {
auto status = security_trading_status(message);
if (status) {
data->handle.update_exchange_status(
utils::TimeStamp::now(),
status.value());
}
}
}
//
// Security discovery
@@ -338,7 +408,7 @@ public:
void heartbeat();
// Add a new security to the index
void add_security(const FixedSecurity& security);
void add_security(const FixedSecurity& security, co2::TradingStatus);
private:
enum SecurityFilterAction { ADD, SKIP, DELETE };
@@ -429,7 +499,9 @@ void MDP3Listener::onFuture(onixs::Handler&, const onixs::Security& osec, const
fsec.expiration_year = expiration.year;
fsec.expiration_month = expiration.month;
fsec.expiration_day = expiration.day;
add_security(fsec);
auto status = security_trading_status(def.message()).value_or(co2::TRADINGSTATUS_UNKNOWN);
add_security(fsec, status);
}
template <typename InstrumentDefinition>
@@ -463,7 +535,8 @@ void MDP3Listener::onOption(onixs::Handler&, const onixs::Security&, const Instr
fsec.call_put = sec.putOrCall() == onixs::PutOrCall::Call ? api::PUTORCALL_CALL : api::PUTORCALL_PUT;
add_security(fsec);
auto status = security_trading_status(def.message()).value_or(co2::TRADINGSTATUS_UNKNOWN);
add_security(fsec, status);
}
// min_tick specializations
@@ -520,7 +593,8 @@ void MDP3Listener::onSpread(onixs::Handler&, const onixs::Security&, const Instr
fsec.legs[x].exchange_key = ExchangeKey(leg.legSecurityId());
fsec.legs[x].key = invalid_security_key;
}
add_security(fsec);
auto status = security_trading_status(sec).value_or(co2::TRADINGSTATUS_UNKNOWN);
add_security(fsec, status);
}
template <size_t MAX_DEPTH,class TBook>