114 lines
3.6 KiB
C++
Executable File
114 lines
3.6 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/ImpliedPriceLevel.h"
|
|
|
|
namespace OnixS
|
|
{
|
|
namespace CME
|
|
{
|
|
namespace MDP3
|
|
{
|
|
/// Encapsulates price level concept.
|
|
class
|
|
ONIXS_CME_MDP3_API
|
|
DirectPriceLevel
|
|
: public ImpliedPriceLevel
|
|
{
|
|
public:
|
|
/// Initializes undefined level.
|
|
DirectPriceLevel()
|
|
: ordersQty_(0)
|
|
{
|
|
}
|
|
|
|
/// Initializes as copy of other level.
|
|
DirectPriceLevel(
|
|
const DirectPriceLevel& other)
|
|
: ImpliedPriceLevel(
|
|
static_cast
|
|
<const ImpliedPriceLevel&>
|
|
(other)),
|
|
ordersQty_(
|
|
other.ordersQty_)
|
|
{
|
|
}
|
|
|
|
/// Initializes defined level
|
|
/// according to specified attributes.
|
|
DirectPriceLevel(
|
|
const Price& price,
|
|
SignedQuantity qty,
|
|
Quantity ordersQty)
|
|
: ImpliedPriceLevel(price, qty),
|
|
ordersQty_(ordersQty)
|
|
{
|
|
}
|
|
|
|
// Actually, does nothing.
|
|
~DirectPriceLevel()
|
|
{
|
|
}
|
|
|
|
/// Updates total number of orders.
|
|
Quantity& numberOfOrders()
|
|
{
|
|
return ordersQty_;
|
|
}
|
|
|
|
/// Total number of orders of given price.
|
|
Quantity numberOfOrders() const
|
|
{
|
|
return ordersQty_;
|
|
}
|
|
|
|
/// Returns string representation of the instance.
|
|
std::string toString() const
|
|
{
|
|
std::string str;
|
|
|
|
toString(str);
|
|
|
|
return str;
|
|
}
|
|
|
|
/// Appends representation of the instance to the string.
|
|
void toString(std::string&) const;
|
|
|
|
// Re-initializes as copy of other instance.
|
|
DirectPriceLevel&
|
|
operator =(
|
|
const DirectPriceLevel& other)
|
|
{
|
|
*static_cast<ImpliedPriceLevel*>(this) =
|
|
static_cast<const ImpliedPriceLevel&>(other);
|
|
|
|
ordersQty_ = other.ordersQty_;
|
|
|
|
return *this;
|
|
}
|
|
|
|
private:
|
|
Quantity ordersQty_;
|
|
};
|
|
}
|
|
}
|
|
}
|