OnixS C++ ICE Binary Order Entry Handler 1.1.1
API Documentation
Loading...
Searching...
No Matches
Order.cpp
Go to the documentation of this file.
1/*
2* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3*
4* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5* and international copyright treaties.
6*
7* Access to and use of the software is governed by the terms of the applicable OnixS Software
8* Services Agreement (the Agreement) and Customer end user license agreements granting
9* a non-assignable, non-transferable and non-exclusive license to use the software
10* for it's own data processing purposes under the terms defined in the Agreement.
11*
12* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13* of this source code or associated reference material to any other location for further reproduction
14* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15*
16* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17* the terms of the Agreement is a violation of copyright law.
18*/
19
21
22#include "Order.h"
23#include "Utils.h"
24
25#include <Common/Helpers.h>
26
27namespace Samples {
28
30 : cIOrdId_(IdGenerator::newId())
31{
32}
33
34std::string toStr(Order::PriceOptional value)
35{
36 return (value != nullOpt) ? toStr(Decimal{*value, -9}) : toStr(nullOpt);
37}
38
39std::string Order::toString() const
40{
41 std::ostringstream builder;
42
43 builder
44 << "Order["
45 << "ClOrdID=" << cIOrdId_
46 << ", OrigCIOrdId=" << origCIOrdId_
47 << ", OrderStatus=" << orderStatus_
48 << ", SecurityId=" << securityId_
49 << ", Type=" << ordType_
50 << ", Price=" << toStr(price_)
51 << ", Quantity=" << toStr(Decimal{orderQty_, -9})
52 << ", LeavesQty=" << toStr(Decimal{leavesQty_, -9})
53 << ", Side=" << side_
54 << ", StopPx=" << toStr(stopPx_)
55 << ", LastFillPrice=" << toStr(lastPx_)
56 << ", TimeInForce=" << timeInForce_
57 << ", ExpireDate=" << (timeInForce_ == TimeInForceEnum::GTD && expireDate_ != nullOpt ? toStr(*expireDate_, TimestampFormat::YYYYMMDD) : toStr(nullOpt))
59 << ", MaxShow=" << toStr(maxShow_)
60 << ", ExecInst=" << execInst_
61 << "]"
62 ;
63
64 return builder.str();
65}
66
68 : crossId_{IdGenerator::newId()}
69 , buySideOrder_(std::make_shared<Order>())
70 , sellSideOrder_(std::make_shared<Order>())
71
72{
73}
74
75std::string CrossOrder::toString() const
76{
77 std::ostringstream builder;
78 builder
79 << "CrossOrder["
80 << "CrossId=" << crossId_;
81
82 builder << ", " << buySideOrder_->toString();
83 builder << ", " << sellSideOrder_->toString();
84
85 builder << "]";
86 return builder.str();
87}
88
89}
FloatingPointDecimal< Int64, Int32 > Decimal
Universal decimal type.
std::string toStr(Order::PriceOptional value)
Definition Order.cpp:34
@ YYYYMMDDHHMMSSnsec
YYYYMMDD-HH:MM:SS.sssssssss.
Definition Time.h:461
std::string toString() const
Human-readable presentation of the most interesting fields stored in the order.
Definition Order.cpp:75
OrderPtr buySideOrder_
Definition Order.h:100
CrossOrder()
Initializes a cross order.
Definition Order.cpp:67
OrderPtr sellSideOrder_
Definition Order.h:101
TimeInForceEnum timeInForce_
Definition Order.h:66
SideEnum side_
Definition Order.h:63
TimestampOptional expireDate_
Definition Order.h:67
std::string toString() const
Human-readable presentation of the most interesting fields stored in the order.
Definition Order.cpp:39
OrderTypeEnum ordType_
Definition Order.h:64
ClOrderId origCIOrdId_
Definition Order.h:58
QtiOptional maxShow_
Definition Order.h:71
SecurityId securityId_
Definition Order.h:62
ClOrderId cIOrdId_
Definition Order.h:57
Qty orderQty_
Definition Order.h:60
PriceOptional price_
Definition Order.h:59
ExecInstOptional execInst_
Definition Order.h:72
PriceOptional lastPx_
Definition Order.h:68
decltype(std::declval< const NewOrderRequest & >().price()) PriceOptional
Definition Order.h:33
PriceOptional stopPx_
Definition Order.h:65
TimestampOptional transactTime_
Definition Order.h:69
Order()
Initializes an order.
Definition Order.cpp:29
ExecTypeEnum orderStatus_
Definition Order.h:70
Qty leavesQty_
Definition Order.h:61