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

This commit is contained in:
Pedro Pinto committed 2017-10-04 23:09:30 +00:00
commit 89509c49cc
14 files changed
+584 -298

No files matched your search

+62
View File
@@ -37,12 +37,32 @@
<ClCompile Include="jetfix\tests\jetfix_performance_tests.cpp" />
<ClCompile Include="jetfix\tests\store_tests.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="md\platforms\mdp3_onixs\MDP3Listener.cpp" />
<ClCompile Include="md\platforms\mdp3_onixs\MDP3Main.cpp" />
<ClCompile Include="md\platforms\mdp3_onixs\MDP3Utils.cpp" />
<ClCompile Include="md\platforms\mdp3_onixs\tests\mdp3_tests.cpp" />
<ClCompile Include="md\run_md.cpp" />
<ClCompile Include="orderman\components\FillRecorder.cpp" />
<ClCompile Include="orderman\components\Gateway.cpp" />
<ClCompile Include="orderman\components\MDSource.cpp" />
<ClCompile Include="orderman\components\NativeOrderMan.cpp" />
<ClCompile Include="orderman\components\OrderRecorder.cpp" />
<ClCompile Include="orderman\events\ExecutionReport.cpp" />
<ClCompile Include="orderman\events\NativeOrderStateChange.cpp" />
<ClCompile Include="orderman\events\TimeChange.cpp" />
<ClCompile Include="orderman\IFIXGateway.cpp" />
<ClCompile Include="orderman\IOrderObserver.cpp" />
<ClCompile Include="orderman\native_orders\NativeOrder.cpp" />
<ClCompile Include="orderman\Order.cpp" />
<ClCompile Include="orderman\OrderMan.cpp" />
<ClCompile Include="orderman\OrderState.cpp" />
<ClCompile Include="orderman\OrderStore.cpp" />
<ClCompile Include="orderman\persistence\FillDB.cpp" />
<ClCompile Include="orderman\persistence\gen_order_id.cpp" />
<ClCompile Include="orderman\persistence\OrderDB.cpp" />
<ClCompile Include="orderman\service\OrderServiceServer.cpp" />
<ClCompile Include="orderman\utils\fix_order_codec.cpp" />
<ClCompile Include="orderman\utils\orderman_utils.cpp" />
<ClCompile Include="orderman\WorkingOrder.cpp" />
<ClCompile Include="persistence\IStore.cpp" />
<ClCompile Include="persistence\PersistenceServiceServer.cpp" />
@@ -54,6 +74,7 @@
<ClCompile Include="risk_limits\SharedRiskLimiter.cpp" />
<ClCompile Include="risk_limits\SymbolKey.cpp" />
<ClCompile Include="risk_limits\tests\RiskLimitsTests.cpp" />
<ClCompile Include="securities\SecurityDB.cpp" />
<ClCompile Include="setup\BootstrapActor.cpp" />
<ClCompile Include="setup\ServiceHostActor.cpp" />
<ClCompile Include="spreader\QuoteLegPriceQuantityState.cpp" />
@@ -115,16 +136,54 @@
<ClInclude Include="jetfix\store\FIXFileStore.h" />
<ClInclude Include="jetfix\store\IFIXStore.h" />
<ClInclude Include="jetfix\store\session_name.h" />
<ClInclude Include="md\platforms\mdp3_onixs\CMESecurityIndex.h" />
<ClInclude Include="md\platforms\mdp3_onixs\MDP3Listener.h" />
<ClInclude Include="md\platforms\mdp3_onixs\MDP3Main.h" />
<ClInclude Include="md\platforms\mdp3_onixs\MDP3Utils.h" />
<ClInclude Include="md\platforms\mdp3_onixs\onixs.h" />
<ClInclude Include="md\run_md.h" />
<ClInclude Include="orderman\components\FillRecorder.h" />
<ClInclude Include="orderman\components\Gateway.h" />
<ClInclude Include="orderman\components\MDSource.h" />
<ClInclude Include="orderman\components\NativeOrderMan.h" />
<ClInclude Include="orderman\components\OrderRecorder.h" />
<ClInclude Include="orderman\components\OrderServiceBridge.h" />
<ClInclude Include="orderman\components\TimeSource.h" />
<ClInclude Include="orderman\events\BookUpdate.h" />
<ClInclude Include="orderman\events\CancelNativeOrder.h" />
<ClInclude Include="orderman\events\CancelReject.h" />
<ClInclude Include="orderman\events\CreateNativeOrder.h" />
<ClInclude Include="orderman\events\ExecutionReport.h" />
<ClInclude Include="orderman\events\GatewayBeginReplay.h" />
<ClInclude Include="orderman\events\GatewayEndReplay.h" />
<ClInclude Include="orderman\events\GatewayStatusChange.h" />
<ClInclude Include="orderman\events\MDSubscription.h" />
<ClInclude Include="orderman\events\NativeFills.h" />
<ClInclude Include="orderman\events\NativeOrderStateChange.h" />
<ClInclude Include="orderman\events\OrderStateChange.h" />
<ClInclude Include="orderman\events\OutGatewayMsg.h" />
<ClInclude Include="orderman\events\TimeChange.h" />
<ClInclude Include="orderman\events\UpdateNativeOrder.h" />
<ClInclude Include="orderman\IFIXGateway.h" />
<ClInclude Include="orderman\IOrderObserver.h" />
<ClInclude Include="orderman\IOrderStore.h" />
<ClInclude Include="orderman\md\Book.h" />
<ClInclude Include="orderman\native_orders\NativeOrder.h" />
<ClInclude Include="orderman\native_orders\NativeOrderFIXData.h" />
<ClInclude Include="orderman\native_orders\NativeOrderHeader.h" />
<ClInclude Include="orderman\native_orders\NativeOrderState.h" />
<ClInclude Include="orderman\Order.h" />
<ClInclude Include="orderman\OrderCancel.h" />
<ClInclude Include="orderman\OrderCreate.h" />
<ClInclude Include="orderman\OrderMan.h" />
<ClInclude Include="orderman\OrderState.h" />
<ClInclude Include="orderman\OrderUpdate.h" />
<ClInclude Include="orderman\persistence\FillDB.h" />
<ClInclude Include="orderman\persistence\gen_order_id.h" />
<ClInclude Include="orderman\persistence\OrderDB.h" />
<ClInclude Include="orderman\service\OrderServiceServer.h" />
<ClInclude Include="orderman\utils/orderman_utils.h" />
<ClInclude Include="orderman\utils\fix_order_codec.h" />
<ClInclude Include="orderman\WorkingOrder.h" />
<ClInclude Include="persistence\IStore.h" />
<ClInclude Include="persistence\PersistenceServiceServer.h" />
@@ -135,6 +194,7 @@
<ClInclude Include="risk_limits\SharedRiskLimiter.h" />
<ClInclude Include="risk_limits\RiskLimitState.h" />
<ClInclude Include="risk_limits\SymbolKey.h" />
<ClInclude Include="securities\SecurityDB.h" />
<ClInclude Include="setup\BootstrapActor.h" />
<ClInclude Include="setup\ServiceHostActor.h" />
<ClInclude Include="spreader\ISpreaderManager.h" />
@@ -153,7 +213,9 @@
</ItemGroup>
<ItemGroup>
<None Include="jetfix\tests\sample_fix.dat" />
<None Include="md\platforms\mdp3_onixs\licenses\Onixs.BTS.lic" />
<None Include="orderman\doc\orderman_notes.org" />
<None Include="orderman\doc\order_man_notes.org" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
+277 -58
View File
@@ -1,71 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="algo_man">
<UniqueIdentifier>{00865bf8-7ddc-49f8-836c-7b731f195ee9}</UniqueIdentifier>
<UniqueIdentifier>{d0f67f2e-8190-4876-999d-8eafeb763610}</UniqueIdentifier>
</Filter>
<Filter Include="fabric">
<UniqueIdentifier>{ef3345c0-617c-4c7a-b9d1-deb02a8025f4}</UniqueIdentifier>
<UniqueIdentifier>{1349c190-54ae-444d-b0ae-2f0710acd64e}</UniqueIdentifier>
</Filter>
<Filter Include="fabric\tests">
<UniqueIdentifier>{e0e5df3d-ef1f-44e3-81a3-c336038a5948}</UniqueIdentifier>
<UniqueIdentifier>{a17e3970-4a38-43c0-af96-6f079934ea6b}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\codec">
<UniqueIdentifier>{0355a81d-565f-492f-babe-ce934cfdf5e3}</UniqueIdentifier>
<UniqueIdentifier>{10927b28-e823-4386-a079-42168f2f2589}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix">
<UniqueIdentifier>{21d7f503-0870-48ee-bb3a-e1ef748e4173}</UniqueIdentifier>
<UniqueIdentifier>{89ef1a0f-aa51-48ac-b90e-c1b5e01164c2}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\common">
<UniqueIdentifier>{b6a4b0d3-cbd9-4e7a-8823-dc94a2388718}</UniqueIdentifier>
<UniqueIdentifier>{6d988400-0b98-440b-afb7-cf800d3b5f87}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\connection">
<UniqueIdentifier>{a79d24ee-9bdf-4f2f-a93c-5e9802e6fdef}</UniqueIdentifier>
<UniqueIdentifier>{192c62ef-102b-4d9d-a209-af347a21264b}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\gateway">
<UniqueIdentifier>{ebdd6f46-20a3-4515-8b7b-005578e57644}</UniqueIdentifier>
<UniqueIdentifier>{4b58f253-c471-4252-a7ca-041a0ddec3b3}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\store">
<UniqueIdentifier>{1497f03a-bb95-4510-bdcf-8643bb9d497e}</UniqueIdentifier>
<UniqueIdentifier>{b163436f-025a-4133-934f-cbc31e4489f8}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\tests">
<UniqueIdentifier>{bfde0b4d-9221-4003-a71a-f895f2d426cb}</UniqueIdentifier>
<UniqueIdentifier>{e2b9cd16-7944-4b4e-a84c-4cd9e6495e3d}</UniqueIdentifier>
</Filter>
<Filter Include="orderman">
<UniqueIdentifier>{07528a65-a74a-4e3a-b57c-8e109ba7648d}</UniqueIdentifier>
<UniqueIdentifier>{dc3fd3af-539a-45fb-8fa0-6a405cac1235}</UniqueIdentifier>
</Filter>
<Filter Include="persistence">
<UniqueIdentifier>{eb815131-c2dc-41bf-bfbf-357c8ffd9eba}</UniqueIdentifier>
<UniqueIdentifier>{a849aba1-e42d-4c03-af5a-94b1ed94063d}</UniqueIdentifier>
</Filter>
<Filter Include="persistence\tests">
<UniqueIdentifier>{eb38e41f-38cc-44b3-ab49-29fe126e0636}</UniqueIdentifier>
<UniqueIdentifier>{cb7f40b6-123b-4e6d-9b1e-f0c1d465c4e5}</UniqueIdentifier>
</Filter>
<Filter Include="risk_limits">
<UniqueIdentifier>{9d1b8bf7-ae7a-40ec-9a17-f4ec29f0a2cc}</UniqueIdentifier>
<UniqueIdentifier>{a8e64db0-6014-4266-a0bb-1ff7403922d9}</UniqueIdentifier>
</Filter>
<Filter Include="risk_limits\tests">
<UniqueIdentifier>{ed1c2446-df4b-48a7-972d-0de5991db25d}</UniqueIdentifier>
<UniqueIdentifier>{306aff68-4972-4976-b454-c77ba572e2b5}</UniqueIdentifier>
</Filter>
<Filter Include="setup">
<UniqueIdentifier>{e9e8336f-750c-40d8-9f57-8a490d4037e5}</UniqueIdentifier>
<UniqueIdentifier>{4c3943a3-e837-4fd1-91e1-7d2f41f6a89a}</UniqueIdentifier>
</Filter>
<Filter Include="spreader">
<UniqueIdentifier>{a20d389c-6d4b-467c-814a-906544fa8c04}</UniqueIdentifier>
<UniqueIdentifier>{e9ca783c-e748-4edb-bc91-f05716a54928}</UniqueIdentifier>
</Filter>
<Filter Include="testing">
<UniqueIdentifier>{77021642-9d77-48c2-b603-9dea37acb567}</UniqueIdentifier>
<UniqueIdentifier>{aaf52b6f-3dd7-48f6-a37f-985e0bc5c27b}</UniqueIdentifier>
</Filter>
<Filter Include="user">
<UniqueIdentifier>{45a2299b-caa9-400f-9f35-9d3f60d7736d}</UniqueIdentifier>
<UniqueIdentifier>{c8547332-a952-41dd-991c-d660f278f453}</UniqueIdentifier>
</Filter>
<Filter Include="md\platforms\mdp3_onixs\tests">
<UniqueIdentifier>{4cb20085-891e-4b90-a71c-a6f5a9d6ea2b}</UniqueIdentifier>
</Filter>
<Filter Include="md\platforms\mdp3_onixs">
<UniqueIdentifier>{0545c3cb-96ea-4321-9f8a-2db9d073777b}</UniqueIdentifier>
</Filter>
<Filter Include="md\platforms">
<UniqueIdentifier>{74690e91-fca3-438b-b0e7-c39c15e021e8}</UniqueIdentifier>
</Filter>
<Filter Include="md">
<UniqueIdentifier>{2a6be599-462a-4bfa-a78e-0e8804eb4351}</UniqueIdentifier>
</Filter>
<Filter Include="orderman\components">
<UniqueIdentifier>{d8d1b4a0-d62a-4813-a1cf-027cd2696ec2}</UniqueIdentifier>
</Filter>
<Filter Include="orderman\events">
<UniqueIdentifier>{f6285b8b-ab7d-4ce9-baaf-beaafccbd824}</UniqueIdentifier>
</Filter>
<Filter Include="orderman\native_orders">
<UniqueIdentifier>{1b93c4ae-02ab-459d-87ec-f6129c4e56b3}</UniqueIdentifier>
</Filter>
<Filter Include="orderman\persistence">
<UniqueIdentifier>{a3f7d25b-fd37-4ce3-bf41-659c6d6a7e56}</UniqueIdentifier>
</Filter>
<Filter Include="orderman\service">
<UniqueIdentifier>{20c44347-8e00-4a33-8def-7cc1c500a4fe}</UniqueIdentifier>
</Filter>
<Filter Include="orderman\utils">
<UniqueIdentifier>{4f3836b8-ef64-4468-8478-328ea847b0e4}</UniqueIdentifier>
</Filter>
<Filter Include="securities">
<UniqueIdentifier>{20697df5-cac9-49bb-bd01-af2d5d4db989}</UniqueIdentifier>
</Filter>
<Filter Include="orderman\md">
<UniqueIdentifier>{93e6f92b-7d1f-4f78-bbfd-11c561fea68e}</UniqueIdentifier>
</Filter>
<Filter Include="orderman\doc">
<UniqueIdentifier>{7c15123a-161f-41d0-8c67-351ba12ed261}</UniqueIdentifier>
<UniqueIdentifier>{13146b33-1ec2-44bb-adeb-e8f863a94a7f}</UniqueIdentifier>
</Filter>
<Filter Include="spreader\hedger">
<UniqueIdentifier>{0a189ff2-332a-45cc-bffe-a2d16a62ab11}</UniqueIdentifier>
<Filter Include="md\platforms\mdp3_onixs\licenses">
<UniqueIdentifier>{a59c3edd-9801-4f80-b81a-0b4085d0af1a}</UniqueIdentifier>
</Filter>
<Filter Include="spreader\tests">
<UniqueIdentifier>{19a71c1d-76f4-4046-925b-c593ba08388d}</UniqueIdentifier>
<Filter Include="spreader\quoter">
<UniqueIdentifier>{831b8693-c426-4cdc-8f3e-53d080313920}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
@@ -87,15 +123,15 @@
<ClCompile Include="fabric\IDomain.cpp">
<Filter>fabric</Filter>
</ClCompile>
<ClCompile Include="fabric\TopicDirectory.cpp">
<Filter>fabric</Filter>
</ClCompile>
<ClCompile Include="fabric\tests\baseline_perf_fabric_test.cpp">
<Filter>fabric\tests</Filter>
</ClCompile>
<ClCompile Include="fabric\tests\fabric_test.cpp">
<Filter>fabric\tests</Filter>
</ClCompile>
<ClCompile Include="fabric\TopicDirectory.cpp">
<Filter>fabric</Filter>
</ClCompile>
<ClCompile Include="jetfix\codec\FIXArray.cpp">
<Filter>jetfix\codec</Filter>
</ClCompile>
@@ -189,6 +225,9 @@
<ClCompile Include="risk_limits\SharedRiskLimiter.cpp">
<Filter>risk_limits</Filter>
</ClCompile>
<ClCompile Include="risk_limits\SymbolKey.cpp">
<Filter>risk_limits</Filter>
</ClCompile>
<ClCompile Include="risk_limits\tests\RiskLimitsTests.cpp">
<Filter>risk_limits\tests</Filter>
</ClCompile>
@@ -204,27 +243,86 @@
<ClCompile Include="spreader\SimpleSpreader.cpp">
<Filter>spreader</Filter>
</ClCompile>
<ClCompile Include="spreader\SingleFillHedger.cpp">
<Filter>spreader</Filter>
</ClCompile>
<ClCompile Include="spreader\SingleLegQuoter.cpp">
<Filter>spreader</Filter>
</ClCompile>
<ClCompile Include="spreader\SpreaderBase.cpp">
<Filter>spreader</Filter>
</ClCompile>
<ClCompile Include="spreader\SpreaderTests.cpp">
<Filter>spreader</Filter>
</ClCompile>
<ClCompile Include="testing\catch_test_runner.cpp">
<Filter>testing</Filter>
</ClCompile>
<ClCompile Include="user\UserServiceServer.cpp">
<Filter>user</Filter>
</ClCompile>
<ClCompile Include="main.cpp" />
<ClCompile Include="risk_limits\SymbolKey.cpp">
<Filter>risk_limits</Filter>
<ClCompile Include="md\platforms\mdp3_onixs\tests\mdp3_tests.cpp">
<Filter>md\platforms\mdp3_onixs\tests</Filter>
</ClCompile>
<ClCompile Include="spreader\SingleFillHedger.cpp">
<Filter>spreader\hedger</Filter>
<ClCompile Include="md\platforms\mdp3_onixs\MDP3Listener.cpp">
<Filter>md\platforms\mdp3_onixs</Filter>
</ClCompile>
<ClCompile Include="spreader\SpreaderTests.cpp">
<Filter>spreader\tests</Filter>
<ClCompile Include="md\platforms\mdp3_onixs\MDP3Main.cpp">
<Filter>md\platforms\mdp3_onixs</Filter>
</ClCompile>
<ClCompile Include="md\platforms\mdp3_onixs\MDP3Utils.cpp">
<Filter>md\platforms\mdp3_onixs</Filter>
</ClCompile>
<ClCompile Include="md\run_md.cpp">
<Filter>md</Filter>
</ClCompile>
<ClCompile Include="orderman\components\FillRecorder.cpp">
<Filter>orderman\components</Filter>
</ClCompile>
<ClCompile Include="orderman\components\Gateway.cpp">
<Filter>orderman\components</Filter>
</ClCompile>
<ClCompile Include="orderman\components\MDSource.cpp">
<Filter>orderman\components</Filter>
</ClCompile>
<ClCompile Include="orderman\components\NativeOrderMan.cpp">
<Filter>orderman\components</Filter>
</ClCompile>
<ClCompile Include="orderman\components\OrderRecorder.cpp">
<Filter>orderman\components</Filter>
</ClCompile>
<ClCompile Include="orderman\events\ExecutionReport.cpp">
<Filter>orderman\events</Filter>
</ClCompile>
<ClCompile Include="orderman\events\NativeOrderStateChange.cpp">
<Filter>orderman\events</Filter>
</ClCompile>
<ClCompile Include="orderman\events\TimeChange.cpp">
<Filter>orderman\events</Filter>
</ClCompile>
<ClCompile Include="orderman\native_orders\NativeOrder.cpp">
<Filter>orderman\native_orders</Filter>
</ClCompile>
<ClCompile Include="orderman\persistence\FillDB.cpp">
<Filter>orderman\persistence</Filter>
</ClCompile>
<ClCompile Include="orderman\persistence\gen_order_id.cpp">
<Filter>orderman\persistence</Filter>
</ClCompile>
<ClCompile Include="orderman\persistence\OrderDB.cpp">
<Filter>orderman\persistence</Filter>
</ClCompile>
<ClCompile Include="orderman\service\OrderServiceServer.cpp">
<Filter>orderman\service</Filter>
</ClCompile>
<ClCompile Include="orderman\utils\fix_order_codec.cpp">
<Filter>orderman\utils</Filter>
</ClCompile>
<ClCompile Include="orderman\utils\orderman_utils.cpp">
<Filter>orderman\utils</Filter>
</ClCompile>
<ClCompile Include="securities\SecurityDB.cpp">
<Filter>securities</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
@@ -261,6 +359,9 @@
<ClInclude Include="fabric\TopicDirectory.h">
<Filter>fabric</Filter>
</ClInclude>
<ClInclude Include="jetfix\jetfix.h">
<Filter>jetfix</Filter>
</ClInclude>
<ClInclude Include="jetfix\codec\FieldDefinitions.h">
<Filter>jetfix\codec</Filter>
</ClInclude>
@@ -363,9 +464,6 @@
<ClInclude Include="jetfix\gateway\Session.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\jetfix.h">
<Filter>jetfix</Filter>
</ClInclude>
<ClInclude Include="jetfix\store\FIXFileStore.h">
<Filter>jetfix\store</Filter>
</ClInclude>
@@ -402,9 +500,6 @@
<ClInclude Include="orderman\OrderUpdate.h">
<Filter>orderman</Filter>
</ClInclude>
<ClInclude Include="orderman\utils/orderman_utils.h">
<Filter>orderman</Filter>
</ClInclude>
<ClInclude Include="orderman\WorkingOrder.h">
<Filter>orderman</Filter>
</ClInclude>
@@ -432,18 +527,30 @@
<ClInclude Include="risk_limits\RiskLimitState.h">
<Filter>risk_limits</Filter>
</ClInclude>
<ClInclude Include="risk_limits\SymbolKey.h">
<Filter>risk_limits</Filter>
</ClInclude>
<ClInclude Include="setup\BootstrapActor.h">
<Filter>setup</Filter>
</ClInclude>
<ClInclude Include="setup\ServiceHostActor.h">
<Filter>setup</Filter>
</ClInclude>
<ClInclude Include="spreader\ISpreaderManager.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="spreader\LegPropertyData.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="spreader\QuoteLegPriceQuantityState.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="spreader\SimpleSpreader.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="spreader\SingleFillHedger.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="spreader\SingleLegQuoter.h">
<Filter>spreader</Filter>
</ClInclude>
@@ -453,32 +560,140 @@
<ClInclude Include="spreader\SpreaderBase.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="spreader\SpreaderBookkeepingData.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="spreader\SpreaderOrderUpdateMessage.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="spreader\SpreaderUtils.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="testing\catch_test_runner.h">
<Filter>testing</Filter>
</ClInclude>
<ClInclude Include="user\UserServiceServer.h">
<Filter>user</Filter>
</ClInclude>
<ClInclude Include="risk_limits\SymbolKey.h">
<Filter>risk_limits</Filter>
<ClInclude Include="orderman\utils\orderman_utils.h">
<Filter>orderman\utils</Filter>
</ClInclude>
<ClInclude Include="spreader\SingleFillHedger.h">
<Filter>spreader\hedger</Filter>
<ClInclude Include="md\platforms\mdp3_onixs\CMESecurityIndex.h">
<Filter>md\platforms\mdp3_onixs</Filter>
</ClInclude>
<ClInclude Include="spreader\SpreaderUtils.h">
<Filter>spreader</Filter>
<ClInclude Include="md\platforms\mdp3_onixs\MDP3Listener.h">
<Filter>md\platforms\mdp3_onixs</Filter>
</ClInclude>
<ClInclude Include="spreader\SpreaderBookkeepingData.h">
<Filter>spreader</Filter>
<ClInclude Include="md\platforms\mdp3_onixs\MDP3Main.h">
<Filter>md\platforms\mdp3_onixs</Filter>
</ClInclude>
<ClInclude Include="spreader\LegPropertyData.h">
<Filter>spreader</Filter>
<ClInclude Include="md\platforms\mdp3_onixs\MDP3Utils.h">
<Filter>md\platforms\mdp3_onixs</Filter>
</ClInclude>
<ClInclude Include="spreader\ISpreaderManager.h">
<Filter>spreader</Filter>
<ClInclude Include="md\platforms\mdp3_onixs\onixs.h">
<Filter>md\platforms\mdp3_onixs</Filter>
</ClInclude>
<ClInclude Include="spreader\SpreaderOrderUpdateMessage.h">
<Filter>spreader</Filter>
<ClInclude Include="md\run_md.h">
<Filter>md</Filter>
</ClInclude>
<ClInclude Include="orderman\components\FillRecorder.h">
<Filter>orderman\components</Filter>
</ClInclude>
<ClInclude Include="orderman\components\Gateway.h">
<Filter>orderman\components</Filter>
</ClInclude>
<ClInclude Include="orderman\components\MDSource.h">
<Filter>orderman\components</Filter>
</ClInclude>
<ClInclude Include="orderman\components\NativeOrderMan.h">
<Filter>orderman\components</Filter>
</ClInclude>
<ClInclude Include="orderman\components\OrderRecorder.h">
<Filter>orderman\components</Filter>
</ClInclude>
<ClInclude Include="orderman\components\OrderServiceBridge.h">
<Filter>orderman\components</Filter>
</ClInclude>
<ClInclude Include="orderman\components\TimeSource.h">
<Filter>orderman\components</Filter>
</ClInclude>
<ClInclude Include="orderman\events\BookUpdate.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\CancelNativeOrder.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\CancelReject.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\CreateNativeOrder.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\ExecutionReport.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\GatewayBeginReplay.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\GatewayEndReplay.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\GatewayStatusChange.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\MDSubscription.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\NativeFills.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\NativeOrderStateChange.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\OrderStateChange.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\OutGatewayMsg.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\TimeChange.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\events\UpdateNativeOrder.h">
<Filter>orderman\events</Filter>
</ClInclude>
<ClInclude Include="orderman\md\Book.h">
<Filter>orderman\md</Filter>
</ClInclude>
<ClInclude Include="orderman\native_orders\NativeOrder.h">
<Filter>orderman\native_orders</Filter>
</ClInclude>
<ClInclude Include="orderman\native_orders\NativeOrderFIXData.h">
<Filter>orderman\native_orders</Filter>
</ClInclude>
<ClInclude Include="orderman\native_orders\NativeOrderHeader.h">
<Filter>orderman\native_orders</Filter>
</ClInclude>
<ClInclude Include="orderman\native_orders\NativeOrderState.h">
<Filter>orderman\native_orders</Filter>
</ClInclude>
<ClInclude Include="orderman\persistence\FillDB.h">
<Filter>orderman\persistence</Filter>
</ClInclude>
<ClInclude Include="orderman\persistence\gen_order_id.h">
<Filter>orderman\persistence</Filter>
</ClInclude>
<ClInclude Include="orderman\persistence\OrderDB.h">
<Filter>orderman\persistence</Filter>
</ClInclude>
<ClInclude Include="orderman\service\OrderServiceServer.h">
<Filter>orderman\service</Filter>
</ClInclude>
<ClInclude Include="orderman\utils\fix_order_codec.h">
<Filter>orderman\utils</Filter>
</ClInclude>
<ClInclude Include="securities\SecurityDB.h">
<Filter>securities</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
@@ -488,8 +703,12 @@
<None Include="orderman\doc\orderman_notes.org">
<Filter>orderman\doc</Filter>
</None>
<None Include="md\platforms\mdp3_onixs\licenses\Onixs.BTS.lic">
<Filter>md\platforms\mdp3_onixs\licenses</Filter>
</None>
<None Include="orderman\doc\order_man_notes.org">
<Filter>orderman\doc</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup />
</Project>
+3
View File
@@ -7,4 +7,7 @@
<DebuggerFlavor>LinuxDebugger</DebuggerFlavor>
<RemoteDebuggerCommandArguments>test</RemoteDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
</Project>
+74 -24
View File
@@ -111,8 +111,6 @@ namespace spreader
bts_assert(false);
if (_state == State::WORKING)
{
// TODO make all quoters and hedger go to their end state
// (no need to do cancel here)
_transform_to_END();
}
else if (_state == State::WAITING_FOR_CANCEL_ALL)
@@ -159,7 +157,11 @@ namespace spreader
{
}
}
void SimpleSpreader::on_child_order(const OrderState& order_state)
void SimpleSpreader::on_child_order_update(orderman::OrderKey orderkey,
api::orderman::OrderStatus status,
Quantity filled_quantity,
Price avg_price,
const char* error_msg)
{
if (_state == State::START)
bts_assert(false);
@@ -167,33 +169,49 @@ namespace spreader
bts_assert(false);
else if (_state == State::WORKING)
{
SpreaderOrderUpdateMessage order_msg(order_state);
if (order_msg.has_error())
_handle_order_error(order_msg);
if (_order_update_has_error (error_msg))
_handle_order_error();
else
{
SpreaderBookkeepingData::LegData* q_leg_data = _bookkeeping_data->find_quoter_from_orderkey(order_msg.order_state.key);
if (q_leg_data != NULL)
_handle_quoter_order_update(*q_leg_data, order_msg);
SpreaderBookkeepingData::LegData* q_leg_data_ptr = _bookkeeping_data->find_quoter_from_orderkey(orderkey);
if (q_leg_data_ptr != NULL)
{
SpreaderBookkeepingData::LegData& q_leg_data = *(q_leg_data_ptr);
SpreaderOrderUpdateMessage update_message(orderkey, status, filled_quantity, avg_price, q_leg_data.filled_quantity, q_leg_data.avergage_filled_price, error_msg);
_handle_quoter_order_update(q_leg_data, update_message);
}
else
{
// should be a hedge order then
SpreaderBookkeepingData::HedgerData* hedger_data = _bookkeeping_data->find_hedger_from_orderkey(order_state.key);
hedger_data->hedger.update_order_state(order_state);
SpreaderBookkeepingData::HedgerData* hedger_data = _bookkeeping_data->find_hedger_from_orderkey(orderkey);
if (hedger_data != NULL)
{
SpreaderOrderUpdateMessage update_message(orderkey, status, filled_quantity, avg_price, hedger_data->filled_quantity, hedger_data->avergage_filled_price, error_msg);
hedger_data->update_fill(filled_quantity);
hedger_data->hedger.update_order_state(update_message);
}
}
}
}
else if (_state == State::WAITING_FOR_CANCEL_ALL)
{
// all it has to do
SpreaderBookkeepingData::LegData* q_leg_data = _bookkeeping_data->find_quoter_from_orderkey(order_state.key);
if (q_leg_data != NULL)
q_leg_data->quoter->update_order_status(order_state);
SpreaderBookkeepingData::LegData* q_leg_data_ptr = _bookkeeping_data->find_quoter_from_orderkey(orderkey);
if (q_leg_data_ptr != NULL)
{
SpreaderBookkeepingData::LegData& q_leg_data = *(q_leg_data_ptr);
SpreaderOrderUpdateMessage update_message(orderkey, status, filled_quantity, avg_price, q_leg_data.filled_quantity, q_leg_data.avergage_filled_price, error_msg);
q_leg_data_ptr->quoter->update_order_status(update_message);
}
else
{
SpreaderBookkeepingData::HedgerData* hedger_data = _bookkeeping_data->find_hedger_from_orderkey(order_state.key);
SpreaderBookkeepingData::HedgerData* hedger_data = _bookkeeping_data->find_hedger_from_orderkey(orderkey);
if (hedger_data != NULL)
hedger_data->hedger.update_order_state(order_state);
{
SpreaderOrderUpdateMessage update_message(orderkey, status, filled_quantity, avg_price, hedger_data->filled_quantity, hedger_data->avergage_filled_price, error_msg);
hedger_data->update_fill(filled_quantity);
hedger_data->hedger.update_order_state(update_message);
}
}
if (_all_quoter_orders_in_terminal_state() && _all_hedger_orders_in_terminal_state())
_transform_to_END();
@@ -204,13 +222,45 @@ namespace spreader
// error in which case, as far as the spreader
// is concerned, no updates will be sent
}
}
}
void SimpleSpreader::on_time(const TimeStamp&)
{
}
void SimpleSpreader::on_user_update(const SpreaderUpdate&)
void SimpleSpreader::on_user_update(const SpreaderUpdate& spreader_update)
{
// check if its a price or quantity change
// TODO : send status updates out
if (_state == State::START)
{
}
else if (_state == State::WAITING_FOR_FIRST_CONNECTION)
{
}
else if (_state == State::WORKING)
{
// check if all quoters can accept the change
bool accept_changes = true;
for (size_t q_idx = 0; q_idx < _bookkeeping_data->count(); q_idx++)
{
SpreaderBookkeepingData::LegData& leg_data = _bookkeeping_data->get_leg_data(q_idx);
accept_changes = accept_changes && leg_data.quoter->accept_modifications();
if (!accept_changes)
break;
}
if (accept_changes)
{
for (size_t q_idx = 0; q_idx < _bookkeeping_data->count(); q_idx++)
{
SpreaderBookkeepingData::LegData& leg_data = _bookkeeping_data->get_leg_data(q_idx);
leg_data.quoter->update_order_price_quantity(spreader_update.price, spreader_update.quantity);
}
}
}
else if (_state == State::WAITING_FOR_CANCEL_ALL)
{
}
else if (_state == State::END)
{
}
}
void SimpleSpreader::on_user_cancel()
{
@@ -274,7 +324,7 @@ namespace spreader
bts_assert(_state == State::WORKING || _state == State::WAITING_FOR_CANCEL_ALL);
_state = State::END;
}
void SimpleSpreader::_handle_order_error(const SpreaderOrderUpdateMessage&)
void SimpleSpreader::_handle_order_error()
{
// TODO report it
_transform_to_WAITING_FOR_CANCEL_ALL();
@@ -283,16 +333,16 @@ namespace spreader
{
// quoter needs to update, if there is a fill, the quoter
// will update its order quantity
leg_data.quoter->update_order_status(update_message.order_state);
leg_data.quoter->update_order_status(update_message);
// if there are fill, we need to
// i. update leg_data's price and quantity
// ii. tell other quotes of the fill
// iii send hedges
Quantity this_fill_quantity; Price this_fill_price;
if (SpreaderUtils::order_update_has_fills(leg_data.filled_quantity, leg_data.avergage_filled_price, update_message.order_state, this_fill_quantity, this_fill_price))
if (update_message.update_fill_price_quantity (this_fill_quantity, this_fill_price))
{
leg_data.filled_quantity = update_message.order_state.filled_quantity;
leg_data.avergage_filled_price = update_message.order_state.average_filled_price;
leg_data.filled_quantity = update_message.filled_quantity;
leg_data.avergage_filled_price = update_message.avg_price;
for (size_t idx = 0; idx < _bookkeeping_data->count(); idx++)
{
if (idx != leg_data.leg_shared_data.leg_index)
+7 -3
View File
@@ -36,7 +36,11 @@ namespace spreader
void on_connect() override;
void on_disconnect() override;
void on_md(const orderman::Book&) override;
void on_child_order(const OrderState&) override;
void on_child_order_update(orderman::OrderKey orderkey,
api::orderman::OrderStatus status,
Quantity filled_quantity,
Price avg_price,
const char* error_msg) override;
void on_time(const TimeStamp&) override;
void on_user_update(const SpreaderUpdate&) override;
void on_user_cancel() override;
@@ -63,7 +67,7 @@ namespace spreader
void _transform_to_WORKING();
void _transform_to_WAITING_FOR_CANCEL_ALL();
void _transform_to_END();
void _handle_order_error(const SpreaderOrderUpdateMessage& order_message);
void _handle_order_error();
void _handle_quoter_order_update(SpreaderBookkeepingData::LegData& leg_data, const SpreaderOrderUpdateMessage& update_message);
// this cancels the quoters and hedger orders (though them);
// optionally can cancel the quotes or the hedges or both
@@ -79,7 +83,7 @@ namespace spreader
size_t hedged_index,
Price& hedge_price, Quantity& hedge_quantity);
const OrderTemplate& _get_order_template(size_t leg_index);
bool _order_update_has_error(const char* error_msg) { return error_msg != NULL; }
};
}
}
+12 -13
View File
@@ -2,6 +2,7 @@
#include "SingleFillHedger.h"
#include "ISpreaderManager.h"
#include "SpreaderUtils.h"
#include "SpreaderOrderUpdateMessage.h"
namespace bts {
namespace spreader {
@@ -25,6 +26,7 @@ SingleFillHedger::SingleFillHedger(ISpreaderManager& spreader_manager,
void SingleFillHedger::init()
{
transform_to_WAITING_FOR_FIRST_ACK();
}
bool SingleFillHedger::is_active() { return _state != HedgerState::START && _state != HedgerState::END; }
@@ -33,9 +35,9 @@ bool SingleFillHedger::accepting_price_change() { return _state == HedgerState::
Quantity SingleFillHedger::remaining_to_fill() { return _price_quantity_state.remaining_to_fill(); }
void SingleFillHedger::update_order_state(const OrderState& order_state)
void SingleFillHedger::update_order_state(const SpreaderOrderUpdateMessage& order_update_message)
{
SingleFillHedger::EventData event_data (&order_state);
SingleFillHedger::EventData event_data (&order_update_message);
_fire_event(event_data);
}
@@ -82,11 +84,10 @@ void SingleFillHedger::_handle_events_in_WAITING_FOR_FIRST_ACK(const EventData&
{
if (event_data.external_event == ExternalHedgerEvents::OrderState)
{
bool filled, terminal_status, encountered_error, new_fills;
SpreaderUtils::parse_order(*event_data.order_state, _price_quantity_state.aggregated_filled_quantity(), filled, terminal_status, encountered_error, new_fills);
if (terminal_status)
const SpreaderOrderUpdateMessage& update_message = *(event_data.order_state);
if (update_message.terminal_status())
transform_to_END();
else if (encountered_error)
else if (update_message.has_error())
transform_to_WAITING_FOR_CANCEL_ACK();
else
_transform_to_WORKING();
@@ -113,11 +114,10 @@ void SingleFillHedger::_handle_events_in_WORKING(const EventData& event_data)
{
if (event_data.external_event == ExternalHedgerEvents::OrderState)
{
bool filled, terminal_status, encountered_error, new_fills;
SpreaderUtils::parse_order(*event_data.order_state, _price_quantity_state.aggregated_filled_quantity(), filled, terminal_status, encountered_error, new_fills);
if (terminal_status)
const SpreaderOrderUpdateMessage& update_message = *(event_data.order_state);
if (update_message.terminal_status())
transform_to_END();
else if (encountered_error)
else if (update_message.has_error())
transform_to_WAITING_FOR_CANCEL_ACK();
}
else if (event_data.external_event == ExternalHedgerEvents::MDUpdate)
@@ -145,9 +145,8 @@ void SingleFillHedger::_handle_events_in_WAITING_FOR_CANCEL_ACK(const EventData&
{
if (event_data.external_event == ExternalHedgerEvents::OrderState)
{
bool filled, terminal_status, encountered_error, new_fills;
SpreaderUtils::parse_order(*event_data.order_state, _price_quantity_state.aggregated_filled_quantity(), filled, terminal_status, encountered_error, new_fills);
if (terminal_status)
const SpreaderOrderUpdateMessage& update_message = *(event_data.order_state);
if (update_message.terminal_status())
transform_to_END();
}
}
+12 -7
View File
@@ -10,6 +10,7 @@ namespace bts {
namespace spreader {
class ISpreaderManager;
class LegPropertyData;
class SpreaderOrderUpdateMessage;
class SingleFillHedger
{
enum class ExternalHedgerEvents
@@ -38,27 +39,31 @@ class SingleFillHedger
{
public:
const ExternalHedgerEvents external_event;
const OrderState* order_state;
const SpreaderOrderUpdateMessage* order_state;
const Price hedge_price;
EventData(const OrderState* order_state_arg)
: external_event(ExternalHedgerEvents::OrderState),
EventData(const SpreaderOrderUpdateMessage* order_state_arg)
:
external_event(ExternalHedgerEvents::OrderState),
order_state(order_state_arg),
hedge_price(0.0)
{}
EventData(Price hedge_price_arg)
: external_event(ExternalHedgerEvents::UserHedgePriceChange),
:
external_event(ExternalHedgerEvents::UserHedgePriceChange),
order_state(NULL),
hedge_price(hedge_price_arg)
{}
EventData(ExternalHedgerEvents external_event_arg)
: external_event(external_event_arg),
:
external_event(external_event_arg),
order_state(NULL),
hedge_price(0.0)
{}
private:
EventData()
: external_event(ExternalHedgerEvents::Timer),
:
external_event(ExternalHedgerEvents::Timer),
order_state(NULL),
hedge_price(0.0)
{}
@@ -151,7 +156,7 @@ public:
Quantity remaining_to_fill();
// called by the spreader when there is an order update
// reported by the exchange
void update_order_state(OrderState const& state);
void update_order_state(const SpreaderOrderUpdateMessage& order_update_message);
// called when the market data associated
// with this security is changed
void update_md();
+42 -67
View File
@@ -3,6 +3,7 @@
#include "ISpreaderManager.h"
#include "SpreaderUtils.h"
#include "LegPropertyData.h"
#include "SpreaderOrderUpdateMessage.h"
namespace bts {
namespace spreader {
@@ -33,41 +34,39 @@ bool SingleLegQuoter::is_active() const { return _state == QuoterState::WAITING_
bool SingleLegQuoter::accept_modifications() const { return _state == QuoterState::WAITING_FOR_MARKET || _state == QuoterState::WORKING; }
void SingleLegQuoter::update_order_status(OrderState const& order_state)
void SingleLegQuoter::update_order_status(const SpreaderOrderUpdateMessage& order_update_message)
{
EventData ev(order_state);
EventData ev;
ev.order_update(&order_update_message);
_fire_event(ev);
}
void SingleLegQuoter::update_md(size_t leg_index)
{
EventData ev(leg_index);
_fire_event(ev);
}
void SingleLegQuoter::update_other_leg_fills(size_t leg_index, Quantity filled_quantity)
{
double equivelant_quantity = _get_equivelant_quantity(leg_index, filled_quantity);
uint32_t this_leg_reduction = static_cast<uint32_t> (equivelant_quantity);
EventData ev(Quantity(this_leg_reduction), ExternalEvents::OtherLegQuotingFill);
}
void SingleLegQuoter::modify_order_price(Price new_price)
{
EventData ev(new_price);
EventData ev;
ev.md_update(leg_index);
_fire_event(ev);
}
void SingleLegQuoter::modify_order_quantity(Quantity new_quantity)
void SingleLegQuoter::update_other_leg_fills(size_t, Quantity filled_quantity)
{
double leg_quantity_d = _this_leg_data.size_multiplier() * new_quantity.value();
EventData ev(Quantity(leg_quantity_d), ExternalEvents::SpreadQuantityChange);
EventData ev;
// TODO, normalize this
ev.other_leg_fill_update(filled_quantity);
_fire_event(ev);
}
void SingleLegQuoter::update_order_price_quantity(Price new_price, Quantity new_quantity)
{
EventData ev;
ev.price_quantity_update(new_price, new_quantity);
_fire_event(ev);
}
void SingleLegQuoter::cancel_order()
{
EventData ev(ExternalEvents::CancelOrder);
EventData ev;
ev.cancel_order();
_fire_event(ev);
}
@@ -121,14 +120,9 @@ void SingleLegQuoter::_handle_events_in_WAITING_FOR_MARKET(const EventData& even
// may mean that we have enough size available in the other legs
_check_md_in_WAITING_FOR_MARKET();
}
else if (event_data.external_event == ExternalEvents::SpreadPriceChange)
else if (event_data.external_event == ExternalEvents::SpreadPriceQuantityChange)
{
// a spread price change is not change the depth requirements
// in the other legs, so the state is not going to change
_price_quantity_state.update_target_spread_price(event_data.new_spread_price);
}
else if (event_data.external_event == ExternalEvents::SpreadQuantityChange)
{
_price_quantity_state.update_target_leg_quantity(event_data.new_leg_quantity);
if (_price_quantity_state.remaining_to_fill().value() == 0)
// if the size is changed such that hedge redution has made
@@ -166,13 +160,11 @@ void SingleLegQuoter::_handle_events_in_WAITING_FOR_FIRST_ACK(const EventData& e
{
if (event_data.external_event == ExternalEvents::OrderStateUpdate)
{
const OrderState& order_state = *(event_data.order_state);
bool filled, terminal_state, encountered_error, new_fills;
SpreaderUtils::parse_order(order_state, _price_quantity_state.aggregated_filled_quantity(), filled, terminal_state, encountered_error, new_fills);
_price_quantity_state.update_filled_quantity(order_state.filled_quantity);
if (terminal_state)
const SpreaderOrderUpdateMessage& order_udpate_message = *(event_data.order_update_message);
_price_quantity_state.update_filled_quantity(order_udpate_message.filled_quantity);
if (order_udpate_message.terminal_status())
_transform_to_END();
else if (encountered_error)
else if (order_udpate_message.has_error())
_transform_to_WAITING_FOR_CANCEL_ACK();
else
{
@@ -180,6 +172,7 @@ void SingleLegQuoter::_handle_events_in_WAITING_FOR_FIRST_ACK(const EventData& e
_transform_to_WAITING_FOR_CANCEL_ACK();
else
// this is the working state
// TODO, check for ack (there can be an un ack'ed state)
_transform_to_WORKING();
}
}
@@ -193,17 +186,12 @@ void SingleLegQuoter::_handle_events_in_WAITING_FOR_FIRST_ACK(const EventData& e
if (_price_quantity_state.remaining_to_fill().value() == 0)
_transform_to_WAITING_FOR_CANCEL_ACK();
}
else if (event_data.external_event == ExternalEvents::SpreadPriceChange)
else if (event_data.external_event == ExternalEvents::SpreadPriceQuantityChange)
{
// price changes are not allowed in this state, accept_modifications
// shoudl have returned false and disallowed this call to happen
// price/quantity changes are not allowed in this state, accept_modifications
// should have returned false and disallowed this call to happen
bts_assert(false);
}
else if (event_data.external_event == ExternalEvents::SpreadQuantityChange)
{
// accept_modifications() should reject all changes
bts_assert(false);
}
}
else if (event_data.external_event == ExternalEvents::CancelOrder)
{
_transform_to_WAITING_FOR_CANCEL_ACK();
@@ -256,18 +244,16 @@ void SingleLegQuoter::_handle_events_in_WORKING(const EventData& event_data)
{
if (event_data.external_event == ExternalEvents::OrderStateUpdate)
{
const OrderState& order_state = *(event_data.order_state);
bool filled, terminal_state, encountered_error, new_fills;
SpreaderUtils::parse_order(order_state, _price_quantity_state.aggregated_filled_quantity(), filled, terminal_state, encountered_error, new_fills);
_price_quantity_state.update_filled_quantity(order_state.filled_quantity);
if (terminal_state)
const SpreaderOrderUpdateMessage& order_update_message = *(event_data.order_update_message);
_price_quantity_state.update_filled_quantity(order_update_message.filled_quantity);
if (order_update_message.terminal_status())
_transform_to_END();
else if (encountered_error)
else if (order_update_message.has_error())
_transform_to_WAITING_FOR_CANCEL_ACK();
else
{
// normal state
if (new_fills)
if (order_update_message.has_fills ())
{
if (_price_quantity_state.remaining_to_fill().value() == 0)
_transform_to_WAITING_FOR_CANCEL_ACK();
@@ -292,13 +278,9 @@ void SingleLegQuoter::_handle_events_in_WORKING(const EventData& event_data)
else
_reprice_in_WORKING();
}
else if (event_data.external_event == ExternalEvents::SpreadPriceChange)
{
_price_quantity_state.update_target_spread_price(event_data.new_spread_price);
_reprice_in_WORKING();
}
else if (event_data.external_event == ExternalEvents::SpreadQuantityChange)
else if (event_data.external_event == ExternalEvents::SpreadPriceQuantityChange)
{
_price_quantity_state.update_target_spread_price(event_data.new_spread_price);
_price_quantity_state.update_target_leg_quantity(event_data.new_leg_quantity);
if (_price_quantity_state.remaining_to_fill().value() == 0)
_transform_to_WAITING_FOR_CANCEL_ACK();
@@ -327,11 +309,9 @@ void SingleLegQuoter::_handle_events_in_WAITING_FOR_CANCEL_ACK(const EventData&
{
if (event_data.external_event == ExternalEvents::OrderStateUpdate)
{
const OrderState& order_state = *(event_data.order_state);
bool filled, terminal_state, encountered_error, new_fills;
SpreaderUtils::parse_order(order_state, _price_quantity_state.aggregated_filled_quantity(), filled, terminal_state, encountered_error, new_fills);
_price_quantity_state.update_filled_quantity(order_state.filled_quantity);
if (terminal_state)
const SpreaderOrderUpdateMessage& order_udpate_message = *(event_data.order_update_message);
_price_quantity_state.update_filled_quantity(order_udpate_message.filled_quantity);
if (order_udpate_message.terminal_status())
_transform_to_END();
}
else if (event_data.external_event == ExternalEvents::MDUpdate)
@@ -342,17 +322,12 @@ void SingleLegQuoter::_handle_events_in_WAITING_FOR_CANCEL_ACK(const EventData&
{
_price_quantity_state.add_hedged_reduction(event_data.other_leg_filled_quanity);
}
else if (event_data.external_event == ExternalEvents::SpreadPriceChange)
else if (event_data.external_event == ExternalEvents::SpreadPriceQuantityChange)
{
// price changes are not allowed in this state, accept_modifications
// price/qty changes are not allowed in this state, accept_modifications
// shoudl have returned false and disallowed this call to happen
bts_assert(false);
}
else if (event_data.external_event == ExternalEvents::SpreadQuantityChange)
{
// accept_modifications() should reject all changes
bts_assert(false);
}
}
else if (event_data.external_event == ExternalEvents::CancelOrder)
{
// already cancelled
+32 -47
View File
@@ -10,7 +10,7 @@ namespace bts {
namespace spreader {
class ISpreaderManager;
class SpreaderOrderUpdateMessage;
class SingleLegQuoter
{
// this represents all signals generated
@@ -23,16 +23,10 @@ class SingleLegQuoter
MDUpdate,
// fill on another leg
OtherLegQuotingFill,
// spread price changes (manually from the user
// but at some point it could be automatic too,
// though the source is irrelevant)
SpreadPriceChange,
// quantity changes (from the user)
SpreadQuantityChange,
// price/quantity and/or change
SpreadPriceQuantityChange,
// cancel of this leg order (automatic or manual)
CancelOrder,
// leg price changes from the user
LegPriceChange,
};
// the states of the quoter state machine
enum class QuoterState
@@ -61,7 +55,7 @@ class SingleLegQuoter
// there are no working orders in this state.
END
};
// the external events and data are packaged into
// this class and sent over to the state machine.
// depending on the value of the external_event,
@@ -70,43 +64,36 @@ class SingleLegQuoter
class EventData
{
public:
ExternalEvents external_event;
const OrderState* order_state;
ExternalEvents external_event;
SpreaderOrderUpdateMessage const* order_update_message;
size_t book_leg_index;
Price new_spread_price;
Quantity new_leg_quantity;
Quantity other_leg_filled_quanity;
EventData(ExternalEvents external_event_args)
:
external_event(external_event_args)
{}
EventData (const OrderState& order_state_arg)
:
external_event(ExternalEvents::OrderStateUpdate),
order_state (&order_state_arg)
{}
EventData(size_t book_leg_index_arg)
:
external_event(ExternalEvents::MDUpdate),
book_leg_index(book_leg_index_arg)
{}
EventData(Price new_spread_price_arg)
:
external_event(ExternalEvents::SpreadPriceChange),
new_spread_price(new_spread_price_arg)
{}
EventData(Quantity new_leg_quantity_arg)
:
external_event(ExternalEvents::SpreadQuantityChange),
new_leg_quantity(new_leg_quantity_arg)
{}
EventData(Quantity filled_quantity, ExternalEvents external_event_args)
void order_update(SpreaderOrderUpdateMessage const* arg)
{
if (external_event_args == ExternalEvents::SpreadQuantityChange)
new_leg_quantity = filled_quantity;
else if (external_event_args == ExternalEvents::OtherLegQuotingFill)
other_leg_filled_quanity = filled_quantity;
external_event = ExternalEvents::OrderStateUpdate;
order_update_message = arg;
}
void md_update(size_t arg)
{
external_event = ExternalEvents::MDUpdate;
book_leg_index = arg;
}
void price_quantity_update(Price price_arg, Quantity quantity_arg)
{
external_event = ExternalEvents::SpreadPriceQuantityChange;
new_spread_price = price_arg;
new_leg_quantity = quantity_arg;
}
void other_leg_fill_update(Quantity fill_arg)
{
external_event = ExternalEvents::OtherLegQuotingFill;
other_leg_filled_quanity = fill_arg;
}
void cancel_order()
{
external_event = ExternalEvents::CancelOrder;
}
};
@@ -158,7 +145,7 @@ public:
bool accept_modifications() const;
// called by the spreader a change in order status (or fills) is
// reported by the exchange
void update_order_status(OrderState const& state);
void update_order_status(const SpreaderOrderUpdateMessage& order_update_message);
// called when the market data associated
// with this security is changed
void update_md(size_t leg_index);
@@ -166,10 +153,8 @@ public:
// (ie not hedging fill) happens on one of the quoting
// legs
void update_other_leg_fills(size_t leg_index, Quantity filled_quantity);
// called when the user modified the spreader order price
void modify_order_price(Price new_spread_price);
// called when the user modifies the quantity
void modify_order_quantity(Quantity new_spread_quantity);
// called when the user modified the spreader order price or quantity
void update_order_price_quantity(Price price, Quantity quantity);
// called when the hedge order is cancelled, either
// manually or automatically
void cancel_order();
+5 -5
View File
@@ -16,11 +16,11 @@ public:
std::string reject_msg;
};
class Book {
public:
size_t n_levels() const;
std::tuple<Price,Size> level(api::BuySell,size_t) const;
};
//class Book {
//public:
// size_t n_levels() const;
// std::tuple<Price,Size> level(api::BuySell,size_t) const;
//};
class ChildFill {
public:
+6 -15
View File
@@ -12,18 +12,6 @@
namespace bts {
namespace spreader {
// OrderState abstraction for all order types (Spreader and Limit at
// the moment)
class OrderState {
public:
orderman::OrderKey key;
api::orderman::OrderStatus status;
Quantity filled_quantity;
Quantity remaining_quantity;
Price average_filled_price;
std::string error_msg;
};
// a class used to speed up order generation. it will include
// pre-generated FIX for parts of the order that are known ahead of
// time.
@@ -89,8 +77,11 @@ public:
// called whenever a child order updates, as long as the spreader
// is not in a terminal state.
virtual void on_child_order (OrderState const&state) = 0;
virtual void on_child_order_update(orderman::OrderKey orderkey,
api::orderman::OrderStatus status,
Quantity filled_quantity,
Price avg_price,
const char* error_msg) = 0;
// called at an unspecified rate as long as the spreader is not in
// a terminal state
virtual void on_time(TimeStamp const&ts) = 0;
@@ -110,7 +101,7 @@ public:
protected:
// call this whenever the Spreader changes its OrderState
void report_state(OrderState const&) {}
void report_state() {}
// call this when spining a new order. for speed create a template
// object before with the things that do not commonly change.
@@ -19,15 +19,15 @@ public:
public:
SingleFillHedger hedger;
orderman::OrderKey order_key;
Quantity quotes_filled;
Price average_filled_price;
Quantity filled_quantity;
Price avergage_filled_price;
HedgerData(SingleFillHedger& hedger_arg)
:
hedger (hedger_arg),
quotes_filled (Quantity(0))
filled_quantity(Quantity(0))
{
}
void update_fill(Quantity total_filled_arg) { quotes_filled = total_filled_arg; }
void update_fill(Quantity total_filled_arg) { filled_quantity = total_filled_arg; }
};
// all the data for a leg, mainly
@@ -16,19 +16,50 @@ class SpreaderOrderUpdateMessage
public:
// original order_state passed from the engine infrastructure
// (do not cache it)
const OrderState order_state;
SpreaderOrderUpdateMessage(const OrderState& order_state_arg)
const orderman::OrderKey key;
const api::orderman::OrderStatus status;
const Quantity filled_quantity;
const Price avg_price;
const Quantity previous_filled_quantity;
const Price previous_avg_price;
const char* error_msg;
SpreaderOrderUpdateMessage(orderman::OrderKey orderkey_arg,
api::orderman::OrderStatus status_arg,
Quantity filled_quantity_arg,
Price avg_price_arg,
Quantity previous_filled_quantity_arg,
Price previous_avg_price_arg,
const char* error_msg_arg)
:
order_state(order_state_arg)
key(orderkey_arg),
status(status_arg),
filled_quantity(filled_quantity_arg),
avg_price(avg_price_arg),
previous_filled_quantity(previous_filled_quantity_arg),
previous_avg_price(previous_avg_price_arg),
error_msg(error_msg_arg)
{ }
bool terminal_status() const { return SpreaderUtils::order_in_terminal_state(status); }
bool has_error() const { return error_msg!=NULL; }
bool has_fills() const
{
return filled_quantity.value() != previous_filled_quantity.value();
}
bool terminal_status() const { return SpreaderUtils::order_in_terminal_state(order_state); }
bool has_error() const { return SpreaderUtils::order_has_error(order_state); }
Quantity get_last_filled_quantity (Quantity previous_filled_quantity) const
bool update_fill_price_quantity(Quantity& this_fill_quantity, Price& this_fill_price) const
{
return Quantity(order_state.filled_quantity.value() - previous_filled_quantity.value());
if (filled_quantity.value() != previous_filled_quantity.value())
{
bts_assert(filled_quantity.value() > previous_filled_quantity.value());
this_fill_quantity = Quantity(filled_quantity.value() - previous_filled_quantity.value());
double this_price = (avg_price.value()*filled_quantity.value() - previous_avg_price.value()*previous_filled_quantity.value()) / this_fill_quantity.value();
this_fill_price = Price(this_price);
return true;
}
else
return false;
}
};
}}
+8 -46
View File
@@ -93,53 +93,15 @@ public:
}
bts_assert(false);
}
void static parse_order(const OrderState& order_state,
Quantity current_aggregated_fill,
bool& filled,
bool& terminal_state,
bool& encountered_error,
bool& new_fills)
static bool order_in_terminal_state(api::orderman::OrderStatus order_status)
{
filled = order_state.status == api::orderman::OrderStatus::OS_FILLED;
terminal_state = order_state.status == api::orderman::OrderStatus::OS_CANCELED ||
order_state.status == api::orderman::OrderStatus::OS_DONE ||
order_state.status == api::orderman::OrderStatus::OS_EXPIRED ||
order_state.status == api::orderman::OrderStatus::OS_FILLED ||
order_state.status == api::orderman::OrderStatus::OS_REJECTED ||
order_state.status == api::orderman::OrderStatus::OS_STOPPED;
bts_assert(order_state.filled_quantity.value() >= current_aggregated_fill.value());
new_fills = order_state.filled_quantity.value() > current_aggregated_fill.value();
encountered_error = !order_state.error_msg.empty();
}
// uses the error_msg field to detect order errors
static bool order_has_error(const OrderState& order_state)
{
return !order_state.error_msg.empty();
}
static bool order_in_terminal_state(const OrderState& order_state)
{
return order_state.status == api::orderman::OrderStatus::OS_CANCELED ||
order_state.status == api::orderman::OrderStatus::OS_DONE ||
order_state.status == api::orderman::OrderStatus::OS_EXPIRED ||
order_state.status == api::orderman::OrderStatus::OS_FILLED ||
order_state.status == api::orderman::OrderStatus::OS_REJECTED ||
order_state.status == api::orderman::OrderStatus::OS_STOPPED;
}
static bool order_update_has_fills(Quantity previous_filled_quantity, Price previous_average_filled_price,
const OrderState order_state,
Quantity& this_fill_quantity, Price& this_fill_price)
{
if (order_state.filled_quantity.value() != previous_filled_quantity.value())
{
bts_assert(order_state.filled_quantity.value() > previous_filled_quantity.value());
this_fill_quantity = Quantity(order_state.filled_quantity.value() - previous_filled_quantity.value());
double this_price = (order_state.average_filled_price.value()*order_state.filled_quantity.value() - previous_average_filled_price.value()*previous_filled_quantity.value()) / this_fill_quantity.value();
this_fill_price = Price(this_price);
return true;
}
else
return false;
}
return order_status == api::orderman::OrderStatus::OS_CANCELED ||
order_status == api::orderman::OrderStatus::OS_DONE ||
order_status == api::orderman::OrderStatus::OS_EXPIRED ||
order_status == api::orderman::OrderStatus::OS_FILLED ||
order_status == api::orderman::OrderStatus::OS_REJECTED ||
order_status == api::orderman::OrderStatus::OS_STOPPED;
}
// CRITICAL PATH
// this traverses the depth of the book, accumulating the quantity,
// till the target quantity is reached. if the target quantity is not