Instead of domain::TradeRecord constructor. The domain types should have minimal dependency on protos.
60 lines
1.8 KiB
C++
60 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "FutureSecurity.h"
|
|
#include "OptionSecurity.h"
|
|
#include "SpreadSecurity.h"
|
|
#include "lib/api/domain/SecurityType.pb.h"
|
|
#include "lib/api/domain/Venue.pb.h"
|
|
#include "lib/domain/BookSide.h"
|
|
#include "lib/domain_model/Security.pb.h"
|
|
|
|
#include <fmt/format.h>
|
|
|
|
namespace bts::co2 {
|
|
class TradeMessage;
|
|
}
|
|
|
|
namespace bts::md {
|
|
class IntPrice;
|
|
class PriceSize;
|
|
} // namespace bts::md
|
|
|
|
namespace bts::domain {
|
|
|
|
class TradeRecord;
|
|
|
|
class DomainSecurityUtils {
|
|
public:
|
|
static api::domain::Venue convert(bts::api::Venue venue);
|
|
static bts::api::Venue convert(api::domain::Venue venue);
|
|
static bts::api::domain::SecurityType convert(
|
|
bts::api::SecurityType sec_type);
|
|
static bts::domain::FutureSecurity convert(
|
|
const bts::api::FutureContract &fut);
|
|
static bts::domain::OptionSecurity convert(
|
|
const bts::api::OptionContract &opt);
|
|
static bts::domain::SpreadSecurity convert(
|
|
const bts::api::SpreadContract &spr);
|
|
static bts::api::SecurityType get_type(const bts::api::Security &s);
|
|
static std::string get_exchange_id(const bts::api::Security &s);
|
|
static bool get_security_desc(
|
|
const bts::api::Security &security, std::string &desc);
|
|
|
|
static Price convert(md::IntPrice iprice);
|
|
static BookLevel convert(md::PriceSize ps);
|
|
static void convert(md::PriceSize ps, BookLevel &res);
|
|
static void convert(
|
|
const BookSide &book_side, md::PriceSize *res, std::size_t res_size);
|
|
static void convert(
|
|
const BookLevel *book_side,
|
|
std::size_t size,
|
|
md::PriceSize *res,
|
|
std::size_t res_size);
|
|
static void convert(
|
|
const md::PriceSize *book_side, std::size_t len, BookSide &res);
|
|
|
|
static void convert(const co2::TradeMessage &tm, TradeRecord &tr);
|
|
};
|
|
|
|
} // namespace bts::domain
|