Files
spark/src/lib_python_md/python_md/py_book_level.h
T

43 lines
1.0 KiB
C++

#pragma once
#include <limits>
#include <sstream>
#include <string>
namespace bts::md::py_interop {
class PyBookLevel {
public:
constexpr PyBookLevel() = default;
constexpr double price() const;
void set_price(double value);
constexpr double quantity() const;
void set_quantity(double value);
std::string to_string() const;
private:
double price_{std::numeric_limits<double>::quiet_NaN()};
double quantity_{0};
};
//////////////////////////////////////////////////
// Definition
//////////////////////////////////////////////////
constexpr double PyBookLevel::price() const { return price_; }
inline void PyBookLevel::set_price(double value) { price_ = value; }
constexpr double PyBookLevel::quantity() const { return quantity_; }
inline void PyBookLevel::set_quantity(double value) { quantity_ = value; }
inline std::string PyBookLevel::to_string() const {
std::stringstream str;
str << price_ << " (" << quantity_ << ")";
return str.str();
}
} // namespace bts::md::py_interop