21 #define BOOST_TEST_MODULE isimud_tests
22 #include <boost/test/included/unit_test.hpp>
24 #include <boost/mpl/list.hpp>
26 #include "../exchanges/FIX/v5.0sp2/fix.hpp"
27 #include "../exchanges/MIT/BIT/bit.hpp"
28 #include "../exchanges/MIT/BIT/bit_sim.hpp"
29 #include "../exchanges/MIT/JSE/jse.hpp"
30 #include "../exchanges/MIT/JSE/jse_sim.hpp"
31 #include "../exchanges/MIT/LSE/lse.hpp"
32 #include "../exchanges/MIT/LSE/lse_sim.hpp"
33 #include "../exchanges/MIT/OSLO/oslo.hpp"
34 #include "../exchanges/MIT/OSLO/oslo_sim.hpp"
35 #include "../exchanges/MIT/TRQ/trq.hpp"
36 #include "../exchanges/MIT/TRQ/trq_sim.hpp"
37 #include "../exchanges/conversions/fix_to_mit_conversions.hpp"
38 #include "../exchanges/conversions/mit_to_fix_conversions.hpp"
40 #include "core/latency_timestamps.hpp"
42 using namespace libjmmcg;
43 using namespace libisimud;
54 typedef boost::mpl::list<
55 std::pair<exchanges::MIT::BIT::link_t<exchanges::FIX::v5_0sp2::MsgTypes>, exchanges::MIT::BIT::simulator_t>,
56 std::pair<exchanges::MIT::JSE::link_t<exchanges::FIX::v5_0sp2::MsgTypes>, exchanges::MIT::JSE::simulator_t>,
57 std::pair<exchanges::MIT::LSE::link_t<exchanges::FIX::v5_0sp2::MsgTypes>, exchanges::MIT::LSE::simulator_t>,
58 std::pair<exchanges::MIT::OSLO::link_t<exchanges::FIX::v5_0sp2::MsgTypes>, exchanges::MIT::OSLO::simulator_t>,
59 std::pair<exchanges::MIT::TRQ::link_t<exchanges::FIX::v5_0sp2::MsgTypes>, exchanges::MIT::TRQ::simulator_t>
62 template<
class exchg_t>
64 using link_t=
typename exchg_t::first_type;
65 using simulator_t=
typename exchg_t::second_type;
66 using conn_pol_t=
typename link_t::exchg_link_t::conn_pol_t;
68 typename simulator_t::msg_processor_t::msg_details_t,
71 using ref_data_t=
typename link_t::client_link_t::proc_rules_t::ref_data;
74 const std::string ref_data_file(
75 "133215;FTSE100;SET0;PT_T;TP_1;GB00BH4HKS39;;20060731;0;1;10000;42467000;1;;1;DE;VOD;VODAFONE GRP.;BH4HKS3;15225662730;GBX;1;Y;0023;VOVOD;VODAFONE GROUP PLC;0;;;15000;ORD USD0.20 20/21;;1;1;5;GB;;;FE00;1;;;;1;A;;;;;;\n"
76 "2926;FTSE100;SET1;PT_T;TP_12;GB0000595859;;20000419;0;1;3000;32438040;1;;1;DE;ARM;ARM HLDGS.;0059585;3861344694;GBX;1;Y;0023;ARARM;ARM HOLDINGS PLC;0;;;7500;ORD 0.05P;;1;1;5;GB;;;FS10;4;;;;2;B;;;;;;"
80 return ref_data_t(ss);
99 no_latency_timestamps
ts{0
};
103 simulator_t::socket_t::socket_priority::low,
104 api_thread_traits::processor_mask_type(exchanges::common::thread_traits::exchange_simulator_thread.core),
105 exchanges::common::thread_traits::exchange_simulator_thread.priority,
106 typename simulator_t::proc_rules_t(),
112 template<
class exchg_t>
115 using link_t=
typename base_t::link_t;
117 no_latency_timestamps
ts{0
};
119 typename link_t::client_link_t::ctor_args{
122 typename link_t::client_link_t::proc_rules_t(
this->ref_data)
125 link_t::socket_t::socket_priority::high,
126 link_t::socket_t::socket_priority::low,
127 typename link_t::exchg_to_client_proc_rules_t(
this->ref_data),
133 template<
class exchg_t>
146 BOOST_AUTO_TEST_SUITE(exchange_gateways)
148 BOOST_AUTO_TEST_SUITE(client_initiated)
155 BOOST_AUTO_TEST_CASE_TEMPLATE(logon_no_clients, exchg_t, exchg_t_types) {
160 BOOST_CHECK(f.link.is_logged_on());
168 BOOST_AUTO_TEST_CASE_TEMPLATE(re_logon_no_clients, exchg_t, exchg_t_types) {
172 no_latency_timestamps ts
{0
};
175 const typename fixture_t::link_t link{
176 typename fixture_t::link_t::client_link_t::ctor_args{
179 typename fixture_t::link_t::client_link_t::proc_rules_t(f.ref_data)
182 fixture_t::link_t::socket_t::socket_priority::high,
183 fixture_t::link_t::socket_t::socket_priority::low,
184 typename fixture_t::link_t::exchg_to_client_proc_rules_t(f.ref_data),
188 BOOST_CHECK(link.is_logged_on());
191 const typename fixture_t::link_t link{
192 typename fixture_t::link_t::client_link_t::ctor_args{
195 typename fixture_t::link_t::client_link_t::proc_rules_t(f.ref_data)
198 fixture_t::link_t::socket_t::socket_priority::high,
199 fixture_t::link_t::socket_t::socket_priority::low,
200 typename fixture_t::link_t::exchg_to_client_proc_rules_t(f.ref_data),
204 BOOST_CHECK(link.is_logged_on());
213 BOOST_AUTO_TEST_CASE_TEMPLATE(logon_with_a_client, exchg_t, exchg_t_types) {
218 BOOST_CHECK(f.link.is_logged_on());
220 const exchanges::
FIX::
v5_0sp2::connection_t client(
221 exchanges::FIX::v5_0sp2::connection_t::conn_pol_t(
222 typename exchanges::FIX::v5_0sp2::connection_t::conn_pol_t::gateways_t(
223 std::make_pair(localhost, client_port)
226 exchanges::FIX::v5_0sp2::connection_t::socket_t::socket_priority::low,
227 exchanges::common::thread_traits::client_to_exchange_thread.core
229 BOOST_CHECK(f.link.is_logged_on());
231 BOOST_CHECK(f.link.is_logged_on());
239 BOOST_AUTO_TEST_CASE_TEMPLATE(re_connect_client_with_logon, exchg_t, exchg_t_types) {
244 BOOST_CHECK(f.link.is_logged_on());
246 const exchanges::
FIX::
v5_0sp2::connection_t client(
247 exchanges::FIX::v5_0sp2::connection_t::conn_pol_t(
248 typename exchanges::FIX::v5_0sp2::connection_t::conn_pol_t::gateways_t(
249 std::make_pair(localhost, client_port)
252 exchanges::FIX::v5_0sp2::connection_t::socket_t::socket_priority::low,
253 exchanges::common::thread_traits::client_to_exchange_thread.core
255 BOOST_CHECK(f.link.is_logged_on());
257 BOOST_CHECK(f.link.is_logged_on());
259 const exchanges::
FIX::
v5_0sp2::connection_t client(
260 exchanges::FIX::v5_0sp2::connection_t::conn_pol_t(
261 typename exchanges::FIX::v5_0sp2::connection_t::conn_pol_t::gateways_t(
262 std::make_pair(localhost, client_port)
265 exchanges::FIX::v5_0sp2::connection_t::socket_t::socket_priority::low,
266 exchanges::common::thread_traits::client_to_exchange_thread.core
268 BOOST_CHECK(f.link.is_logged_on());
270 BOOST_CHECK(f.link.is_logged_on());
278 BOOST_AUTO_TEST_CASE_TEMPLATE(heartbeats_no_clients, exchg_t, exchg_t_types) {
283 std::this_thread::sleep_for(std::chrono::seconds(fixture_t::simulator_t::svr_mgr_t::heartbeats_t::heartbeat_interval*(fixture_t::simulator_t::svr_mgr_t::heartbeats_t::max_missed_heartbeats+1)));
284 BOOST_CHECK(f.link.is_logged_on());
292 BOOST_AUTO_TEST_CASE_TEMPLATE(heartbeats_with_client, exchg_t, exchg_t_types) {
297 std::this_thread::sleep_for(std::chrono::seconds(fixture_t::simulator_t::svr_mgr_t::heartbeats_t::heartbeat_interval*(fixture_t::simulator_t::svr_mgr_t::heartbeats_t::max_missed_heartbeats+1)));
298 BOOST_CHECK(f.link.is_logged_on());
306 BOOST_AUTO_TEST_CASE_TEMPLATE(reject, exchg_t, exchg_t_types) {
311 BOOST_CHECK(f.link.is_logged_on());
314 "8=FIX.5.0\0019=154\00135=D\00134=10\00143=N\00149=VENDOR\00150=CUSTOME\00156=BROKER\00160=19980930-09:25:58\0011=XQCCFUND\00111=10\00121=1\00155=EK\00148=GB0000595859\00122=4\00154=1\00138=10000\00140=2\00144=76.750000\00159=0\00110=092\001"
316 exchanges::
FIX::
v5_0sp2::
MsgTypes::NewOrderSingle
const &fix_msg=
reinterpret_cast<exchanges::FIX::v5_0sp2::MsgTypes::NewOrderSingle
const &>(*fix_buffer.begin());
317 BOOST_CHECK_EQUAL(fix_msg.type(), exchanges::FIX::v5_0sp2::MsgTypes::NewOrderSingle::static_type);
318 BOOST_REQUIRE_NO_THROW(f.client.send(fix_msg));
319 BOOST_CHECK(f.link.is_logged_on());
321 BOOST_REQUIRE_NO_THROW(f.client.receive(receive_fix_msg));
322 BOOST_CHECK(receive_fix_msg.is_valid());
323 auto const ref_seq_num=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::RefSeqNum>();
324 BOOST_CHECK_EQUAL(std::string(ref_seq_num.first, ref_seq_num.second),
"2");
325 BOOST_CHECK(f.link.is_logged_on());
333 BOOST_AUTO_TEST_CASE_TEMPLATE(cancel_reject, exchg_t, exchg_t_types) {
338 BOOST_CHECK(f.link.is_logged_on());
341 "8=FIX.5.0\0019=141\00135=F\00111=10\00141=10\00148=GB00BH4HKS39\00149=VENDOR\00156=BROKER\00134=10\00152=20000426-12:05:06\00155=EK\00154=1\00160=19980930-09:25:58\00138=99\00140=1\00144=43.000000\00159=0\00110=012\001"
343 exchanges::
FIX::
v5_0sp2::
MsgTypes::OrderCancelRequest
const &fix_msg=
reinterpret_cast<exchanges::FIX::v5_0sp2::MsgTypes::OrderCancelRequest
const &>(*fix_buffer.begin());
344 BOOST_CHECK_EQUAL(fix_msg.type(), exchanges::FIX::v5_0sp2::MsgTypes::OrderCancelRequest::static_type);
345 BOOST_REQUIRE_NO_THROW(f.client.send(fix_msg));
346 BOOST_CHECK(f.link.is_logged_on());
348 BOOST_REQUIRE_NO_THROW(f.client.receive(receive_fix_msg));
349 BOOST_CHECK(receive_fix_msg.is_valid());
350 auto const client_order_id=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::ClOrdID>();
351 BOOST_CHECK_EQUAL(std::string(client_order_id.first, client_order_id.second).c_str(),
"10");
352 auto const seqNum=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::MsgSeqNum>();
353 BOOST_CHECK_EQUAL(std::string(seqNum.first, seqNum.second),
"2");
354 BOOST_CHECK(f.link.is_logged_on());
362 BOOST_AUTO_TEST_CASE_TEMPLATE(cancel_accept, exchg_t, exchg_t_types) {
368 "8=FIX.5.0\0019=167\00135=D\00134=10\00143=N\00149=VENDOR\00150=CUSTOME\00156=BROKER\00160=19980930-09:25:58\0011=XQCCFUND\00111=10\00121=1\00155=EK\00148=GB00BH4HKS39\00122=4\00154=1\00138=99\00140=2\00144=43.000000\00159=0\0011133=G\001100=MTAA\00110=117\001"
370 exchanges::
FIX::
v5_0sp2::
MsgTypes::NewOrderSingle
const &order_fix_msg=
reinterpret_cast<exchanges::FIX::v5_0sp2::MsgTypes::NewOrderSingle
const &>(*order_fix_buffer.begin());
371 BOOST_CHECK_EQUAL(order_fix_msg.type(), exchanges::FIX::v5_0sp2::MsgTypes::NewOrderSingle::static_type);
372 BOOST_CHECK(order_fix_msg.is_valid());
373 BOOST_REQUIRE_NO_THROW(f.client.send(order_fix_msg));
375 "8=FIX.5.0\0019=157\00135=F\00111=10\00141=10\00148=GB00BH4HKS39\00149=VENDOR\00156=BROKER\00134=10\00152=20000426-12:05:06\00155=EK\00154=1\00160=19980930-09:25:58\00138=99\00140=2\00144=43.000000\00159=0\0011133=G\001100=MTAA\00110=083\001"
377 exchanges::
FIX::
v5_0sp2::
MsgTypes::OrderCancelRequest
const &cancel_fix_msg=
reinterpret_cast<exchanges::FIX::v5_0sp2::MsgTypes::OrderCancelRequest
const &>(*cancel_fix_buffer.begin());
378 BOOST_CHECK_EQUAL(cancel_fix_msg.type(), exchanges::FIX::v5_0sp2::MsgTypes::OrderCancelRequest::static_type);
379 BOOST_CHECK(cancel_fix_msg.is_valid());
380 BOOST_REQUIRE_NO_THROW(f.client.send(cancel_fix_msg));
383 BOOST_REQUIRE_NO_THROW(f.client.receive(order_new_fix_msg));
384 BOOST_CHECK(order_new_fix_msg.is_valid());
385 auto const client_order_id=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::ClOrdID>();
386 BOOST_CHECK_EQUAL(std::string(client_order_id.first, client_order_id.second).c_str(),
"10");
387 auto const seqNum=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::MsgSeqNum>();
388 BOOST_CHECK_EQUAL(std::string(seqNum.first, seqNum.second),
"2");
389 auto const securityIDSource=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::SecurityIDSource>();
390 BOOST_CHECK_EQUAL(std::string(securityIDSource.first, securityIDSource.second),
"4");
391 auto const securityID=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::SecurityID>();
392 BOOST_CHECK_EQUAL(std::string(securityID.first, securityID.second),
"GB00BH4HKS39");
393 auto const execType=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::ExecType>();
394 BOOST_CHECK_EQUAL(
static_cast<exchanges::FIX::common::ExecType>(*execType.first), exchanges::FIX::common::ExecType::New);
395 auto const price=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::Price>();
396 BOOST_CHECK_EQUAL(std::string(price.first, price.second),
"0.000000");
397 auto const side=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::Side>();
398 BOOST_CHECK_EQUAL(std::string(side.first, side.second),
"1");
399 auto const ordStatus=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::OrdStatus>();
400 BOOST_CHECK_EQUAL(
static_cast<exchanges::FIX::common::OrdStatus>(*ordStatus.first), exchanges::FIX::common::OrdStatus::New);
401 auto const orderQty=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::OrderQty>();
402 BOOST_CHECK_EQUAL(std::string(orderQty.first, orderQty.second),
"0");
403 auto const leavesQty=order_new_fix_msg.find<exchanges::FIX::common::FieldsFast::LeavesQty>();
404 BOOST_CHECK_EQUAL(std::string(leavesQty.first, leavesQty.second),
"99");
405 BOOST_CHECK(f.link.is_logged_on());
408 BOOST_REQUIRE_NO_THROW(f.client.receive(cancelled_fix_msg));
409 BOOST_CHECK(cancelled_fix_msg.is_valid());
410 auto const client_order_id=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::ClOrdID>();
411 BOOST_CHECK_EQUAL(std::string(client_order_id.first, client_order_id.second).c_str(),
"10");
412 auto const seqNum=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::MsgSeqNum>();
413 BOOST_CHECK_EQUAL(std::string(seqNum.first, seqNum.second),
"3");
414 auto const securityIDSource=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::SecurityIDSource>();
415 BOOST_CHECK_EQUAL(std::string(securityIDSource.first, securityIDSource.second),
"4");
416 auto const securityID=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::SecurityID>();
417 BOOST_CHECK_EQUAL(std::string(securityID.first, securityID.second),
"GB00BH4HKS39");
418 auto const execType=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::ExecType>();
419 BOOST_CHECK_EQUAL(
static_cast<exchanges::FIX::common::ExecType>(*execType.first), exchanges::FIX::common::ExecType::Canceled);
420 auto const price=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::Price>();
421 BOOST_CHECK_EQUAL(std::string(price.first, price.second),
"43.000000");
422 auto const side=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::Side>();
423 BOOST_CHECK_EQUAL(std::string(side.first, side.second),
"1");
424 auto const ordStatus=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::OrdStatus>();
425 BOOST_CHECK_EQUAL(
static_cast<exchanges::FIX::common::OrdStatus>(*ordStatus.first), exchanges::FIX::common::OrdStatus::Canceled);
426 auto const orderQty=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::OrderQty>();
427 BOOST_CHECK_EQUAL(std::string(orderQty.first, orderQty.second),
"0");
428 auto const leavesQty=cancelled_fix_msg.find<exchanges::FIX::common::FieldsFast::LeavesQty>();
429 BOOST_CHECK_EQUAL(std::string(leavesQty.first, leavesQty.second),
"99");
430 BOOST_CHECK(f.link.is_logged_on());
438 BOOST_AUTO_TEST_CASE_TEMPLATE(modify_reject, exchg_t, exchg_t_types) {
444 "8=FIX.5.0\0019=141\00135=G\00111=10\00141=10\00148=GB00BH4HKS39\00149=VENDOR\00156=BROKER\00134=10\00152=20000426-12:05:06\00155=EK\00154=1\00160=19980930-09:25:58\00138=99\00140=1\00144=43.000000\00159=0\00110=102\001"
446 exchanges::
FIX::
v5_0sp2::
MsgTypes::OrderCancelReplace
const &fix_msg=
reinterpret_cast<exchanges::FIX::v5_0sp2::MsgTypes::OrderCancelReplace
const &>(*fix_buffer.begin());
447 BOOST_CHECK_EQUAL(fix_msg.type(), exchanges::FIX::v5_0sp2::MsgTypes::OrderCancelReplace::static_type);
448 BOOST_CHECK(fix_msg.is_valid());
449 BOOST_REQUIRE_NO_THROW(f.client.send(fix_msg));
451 BOOST_REQUIRE_NO_THROW(f.client.receive(receive_fix_msg));
452 BOOST_CHECK(receive_fix_msg.is_valid());
453 auto const client_order_id=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::ClOrdID>();
454 BOOST_CHECK_EQUAL(std::string(client_order_id.first, client_order_id.second).c_str(),
"10");
455 auto const seqNum=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::MsgSeqNum>();
456 BOOST_CHECK_EQUAL(std::string(seqNum.first, seqNum.second),
"2");
457 BOOST_CHECK(f.link.is_logged_on());
460 BOOST_AUTO_TEST_SUITE_END()
462 BOOST_AUTO_TEST_SUITE(new_order)
464 BOOST_AUTO_TEST_SUITE(buy)
466 BOOST_AUTO_TEST_SUITE(day)
473 BOOST_AUTO_TEST_CASE_TEMPLATE(market_fill, exchg_t, exchg_t_types) {
479 "8=FIX.5.0\0019=151\00135=D\00134=10\00143=N\00149=VENDOR\00150=CUSTOME\00156=BROKER\00160=19980930-09:25:58\0011=XQCCFUND\00111=10\00121=1\00155=EK\00148=GB00BH4HKS39\00122=4\00154=1\00138=99\00140=1\00144=41.000000\00159=0\00110=133\001"
481 exchanges::
FIX::
v5_0sp2::
MsgTypes::NewOrderSingle
const &fix_msg=
reinterpret_cast<exchanges::FIX::v5_0sp2::MsgTypes::NewOrderSingle
const &>(*fix_buffer.begin());
482 BOOST_CHECK_EQUAL(fix_msg.type(), exchanges::FIX::v5_0sp2::MsgTypes::NewOrderSingle::static_type);
483 BOOST_CHECK(fix_msg.is_valid());
484 BOOST_REQUIRE_NO_THROW(f.client.send(fix_msg));
486 BOOST_REQUIRE_NO_THROW(f.client.receive(receive_fix_msg));
487 BOOST_CHECK(receive_fix_msg.is_valid());
488 auto const client_order_id=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::ClOrdID>();
489 BOOST_CHECK_EQUAL(std::string(client_order_id.first, client_order_id.second).c_str(),
"10");
490 auto const seqNum=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::MsgSeqNum>();
491 BOOST_CHECK_EQUAL(std::string(seqNum.first, seqNum.second),
"2");
492 auto const securityIDSource=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::SecurityIDSource>();
493 BOOST_CHECK_EQUAL(std::string(securityIDSource.first, securityIDSource.second),
"4");
494 auto const securityID=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::SecurityID>();
495 BOOST_CHECK_EQUAL(std::string(securityID.first, securityID.second),
"GB00BH4HKS39");
496 auto const execType=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::ExecType>();
497 BOOST_CHECK_EQUAL(
static_cast<exchanges::FIX::common::ExecType>(*execType.first), exchanges::FIX::common::ExecType::New);
498 auto const price=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::Price>();
499 BOOST_CHECK_EQUAL(std::string(price.first, price.second),
"41.000000");
500 auto const side=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::Side>();
501 BOOST_CHECK_EQUAL(std::string(side.first, side.second),
"1");
502 auto const ordStatus=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::OrdStatus>();
503 BOOST_CHECK_EQUAL(
static_cast<exchanges::FIX::common::OrdStatus>(*ordStatus.first), exchanges::FIX::common::OrdStatus::Filled);
504 auto const orderQty=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::OrderQty>();
505 BOOST_CHECK_EQUAL(std::string(orderQty.first, orderQty.second),
"99");
506 auto const leavesQty=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::LeavesQty>();
507 BOOST_CHECK_EQUAL(std::string(leavesQty.first, leavesQty.second),
"0");
515 BOOST_AUTO_TEST_CASE_TEMPLATE(market_partial_fill, exchg_t, exchg_t_types) {
521 "8=FIX.5.0\0019=152\00135=D\00134=10\00143=N\00149=VENDOR\00150=CUSTOME\00156=BROKER\00160=19980930-09:25:58\0011=XQCCFUND\00111=10\00121=1\00155=EK\00148=GB00BH4HKS39\00122=4\00154=1\00138=101\00140=1\00144=41.000000\00159=0\00110=166\001"
523 exchanges::
FIX::
v5_0sp2::
MsgTypes::NewOrderSingle
const &fix_msg=
reinterpret_cast<exchanges::FIX::v5_0sp2::MsgTypes::NewOrderSingle
const &>(*fix_buffer.begin());
524 BOOST_CHECK_EQUAL(fix_msg.type(), exchanges::FIX::v5_0sp2::MsgTypes::NewOrderSingle::static_type);
525 BOOST_CHECK(fix_msg.is_valid());
526 BOOST_REQUIRE_NO_THROW(f.client.send(fix_msg));
528 BOOST_REQUIRE_NO_THROW(f.client.receive(receive_fix_msg));
529 BOOST_CHECK(receive_fix_msg.is_valid());
530 auto const client_order_id=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::ClOrdID>();
531 BOOST_CHECK_EQUAL(std::string(client_order_id.first, client_order_id.second).c_str(),
"10");
532 auto const seqNum=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::MsgSeqNum>();
533 BOOST_CHECK_EQUAL(std::string(seqNum.first, seqNum.second),
"2");
534 auto const securityIDSource=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::SecurityIDSource>();
535 BOOST_CHECK_EQUAL(std::string(securityIDSource.first, securityIDSource.second),
"4");
536 auto const securityID=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::SecurityID>();
537 BOOST_CHECK_EQUAL(std::string(securityID.first, securityID.second),
"GB00BH4HKS39");
538 auto const execType=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::ExecType>();
539 BOOST_CHECK_EQUAL(
static_cast<exchanges::FIX::common::ExecType>(*execType.first), exchanges::FIX::common::ExecType::New);
540 auto const price=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::Price>();
541 BOOST_CHECK_EQUAL(std::string(price.first, price.second),
"42.000000");
542 auto const side=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::Side>();
543 BOOST_CHECK_EQUAL(std::string(side.first, side.second),
"1");
544 auto const ordStatus=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::OrdStatus>();
545 BOOST_CHECK_EQUAL(
static_cast<exchanges::FIX::common::OrdStatus>(*ordStatus.first), exchanges::FIX::common::OrdStatus::Partially_filled);
546 auto const orderQty=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::OrderQty>();
547 BOOST_CHECK_EQUAL(std::string(orderQty.first, orderQty.second),
"100");
548 auto const leavesQty=receive_fix_msg.find<exchanges::FIX::common::FieldsFast::LeavesQty>();
549 BOOST_CHECK_EQUAL(std::string(leavesQty.first, leavesQty.second),
"1");
552 BOOST_AUTO_TEST_SUITE_END()
554 BOOST_AUTO_TEST_SUITE_END()
556 BOOST_AUTO_TEST_SUITE_END()
558 BOOST_AUTO_TEST_SUITE_END()