76 lines
1.9 KiB
C++
76 lines
1.9 KiB
C++
#ifndef INCLUDED_TRNX_ORDER
|
|
#define INCLUDED_TRNX_ORDER
|
|
|
|
#include <bsl_iostream.h>
|
|
#include <bsl_string.h>
|
|
|
|
#include <bael_log.h>
|
|
|
|
namespace BloombergLP {
|
|
namespace trnx {
|
|
|
|
class Order
|
|
{
|
|
public:
|
|
Order()
|
|
{
|
|
BAEL_LOG_SET_CATEGORY("ORDER");
|
|
BAEL_LOG_INFO << "Order::Order()" << BAEL_LOG_END;
|
|
};
|
|
|
|
Order(const bsl::string& symbol, double price, int amount,
|
|
char side)
|
|
: d_symbol(symbol), d_price(price), d_amount(amount),
|
|
d_side(side)
|
|
{
|
|
BAEL_LOG_SET_CATEGORY("ORDER");
|
|
BAEL_LOG_INFO << "Order::Order(string, double, int, char)"
|
|
<< BAEL_LOG_END;
|
|
}
|
|
|
|
Order(const Order& other)
|
|
: d_symbol(other.d_symbol), d_price(other.d_price),
|
|
d_amount(other.d_amount), d_side(other.d_side)
|
|
{
|
|
BAEL_LOG_SET_CATEGORY("ORDER");
|
|
BAEL_LOG_INFO << "Order::Order(const Order&)" << BAEL_LOG_END;
|
|
}
|
|
|
|
~Order()
|
|
{
|
|
BAEL_LOG_SET_CATEGORY("ORDER");
|
|
BAEL_LOG_INFO << "Order::~Order()" << BAEL_LOG_END;
|
|
}
|
|
|
|
bool operator==(const Order& other) const
|
|
{
|
|
return (d_symbol == other.d_symbol &&
|
|
d_price == other.d_price &&
|
|
d_amount == other.d_amount && d_side == other.d_side);
|
|
}
|
|
|
|
const bsl::string& symbol() const { return d_symbol; }
|
|
double price() const { return d_price; }
|
|
int amount() const { return d_amount; }
|
|
char side() const { return d_side; }
|
|
|
|
private:
|
|
bsl::string d_symbol;
|
|
double d_price;
|
|
int d_amount;
|
|
char d_side;
|
|
friend bsl::ostream& operator<<(bsl::ostream& os, const Order& o);
|
|
};
|
|
|
|
inline bsl::ostream& operator<<(bsl::ostream& os, const Order& o)
|
|
{
|
|
os << "[" << o.d_symbol << ',' << o.d_price << ',' << o.d_amount
|
|
<< ',' << o.d_side << "]";
|
|
return os;
|
|
}
|
|
|
|
} // close namespace trnx
|
|
} // close namespace BloombergLP
|
|
|
|
#endif
|