201 lines
6.8 KiB
C++
Executable File
201 lines
6.8 KiB
C++
Executable File
// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
|
|
//
|
|
// This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
|
|
// and international copyright treaties.
|
|
//
|
|
// Access to and use of the software is governed by the terms of the applicable OnixS Software
|
|
// Services Agreement (the Agreement) and Customer end user license agreements granting
|
|
// a non-assignable, non-transferable and non-exclusive license to use the software
|
|
// for it's own data processing purposes under the terms defined in the Agreement.
|
|
//
|
|
// Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
|
|
// of this source code or associated reference material to any other location for further reproduction
|
|
// or redistribution, and any amendments to this copyright notice, are expressly prohibited.
|
|
//
|
|
// Any reproduction or redistribution for sale or hiring of the Software not in accordance with
|
|
// the terms of the Agreement is a violation of copyright law.
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include "OnixS/CME/MDP3/Tags.h"
|
|
#include "OnixS/CME/MDP3/Messaging.h"
|
|
#include "OnixS/CME/MDP3/EventIndicator.h"
|
|
|
|
namespace OnixS
|
|
{
|
|
namespace CME
|
|
{
|
|
namespace MDP3
|
|
{
|
|
|
|
/// Known requested sides.
|
|
struct ONIXS_CME_MDP3_API RequestedSides
|
|
{
|
|
/// Known requested sides.
|
|
enum Enum
|
|
{
|
|
/// Identifies absence of value.
|
|
Undefined = -1,
|
|
|
|
/// Requested buy.
|
|
Buy = 1,
|
|
|
|
/// Requested sell.
|
|
Sell = 2,
|
|
|
|
/// Requested cross order (Request For Cross AKA RFC).
|
|
Cross = 8
|
|
};
|
|
|
|
/// Returns constant from its string representation.
|
|
static Enum deserialize(const char* text);
|
|
|
|
/// Returns string representation of given constant.
|
|
static const char* toString(Enum value);
|
|
};
|
|
|
|
typedef RequestedSides::Enum RequestedSide;
|
|
|
|
/// Known requested quote types.
|
|
struct ONIXS_CME_MDP3_API RequestedQuoteTypes
|
|
{
|
|
/// Known requested quote types.
|
|
enum Enum
|
|
{
|
|
/// Identifies absence of value.
|
|
Undefined = -1,
|
|
|
|
/// Requested tradable quote.
|
|
Tradable = 1
|
|
};
|
|
|
|
/// Returns constant from its string representation.
|
|
static Enum deserialize(const char* text);
|
|
|
|
/// Returns string representation of given constant.
|
|
static const char* toString(Enum value);
|
|
};
|
|
|
|
typedef RequestedQuoteTypes::Enum RequestedQuoteType;
|
|
|
|
/// Request For Quote (tag 35-MsgType=R) single entry.
|
|
class
|
|
ONIXS_CME_MDP3_API
|
|
RequestForQuote
|
|
{
|
|
public:
|
|
/// Initializes instance from given FIX message group entry.
|
|
explicit RequestForQuote(
|
|
const GroupInstance& entry)
|
|
: entry_(entry)
|
|
{
|
|
}
|
|
|
|
/// Start of event processing time (UTC) with nanoseconds precision.
|
|
/// @note Required field
|
|
Timestamp transactTime() const
|
|
{
|
|
return entry_.message().getTimestamp(
|
|
Tags::TransactTime, SinceEpochUnits::Nanoseconds);
|
|
}
|
|
|
|
/// Market data events present in the FIX message
|
|
/// which is the data source for given object.
|
|
EventIndicator eventIndicator() const
|
|
{
|
|
return EventIndicator(entry_.message());
|
|
}
|
|
|
|
/// Exchange ID of Quote Request event.
|
|
/// @note Optional field.
|
|
bool quoteReqId(QuoteReqId& id) const
|
|
{
|
|
return entry_.message().get(Tags::QuoteReqID).toStringRef(id);
|
|
}
|
|
|
|
/// Requested symbol or instrument name.
|
|
/// @note Required field.
|
|
StringRef symbol() const
|
|
{
|
|
return entry_.getStringRef(Tags::Symbol);
|
|
}
|
|
|
|
/// Unique security ID of requested symbol.
|
|
/// @note Required field.
|
|
SecurityId securityId() const
|
|
{
|
|
return entry_.getInt32(Tags::SecurityID);
|
|
}
|
|
|
|
/// The type of the requested quote.
|
|
/// @note Required field.
|
|
RequestedQuoteType quoteType() const
|
|
{
|
|
return getIntEnumFieldValue<RequestedQuoteTypes>(
|
|
entry_, Tags::QuoteType);
|
|
}
|
|
|
|
/// The order quantity of the requested quote.
|
|
/// @note Optional field.
|
|
bool orderQty(SignedQuantity& qty) const
|
|
{
|
|
return entry_.get(Tags::OrderQty).toNumber(qty);
|
|
}
|
|
|
|
/// The side of the requested quote.
|
|
/// @note Optional field.
|
|
RequestedSide side() const
|
|
{
|
|
return getIntEnumFieldValue<RequestedSides>(
|
|
entry_, Tags::Side);
|
|
}
|
|
|
|
/// Returns group entry (FIX fields) of underlying message.
|
|
/// Group entry contains all the data related with given request for quote.
|
|
const GroupInstance& entry() const
|
|
{
|
|
return entry_;
|
|
}
|
|
|
|
/// Returns string representation of an object.
|
|
std::string toString() const
|
|
{
|
|
std::string str;
|
|
|
|
toString(str);
|
|
|
|
return str;
|
|
}
|
|
|
|
/// Appends string representation of an object.
|
|
void toString(std::string&) const;
|
|
|
|
private:
|
|
RequestForQuote(const RequestForQuote&);
|
|
RequestForQuote& operator=(const RequestForQuote&);
|
|
|
|
const GroupInstance entry_;
|
|
};
|
|
|
|
/// Request For Quote listener.
|
|
class
|
|
ONIXS_CME_MDP3_API
|
|
RequestForQuoteListener
|
|
{
|
|
public:
|
|
/// Is called for each requested symbol
|
|
/// when a Request For Quote (35=R) FIX message is received.
|
|
virtual
|
|
void
|
|
onRequestForQuote(
|
|
const RequestForQuote& request,
|
|
const ChannelId& channelId) = 0;
|
|
|
|
protected:
|
|
virtual ~RequestForQuoteListener();
|
|
};
|
|
}
|
|
}
|
|
}
|