12 template <
class TOutputStream>
24 stream <<
"<unknown>";
30 template <
class TOutputStream>
45 stream <<
"STOP-LIMIT";
48 stream <<
"TRAILING-STOP";
51 stream <<
"TRAILING-STOP-LIMIT";
54 stream <<
"<unknown>";
60 template <
class TOutputStream>
78 stream <<
"<unknown>";
84 inline Order::Order(uint64_t
id, uint32_t symbol,
OrderType type,
OrderSide side, uint64_t price, uint64_t stop_price, uint64_t quantity,
OrderTimeInForce tif, uint64_t max_visible_quantity, uint64_t slippage, int64_t trailing_distance, int64_t trailing_step) noexcept
90 StopPrice(stop_price),
93 LeavesQuantity(quantity),
95 MaxVisibleQuantity(max_visible_quantity),
97 TrailingDistance(trailing_distance),
98 TrailingStep(trailing_step)
102 template <
class TOutputStream>
105 stream <<
"Order(Id=" << order.
Id
107 <<
"; Type=" << order.
Type
108 <<
"; Side=" << order.
Side
109 <<
"; Price=" << order.
Price
123 stream <<
"; Slippage=" << order.
Slippage;
130 return Order(
id, symbol,
OrderType::MARKET, side, 0, 0, quantity,
OrderTimeInForce::IOC, std::numeric_limits<uint64_t>::max(), slippage, 0, 0);
135 return Order(
id, symbol,
OrderType::MARKET,
OrderSide::BUY, 0, 0, quantity,
OrderTimeInForce::IOC, std::numeric_limits<uint64_t>::max(), slippage, 0, 0);
140 return Order(
id, symbol,
OrderType::MARKET,
OrderSide::SELL, 0, 0, quantity,
OrderTimeInForce::IOC, std::numeric_limits<uint64_t>::max(), slippage, 0, 0);
145 return Order(
id, symbol,
OrderType::LIMIT, side, price, 0, quantity, tif, max_visible_quantity, std::numeric_limits<uint64_t>::max(), 0, 0);
150 return Order(
id, symbol,
OrderType::LIMIT,
OrderSide::BUY, price, 0, quantity, tif, max_visible_quantity, std::numeric_limits<uint64_t>::max(), 0, 0);
155 return Order(
id, symbol,
OrderType::LIMIT,
OrderSide::SELL, price, 0, quantity, tif, max_visible_quantity, std::numeric_limits<uint64_t>::max(), 0, 0);
160 return Order(
id, symbol,
OrderType::STOP, side, 0, stop_price, quantity, tif, std::numeric_limits<uint64_t>::max(), slippage, 0, 0);
165 return Order(
id, symbol,
OrderType::STOP,
OrderSide::BUY, 0, stop_price, quantity, tif, std::numeric_limits<uint64_t>::max(), slippage, 0, 0);
170 return Order(
id, symbol,
OrderType::STOP,
OrderSide::SELL, 0, stop_price, quantity, tif, std::numeric_limits<uint64_t>::max(), slippage, 0, 0);
175 return Order(
id, symbol,
OrderType::STOP_LIMIT, side, price, stop_price, quantity, tif, max_visible_quantity, std::numeric_limits<uint64_t>::max(), 0, 0);
180 return Order(
id, symbol,
OrderType::STOP_LIMIT,
OrderSide::BUY, price, stop_price, quantity, tif, max_visible_quantity, std::numeric_limits<uint64_t>::max(), 0, 0);
185 return Order(
id, symbol,
OrderType::STOP_LIMIT,
OrderSide::SELL, price, stop_price, quantity, tif, max_visible_quantity, std::numeric_limits<uint64_t>::max(), 0, 0);
190 return Order(
id, symbol,
OrderType::TRAILING_STOP, side, 0, stop_price, quantity, tif, std::numeric_limits<uint64_t>::max(), slippage, trailing_distance, trailing_step);
195 return Order(
id, symbol,
OrderType::TRAILING_STOP,
OrderSide::BUY, 0, stop_price, quantity, tif, std::numeric_limits<uint64_t>::max(), slippage, trailing_distance, trailing_step);
200 return Order(
id, symbol,
OrderType::TRAILING_STOP,
OrderSide::SELL, 0, stop_price, quantity, tif, std::numeric_limits<uint64_t>::max(), slippage, trailing_distance, trailing_step);
205 return Order(
id, symbol,
OrderType::TRAILING_STOP_LIMIT, side, price, stop_price, quantity, tif, max_visible_quantity, std::numeric_limits<uint64_t>::max(), trailing_distance, trailing_step);
210 return Order(
id, symbol,
OrderType::TRAILING_STOP_LIMIT,
OrderSide::BUY, price, stop_price, quantity, tif, max_visible_quantity, std::numeric_limits<uint64_t>::max(), trailing_distance, trailing_step);
215 return Order(
id, symbol,
OrderType::TRAILING_STOP_LIMIT,
OrderSide::SELL, price, stop_price, quantity, tif, max_visible_quantity, std::numeric_limits<uint64_t>::max(), trailing_distance, trailing_step);
OrderTimeInForce
Order Time in Force.
@ IOC
Immediate-Or-Cancel.
@ GTC
Good-Till-Cancelled.
TOutputStream & operator<<(TOutputStream &stream, ErrorCode error)
C++ Trader project definitions.
bool IsHidden() const noexcept
Is the 'Hidden' order?
bool IsIceberg() const noexcept
Is the 'Iceberg' order?
static Order SellLimit(uint64_t id, uint32_t symbol, uint64_t price, uint64_t quantity, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t max_visible_quantity=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new sell limit order.
static Order BuyStopLimit(uint64_t id, uint32_t symbol, uint64_t stop_price, uint64_t price, uint64_t quantity, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t max_visible_quantity=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new buy stop-limit order.
static Order BuyMarket(uint64_t id, uint32_t symbol, uint64_t quantity, uint64_t slippage=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new buy market order.
static Order TrailingBuyStop(uint64_t id, uint32_t symbol, uint64_t stop_price, uint64_t quantity, int64_t trailing_distance, int64_t trailing_step=0, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t slippage=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new trailing buy stop order.
static Order Stop(uint64_t id, uint32_t symbol, OrderSide side, uint64_t stop_price, uint64_t quantity, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t slippage=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new stop order.
OrderSide Side
Order side.
uint64_t Price
Order price.
uint64_t MaxVisibleQuantity
Order max visible quantity.
bool IsTrailingStop() const noexcept
Is the trailing stop order?
int64_t TrailingStep
Order trailing step.
bool IsSlippage() const noexcept
Is the order have slippage?
uint64_t ExecutedQuantity
Order executed quantity.
Order & operator=(const Order &) noexcept=default
static Order TrailingStop(uint64_t id, uint32_t symbol, OrderSide side, uint64_t stop_price, uint64_t quantity, int64_t trailing_distance, int64_t trailing_step=0, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t slippage=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new trailing stop order.
static Order Market(uint64_t id, uint32_t symbol, OrderSide side, uint64_t quantity, uint64_t slippage=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new market order.
static Order SellStopLimit(uint64_t id, uint32_t symbol, uint64_t stop_price, uint64_t price, uint64_t quantity, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t max_visible_quantity=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new sell stop-limit order.
static Order TrailingStopLimit(uint64_t id, uint32_t symbol, OrderSide side, uint64_t stop_price, uint64_t price, uint64_t quantity, int64_t trailing_distance, int64_t trailing_step=0, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t max_visible_quantity=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new trailing stop-limit order.
static Order StopLimit(uint64_t id, uint32_t symbol, OrderSide side, uint64_t stop_price, uint64_t price, uint64_t quantity, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t max_visible_quantity=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new stop-limit order.
static Order Limit(uint64_t id, uint32_t symbol, OrderSide side, uint64_t price, uint64_t quantity, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t max_visible_quantity=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new limit order.
uint64_t LeavesQuantity
Order leaves quantity.
uint64_t StopPrice
Order stop price.
OrderType Type
Order type.
static Order SellMarket(uint64_t id, uint32_t symbol, uint64_t quantity, uint64_t slippage=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new sell market order.
OrderTimeInForce TimeInForce
Time in Force.
static Order SellStop(uint64_t id, uint32_t symbol, uint64_t stop_price, uint64_t quantity, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t slippage=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new sell stop order.
static Order BuyLimit(uint64_t id, uint32_t symbol, uint64_t price, uint64_t quantity, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t max_visible_quantity=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new buy limit order.
int64_t TrailingDistance
Order trailing distance to market.
static Order TrailingBuyStopLimit(uint64_t id, uint32_t symbol, uint64_t stop_price, uint64_t price, uint64_t quantity, int64_t trailing_distance, int64_t trailing_step=0, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t max_visible_quantity=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new trailing buy stop-limit order.
uint32_t SymbolId
Symbol Id.
bool IsTrailingStopLimit() const noexcept
Is the trailing stop-limit order?
static Order BuyStop(uint64_t id, uint32_t symbol, uint64_t stop_price, uint64_t quantity, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t slippage=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new buy stop order.
uint64_t Slippage
Market order slippage.
static Order TrailingSellStop(uint64_t id, uint32_t symbol, uint64_t stop_price, uint64_t quantity, int64_t trailing_distance, int64_t trailing_step=0, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t slippage=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new trailing sell stop order.
uint64_t Quantity
Order quantity.
static Order TrailingSellStopLimit(uint64_t id, uint32_t symbol, uint64_t stop_price, uint64_t price, uint64_t quantity, int64_t trailing_distance, int64_t trailing_step=0, OrderTimeInForce tif=OrderTimeInForce::GTC, uint64_t max_visible_quantity=std::numeric_limits< uint64_t >::max()) noexcept
Prepare a new trailing sell stop-limit order.
OrderNode & operator=(const Order &order) noexcept
OrderNode(const Order &order) noexcept