OnixS C++ B3 BOE Binary Order Entry  1.2.0
API Documentation
Exchanging Messages

Sending Messages

To send a message to a counterparty, use the OnixS::B3::BOE::Session::send method. The Handler sets all session-level fields automatically (e.g., SeqNum, SendingTimeEpoch).

Note
The session should be fully established before sending application-level messages.

Receiving Messages

To receive messages, override corresponding methods of the OnixS::B3::BOE::SessionListener class and pass the instance of the descendant class to the OnixS::B3::BOE::Session's constructor.

Example

using namespace OnixS::B3::BOE;
using namespace OnixS::B3::BOE::Messaging;
class MyListener : public SessionListener
{
public:
void onExecutionReportNew(const ExecutionReportNew200& msg, Session* /*sn*/) override
{
std::clog << msg << std::endl;
}
};
const int MarketSegmentId = 80;
const std::string CounterpartyHost = "Localhost";
const int CounterpartyPort = 64124;
SessionSettings settings;
settings.licenseStore("../../license")
.sessionId(100000000 /* "Value Received From B3" */)
.accessKey("Value Received From B3")
.enteringFirm(100 /* "Value Received From B3" */)
.tradingSystemName("Your Trading System Name Here");
MyListener listener;
Session session(settings, &listener);
session.connect(CounterpartyHost, CounterpartyPort);
typedef MessageHolder<NewOrderSingle102> NewOrderSingle;
NewOrderSingle order;
InboundBusinessHeader & header = order->businessHeader();
header.setMarketSegmentId(MarketSegmentId);
order->setOrdTagId(100)
.setMmProtectionReset(Boolean::FalseValue)
.setClOrdId(1)
.setAccount(10101)
.setSenderLocation("DMA")
.setEnteringTrader("TADA")
.setSelfTradePreventionInstruction(SelfTradePreventionInstruction::None)
.setSecurityId(100000140035)
.setSide(Side::Buy)
.setOrdType(OrdType::Limit)
.setTimeInForce(TimeInForce::Day)
.setRoutingInstructionToNull()
.setOrderQty(100)
.setPrice(PriceOptional(10100))
.setInvestorIdToNull()
.setMemo("VALE3 1714479423613")
.setDeskId("1");
iid.setPrefix(300);
iid.setDocument(123456);
order->setInvestorId(iid);
session.send(order);
// ...
session.disconnect();