refactor: Move AggressorSide proto to lib_domain
Get rid of non-proto AggressorSide enum while we're at it (consolidate to 1 type)
This commit is contained in:
1 parent
ec9fabb26e
commit
5ecef5f34d
24 files changed
+139
-91
No files matched your search
@@ -33,6 +33,7 @@
|
||||
<Compile Include="$(API)/fable/timestamp.fable.fs" />
|
||||
<Compile Include="$(API)/fable/apicore.fable.fs" />
|
||||
<Compile Include="$(API)/fable/apioptions.fable.fs" />
|
||||
<Compile Include="$(API)/fable/aggressor_side.fable.fs" />
|
||||
<Compile Include="$(API)/fable/Security.fable.fs" />
|
||||
<Compile Include="$(API)/fable/SparkProtos.fable.fs" />
|
||||
<Compile Include="$(API)/fable/HelloService.fable.fs" />
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace ex_sim {
|
||||
GCC_DIAG_OFF("-Wdeprecated")
|
||||
GCC_DIAG_OFF("-Wignored-qualifiers")
|
||||
|
||||
#define AGGRESSOR_SIDE(x) bts::domain::protobufs::AGGRESSOR_SIDE_##x
|
||||
|
||||
api::Side convert(const FIX::Side &side) {
|
||||
switch (side) {
|
||||
case FIX::Side_BUY:
|
||||
@@ -539,9 +541,9 @@ void ExchangeSimApplication::update_md(std::string const &sec_desc) {
|
||||
md::PriceSize_from_double<ex_sim::precision>(
|
||||
t.price.value() * price_factor, t.quantity.value()),
|
||||
datetime::ll_now(),
|
||||
t.bid_aggressor ? co2::AGGRESSOR_SIDE_BUY
|
||||
: (t.ask_aggressor ? co2::AGGRESSOR_SIDE_SELL
|
||||
: co2::AGGRESSOR_SIDE_NONE));
|
||||
t.bid_aggressor ? AGGRESSOR_SIDE(BUY)
|
||||
: (t.ask_aggressor ? AGGRESSOR_SIDE(SELL)
|
||||
: AGGRESSOR_SIDE(NONE)));
|
||||
}
|
||||
|
||||
// publish mbo
|
||||
|
||||
@@ -9,10 +9,12 @@ namespace auxiliary {
|
||||
using namespace bts::co2;
|
||||
using namespace bts::api::md::auxiliary;
|
||||
|
||||
#define AGGRESSOR_SIDE(x) bts::domain::protobufs::AGGRESSOR_SIDE_##x
|
||||
|
||||
ChannelVolume::ChannelVolume(SecurityChannel *channel) : _channel(channel) {}
|
||||
|
||||
const VolumeAtPriceLevel &
|
||||
ChannelVolume::add_trade(const TradeMessage &m, int &record_id) {
|
||||
const VolumeAtPriceLevel &ChannelVolume::add_trade(
|
||||
const TradeMessage &m, int &record_id) {
|
||||
auto price_map_it = _sec_map.find(m.key());
|
||||
if (price_map_it == _sec_map.end()) {
|
||||
_sec_map[m.key()] = std::unordered_map<uint64_t, VolumeAtPriceLevel>();
|
||||
@@ -31,12 +33,13 @@ ChannelVolume::add_trade(const TradeMessage &m, int &record_id) {
|
||||
}
|
||||
VolumeAtPriceLevel &vol = price_it->second;
|
||||
vol.set_volume(vol.volume() + m.size());
|
||||
if (m.aggressor_side() == AggressorSide::AGGRESSOR_SIDE_BUY)
|
||||
if (m.aggressor_side() == AGGRESSOR_SIDE(BUY)) {
|
||||
vol.set_buy_volume(vol.buy_volume() + m.size());
|
||||
else if (m.aggressor_side() == AggressorSide::AGGRESSOR_SIDE_SELL)
|
||||
} else if (m.aggressor_side() == AGGRESSOR_SIDE(SELL)) {
|
||||
vol.set_sell_volume(vol.sell_volume() + m.size());
|
||||
else if (m.aggressor_side() == AggressorSide::AGGRESSOR_SIDE_NONE)
|
||||
} else if (m.aggressor_side() == AGGRESSOR_SIDE(NONE)) {
|
||||
vol.set_passive_volume(vol.passive_volume() + m.size());
|
||||
}
|
||||
return vol;
|
||||
}
|
||||
|
||||
@@ -52,4 +55,4 @@ bool ChannelVolume::match_update(const SecurityChannel &channel) {
|
||||
|
||||
} // namespace auxiliary
|
||||
} // namespace md
|
||||
} // namespace bts
|
||||
} // namespace bts
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "PyMarketDataSubscription.h"
|
||||
#include "domain/aggressor_side.h"
|
||||
#include "domain/future_security.h"
|
||||
#include "domain/protobufs/aggressor_side.pb.h"
|
||||
#include "domain/protobufs/call_put.pb.h"
|
||||
#include "domain/protobufs/venue.h"
|
||||
#include "domain/security.h"
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
namespace bts::md {
|
||||
|
||||
#define AGGRESSOR_SIDE(x) bts::domain::protobufs::AGGRESSOR_SIDE_##x
|
||||
|
||||
using bts::api::md::PyMarketDataProviderConfig;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::md::py_interop::PyBook;
|
||||
@@ -208,8 +210,8 @@ struct PyMarketDataSubscription::PImpl : private py_interop::MdSink {
|
||||
dest.time_stamp = core::TimeStamp::from_nanos(source.timestamp());
|
||||
dest.agg_side = source.aggressor_side().starts_with('B') ||
|
||||
source.aggressor_side().starts_with('b')
|
||||
? domain::AggressorSide::Buy
|
||||
: domain::AggressorSide::Sell;
|
||||
? AGGRESSOR_SIDE(BUY)
|
||||
: AGGRESSOR_SIDE(SELL);
|
||||
dest.trade_price = domain::Price::from_double(source.price());
|
||||
*dest.trade_quantity = source.quantity();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CCApiTradeRecord.h"
|
||||
#include "domain/aggressor_side.h"
|
||||
#include "domain/price.h"
|
||||
#include "domain/protobufs/aggressor_side.pb.h"
|
||||
#include "domain/quantity.h"
|
||||
#include "domain/trade_record.h"
|
||||
#include "spark/io/JsonDumper.h"
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
namespace bts::md {
|
||||
|
||||
#define AGGRESSOR_SIDE(x) bts::domain::protobufs::AGGRESSOR_SIDE_##x
|
||||
|
||||
using bts::domain::TradeRecord;
|
||||
using bts::io::JsonDumper;
|
||||
using bts::io::JsonReader;
|
||||
@@ -34,8 +36,7 @@ void CCApiTradeRecord::to_trade_record(TradeRecord &value) const {
|
||||
value.trade_quantity.value() =
|
||||
static_cast<QuantityValue>(std::max(last_size * 1000, 1.0));
|
||||
|
||||
value.agg_side = is_buyer_maker ? domain::AggressorSide::Buy
|
||||
: domain::AggressorSide::Sell;
|
||||
value.agg_side = is_buyer_maker ? AGGRESSOR_SIDE(BUY) : AGGRESSOR_SIDE(SELL);
|
||||
}
|
||||
|
||||
bool CCApiTradeRecord::parse(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "DeribitTradeAdaptor.h"
|
||||
#include "domain/aggressor_side.h"
|
||||
#include "domain/protobufs/aggressor_side.pb.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "domain/trade_record.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
@@ -11,8 +11,9 @@
|
||||
|
||||
namespace bts::md::deribit {
|
||||
|
||||
#define AGGRESSOR_SIDE(x) bts::domain::protobufs::AGGRESSOR_SIDE_##x
|
||||
|
||||
using bts::core::TimeStamp;
|
||||
using bts::domain::AggressorSide;
|
||||
using bts::domain::SecurityID;
|
||||
using bts::domain::TradeRecord;
|
||||
using nlohmann::json;
|
||||
@@ -68,7 +69,7 @@ void DeribitTradeAdaptor::on_trades(const vector<json> &trades) {
|
||||
std::string direction;
|
||||
get_value(*trade_it, "direction", direction);
|
||||
bts_trade.agg_side =
|
||||
direction == "buy" ? AggressorSide::Buy : AggressorSide::Sell;
|
||||
direction == "buy" ? AGGRESSOR_SIDE(BUY) : AGGRESSOR_SIDE(SELL);
|
||||
}
|
||||
} catch (...) {
|
||||
LOG(md, Error, "Failed to parse DeribitTradeUpdate. json:\n{}",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "domain/aggressor_side.h"
|
||||
#include "domain/protobufs/aggressor_side.pb.h"
|
||||
#include "domain/side.h"
|
||||
#include "spark/core/EnumMacros.h"
|
||||
#include "spark/core/FMT_IMPL.h"
|
||||
@@ -31,7 +31,7 @@ class OkxSide {
|
||||
std::string name_j() const;
|
||||
|
||||
constexpr domain::Side to_domain_side() const;
|
||||
constexpr domain::AggressorSide to_domain_agg_side() const;
|
||||
constexpr domain::protobufs::AggressorSide to_domain_agg_side() const;
|
||||
};
|
||||
|
||||
ENUM_OUTPUT_OPS(OkxSide)
|
||||
@@ -59,14 +59,14 @@ constexpr domain::Side OkxSide::to_domain_side() const {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr domain::AggressorSide OkxSide::to_domain_agg_side() const {
|
||||
constexpr domain::protobufs::AggressorSide OkxSide::to_domain_agg_side() const {
|
||||
switch (value) {
|
||||
case BUY:
|
||||
return domain::AggressorSide::Buy;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_BUY;
|
||||
case SELL:
|
||||
return domain::AggressorSide::Sell;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_SELL;
|
||||
default:
|
||||
return domain::AggressorSide::None;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,18 +138,18 @@ TradingStatus convert_trading_status(
|
||||
return TradingStatus::TRADINGSTATUS_UNKNOWN;
|
||||
}
|
||||
|
||||
bts::co2::AggressorSide convert_trade_side(
|
||||
domain::protobufs::AggressorSide convert_trade_side(
|
||||
const emumba::market_data::trade_record &tr) {
|
||||
switch (tr.agg_side) {
|
||||
case emumba::market_data::aggressor_side::buy:
|
||||
return co2::AggressorSide::AGGRESSOR_SIDE_BUY;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_BUY;
|
||||
case emumba::market_data::aggressor_side::sell:
|
||||
return co2::AggressorSide::AGGRESSOR_SIDE_SELL;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_SELL;
|
||||
case emumba::market_data::aggressor_side::none:
|
||||
return co2::AggressorSide::AGGRESSOR_SIDE_NONE;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_NONE;
|
||||
}
|
||||
bts_assert(false);
|
||||
return co2::AggressorSide::AGGRESSOR_SIDE_NONE;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_NONE;
|
||||
}
|
||||
|
||||
bts::api::PutOrCall convert_call_put(emumba::market_data::option_type cp) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ICEListener.h"
|
||||
#include "domain/protobufs/aggressor_side.pb.h"
|
||||
#include "spark/config/protos/market_data.pb.h"
|
||||
#include "spark/md/protos/co2.pb.h"
|
||||
#include "spark/utils/datetime.h"
|
||||
@@ -272,15 +273,16 @@ void ICEListener::onOrderBookUpdated(
|
||||
|
||||
//
|
||||
// Trades
|
||||
AggressorSide map_aggressor(onixs_ice::AggressorSide::Enum agside) {
|
||||
domain::protobufs::AggressorSide map_aggressor(
|
||||
onixs_ice::AggressorSide::Enum agside) {
|
||||
switch (agside) {
|
||||
default:
|
||||
case onixs_ice::AggressorSide::NoAggressor:
|
||||
return AGGRESSOR_SIDE_NONE;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_NONE;
|
||||
case onixs_ice::AggressorSide::Buy:
|
||||
return AGGRESSOR_SIDE_BUY;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_BUY;
|
||||
case onixs_ice::AggressorSide::Sell:
|
||||
return AGGRESSOR_SIDE_SELL;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_SELL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,15 +19,16 @@
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
inline co2::AggressorSide map_aggressor(onixs::AggressorSide::Enum agside) {
|
||||
inline domain::protobufs::AggressorSide map_aggressor(
|
||||
onixs::AggressorSide::Enum agside) {
|
||||
switch (agside) {
|
||||
default:
|
||||
case onixs::AggressorSide::NoAggressor:
|
||||
return co2::AGGRESSOR_SIDE_NONE;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_NONE;
|
||||
case onixs::AggressorSide::Buy:
|
||||
return co2::AGGRESSOR_SIDE_BUY;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_BUY;
|
||||
case onixs::AggressorSide::Sell:
|
||||
return co2::AGGRESSOR_SIDE_SELL;
|
||||
return domain::protobufs::AGGRESSOR_SIDE_SELL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include "domain/protobufs/venue.pb.h"
|
||||
#include "domain/security.h"
|
||||
#include "domain/security_id.h"
|
||||
#include "domain/trade_record.h"
|
||||
#include "spark/api/md/TaifexMarketDataConfig.pb.h"
|
||||
#include "spark/config/config.h"
|
||||
#include "spark/config/protos/system_config.pb.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain/Price.h"
|
||||
#include "spark/domain/TradeRecord.h"
|
||||
#include "spark/logging/logging.h"
|
||||
#include "spark/md/IMarketDataListener.h"
|
||||
#include "spark/persistence/IDGenerator.h"
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "system/FMT_IMPL.h"
|
||||
#include "system/enum_macros.h"
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace bts::domain {
|
||||
|
||||
// clang-format off
|
||||
#define FOR_ALL_VALUES(per_value) \
|
||||
per_value(AggressorSide, None) \
|
||||
per_value(AggressorSide, Buy) \
|
||||
per_value(AggressorSide, Sell)
|
||||
// clang-format on
|
||||
|
||||
ENUM_CLASS_DEF(AggressorSide, FOR_ALL_VALUES)
|
||||
|
||||
#undef FOR_ALL_VALUES
|
||||
} // namespace bts::domain
|
||||
|
||||
FMT_IMPL(bts::domain::AggressorSide, a, "{}", a.name());
|
||||
#include "domain/protobufs/aggressor_side.h"
|
||||
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include "domain/protobufs/aggressor_side.pb.h"
|
||||
#include "system/FMT_IMPL.h"
|
||||
#include "system/enum_macros.h"
|
||||
#include "system/json/json_reader.h"
|
||||
#include "system/string_utils.h"
|
||||
|
||||
#include <cctype>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace bts::domain::protobufs {
|
||||
|
||||
/**
|
||||
* Parses AggressorSide from a string. Unlike `bts::domain::AggressorSide_Parse`, this
|
||||
* implementation is case insensitive, and makes the 'AGGRESSOR_SIDE_' prefix optional.
|
||||
*/
|
||||
bool aggressor_side_parse_smart(const std::string &str, AggressorSide *result);
|
||||
|
||||
std::ostream &operator<<(
|
||||
std::ostream &out, const AggressorSide &agg_side) noexcept;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Definition
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
inline bool aggressor_side_parse_smart(
|
||||
const std::string &str, AggressorSide *result) {
|
||||
if (AggressorSide_Parse(str, result)) {
|
||||
return true;
|
||||
}
|
||||
std::string s = system::string_utils::copy_to_upper(str);
|
||||
if (AggressorSide_Parse(s, result)) {
|
||||
return true;
|
||||
}
|
||||
const char *prefix = "AGGRESSOR_SIDE_";
|
||||
if (!s.starts_with(prefix)) {
|
||||
s.insert(0, prefix);
|
||||
}
|
||||
return AggressorSide_Parse(s, result);
|
||||
}
|
||||
|
||||
PB_ENUM_FROM_JSON(AggressorSide)
|
||||
PB_ENUM_TO_JSON(AggressorSide)
|
||||
|
||||
inline std::ostream &operator<<(
|
||||
std::ostream &out, const AggressorSide &agg_side) noexcept {
|
||||
out << AggressorSide_Name(agg_side);
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace bts::domain::protobufs
|
||||
|
||||
FMT_IMPL(
|
||||
bts::domain::protobufs::AggressorSide,
|
||||
a,
|
||||
"{}",
|
||||
bts::domain::protobufs::AggressorSide_Name(a));
|
||||
@@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
package bts.domain.protobufs;
|
||||
|
||||
option csharp_namespace = "bts.domain.protobufs";
|
||||
|
||||
enum AggressorSide {
|
||||
AGGRESSOR_SIDE_NONE = 0;
|
||||
AGGRESSOR_SIDE_BUY = 1;
|
||||
AGGRESSOR_SIDE_SELL = 2;
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class TradeRecord {
|
||||
public:
|
||||
SecurityID sec_id = {};
|
||||
core::TimeStamp time_stamp = {};
|
||||
AggressorSide agg_side = {};
|
||||
protobufs::AggressorSide agg_side = {};
|
||||
Quantity trade_quantity;
|
||||
Price trade_price;
|
||||
TradeRecord() {}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
syntax="proto3";
|
||||
package bts.api;
|
||||
option csharp_namespace="bts.api";
|
||||
import "domain/protobufs/aggressor_side.proto";
|
||||
import "spark/api/apioptions.proto";
|
||||
import "spark/api/apicore.proto";
|
||||
import "spark/domain_model/Security.proto";
|
||||
import "spark/md/protos/co2.proto";
|
||||
|
||||
message ProductList {
|
||||
repeated bts.api.Product products = 1;
|
||||
@@ -29,7 +29,7 @@ message TickerEntry {
|
||||
double price = 3;
|
||||
uint32 size = 4;
|
||||
uint32 total_volume = 5;
|
||||
bts.co2.AggressorSide aggressor_side = 6;
|
||||
bts.domain.protobufs.AggressorSide aggressor_side = 6;
|
||||
bool from_spread = 7;
|
||||
bool gap = 10;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,7 @@ domain::TradeRecord DomainSecurityUtils::convert(
|
||||
domain::TradeRecord rv;
|
||||
*rv.sec_id = trade.key();
|
||||
rv.time_stamp = core::TimeStamp::from_int64(trade.time());
|
||||
rv.agg_side =
|
||||
trade.aggressor_side() == co2::AggressorSide::AGGRESSOR_SIDE_BUY
|
||||
? AggressorSide::Buy
|
||||
: AggressorSide::Sell;
|
||||
rv.agg_side = trade.aggressor_side();
|
||||
*rv.trade_quantity = trade.size();
|
||||
rv.trade_price = bts::domain::Price::from_double(
|
||||
bts::md::IntPrice(trade.mantissa(), trade.exponent()).price());
|
||||
|
||||
@@ -216,17 +216,6 @@ bts::md::IntPrice convert_price(bts::domain::Price p) {
|
||||
return bts::md::IntPrice(p.mantissa(), p.exponent());
|
||||
}
|
||||
|
||||
co2::AggressorSide convert_agg_side(bts::domain::AggressorSide side) {
|
||||
switch (side.value) {
|
||||
case bts::domain::AggressorSide::Value::Buy:
|
||||
return co2::AGGRESSOR_SIDE_BUY;
|
||||
case bts::domain::AggressorSide::Value::Sell:
|
||||
return co2::AGGRESSOR_SIDE_SELL;
|
||||
default:
|
||||
return co2::AGGRESSOR_SIDE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void clear_books(MDArray &md_side) {
|
||||
for (PriceSize &psz : md_side) {
|
||||
psz = PriceSize{};
|
||||
@@ -374,7 +363,7 @@ void GeneralMarketDataListener::on_trades(
|
||||
utils::TimeStamp::now(),
|
||||
PriceSize(
|
||||
convert_price(tp->trade_price), tp->trade_quantity.value()),
|
||||
trade_ts, convert_agg_side(tp->agg_side), 0, false);
|
||||
trade_ts, tp->agg_side, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ using namespace co2;
|
||||
|
||||
#define TRADING_STATUS(x) bts::domain::protobufs::TRADINGSTATUS_##x
|
||||
|
||||
using bts::domain::protobufs::AggressorSide;
|
||||
|
||||
MDProducerHandle::MDProducerHandle(
|
||||
ColdHeader &cheader,
|
||||
HotHeader &hheader,
|
||||
@@ -108,7 +110,7 @@ void MDProducerHandle::add_trade(
|
||||
TimeStamp time,
|
||||
const PriceSize price,
|
||||
LLDateTime tradetime,
|
||||
co2::AggressorSide agside,
|
||||
AggressorSide agside,
|
||||
uint32_t volume,
|
||||
bool from_spread) {
|
||||
// Add this trade to the last trade if price/side match
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "MDProducerChannel.h"
|
||||
#include "Shm/MDStructure.h"
|
||||
#include "domain/protobufs/aggressor_side.pb.h"
|
||||
#include "spark/utils/bts_export.h"
|
||||
#include "spark/utils/bts_no_copy.h"
|
||||
#include "spark/utils/datetime.h"
|
||||
@@ -117,7 +118,7 @@ class BTS_EXPORT MDProducerHandle {
|
||||
TimeStamp time,
|
||||
const PriceSize pricesize,
|
||||
datetime::LLDateTime date,
|
||||
co2::AggressorSide agside,
|
||||
domain::protobufs::AggressorSide agside,
|
||||
uint32_t total_volume = 0,
|
||||
bool from_spread = false); // cold
|
||||
// Update last_trade without updating trade log
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
syntax='proto3';
|
||||
package bts.co2;
|
||||
option csharp_namespace="bts.co2";
|
||||
import "domain/protobufs/aggressor_side.proto";
|
||||
import "spark/domain_model/Security.proto";
|
||||
|
||||
enum CoconutSecurityStatus {
|
||||
@@ -103,12 +104,6 @@ message MiscMessage {
|
||||
double session_low_offer = 12;
|
||||
double fixing_price = 13;
|
||||
}
|
||||
|
||||
enum AggressorSide {
|
||||
AGGRESSOR_SIDE_NONE = 0;
|
||||
AGGRESSOR_SIDE_BUY = 1;
|
||||
AGGRESSOR_SIDE_SELL = 2;
|
||||
}
|
||||
|
||||
message TradeMessage {
|
||||
uint32 key = 1;
|
||||
@@ -120,7 +115,7 @@ message TradeMessage {
|
||||
uint32 size = 6;
|
||||
uint32 total_volume = 7;
|
||||
bool gap = 8;
|
||||
AggressorSide aggressor_side = 9;
|
||||
bts.domain.protobufs.AggressorSide aggressor_side = 9;
|
||||
bool from_spread = 10;
|
||||
}
|
||||
message QuoteRequestMessage {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "domain/protobufs/aggressor_side.pb.h"
|
||||
#include "spark/domain_model/common.h"
|
||||
#include "spark/md/protos/co2.pb.h"
|
||||
#include "spark/utils/bts_chrono.h"
|
||||
|
||||
namespace bts::orderman {
|
||||
@@ -11,7 +11,7 @@ struct Trade {
|
||||
Price price;
|
||||
Quantity quantity;
|
||||
Quantity total_volume;
|
||||
co2::AggressorSide aggressor_side;
|
||||
domain::protobufs::AggressorSide aggressor_side;
|
||||
};
|
||||
|
||||
} // namespace bts::orderman
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "SimExecutionGateway.h"
|
||||
#include "domain/protobufs/aggressor_side.pb.h"
|
||||
#include "spark/api/services/OrderService.pb.h"
|
||||
#include "spark/core/TimeStamp.h"
|
||||
#include "spark/domain_model/Security.h"
|
||||
@@ -39,6 +40,8 @@
|
||||
|
||||
namespace bts::orderman {
|
||||
|
||||
using bts::domain::protobufs::AggressorSide;
|
||||
|
||||
// book conversions ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -678,7 +681,7 @@ void SimExecutionGateway::_write_trade(
|
||||
idx_data->handle.add_trade(
|
||||
now, md::PriceSize(convert_price(price), qty.value()), trade_ts,
|
||||
// TODO
|
||||
co2::AggressorSide::AGGRESSOR_SIDE_BUY, 0, false);
|
||||
AggressorSide::AGGRESSOR_SIDE_BUY, 0, false);
|
||||
} else {
|
||||
LOG(OrderMan, Error,
|
||||
"SimExecutionGateway::_write_trade could not find handle for key: {}",
|
||||
|
||||
@@ -511,7 +511,7 @@ TEST_CASE("Dorman profit-orders", "[algo][dorman]") {
|
||||
Trade mkTrade(Price p, Quantity q) {
|
||||
return {
|
||||
Timer::now(), p, q, Quantity{q.value() + 9999},
|
||||
co2::AGGRESSOR_SIDE_NONE};
|
||||
domain::protobufs::AGGRESSOR_SIDE_NONE};
|
||||
}
|
||||
|
||||
TradeVector mkTrades(Price p, Quantity total) {
|
||||
|
||||
Reference in new issue
Block a user