SPARK-955 add unit test to cover this case

This commit is contained in:
Eric Harding committed 2018-07-16 15:03:56 -04:00
1 parent 71ddcd135b
commit dc99ea6ea4
1 file changed
+25
@@ -197,5 +197,30 @@ TEST_CASE("Synthetic3Legs", "[md][synthetic]") {
}
TEST_CASE("SPARK-955", "[md][synthetic]") {
shared_ptr<SyntheticStrategy> synthetic;
vector<Co2TestInstrument> test_instr;
tie(synthetic, test_instr) = make_securities({ {1.0, 0.25, api::SIDE_BUY}, {2.0, 0.25, api::SIDE_SELL }, { 1.0, 0.25, api::SIDE_BUY}});
auto esm8 = test_instr[0];
auto esu8 = test_instr[1];
auto esz8 = test_instr[2];
MDConsumerHandle synthetic_handle(synthetic);
setup_market(esm8.producer(),
{{2594.50, 47}, {2594.25,63}, {2594.00,117}, {2593.75,137}},
{{2594.75, 52}, {2595.00,138}, {2594.25,119}, {2595.50,128}});
setup_market(esu8.producer(),
{{2598.50, 14}, {2598.25, 15}, {2598.00,16}, {2597.75, 15}},
{{2599.75, 1}, {2600.00, 16}, {2600.25,15}, {2600.50, 75}});
setup_market(esz8.producer(),
{{2601.25, 2}, {2600.50, 3}, {2600.25, 10}},
{{2607.25, 3}, {2607.50, 1}, {2608.25, 9}});
expect_market(synthetic_handle,
// If we do strict price this is right. If we're pessimistic we get {-4.25,2}
{ {-4.00, 1}, {-4.25, 1}, { -5.00, 3}, {-5.25, 3}, {-5.50,1}, {-5.75, 6} },
{ {5.00, 3}, {5.25, 1}, {6.00,3}, {6.50,6} });
}
}}}//namespace