66 lines
2.2 KiB
C++
66 lines
2.2 KiB
C++
#include "ExecutionReport.h"
|
|
#include "lib/api/services/OrderService.pb.h"
|
|
#include "lib/domain_model/Security.h"
|
|
#include "lib/orderman/orderman_utils/orderman_common.h"
|
|
#include "lib/utils/overloaded.h"
|
|
|
|
#include <sstream>
|
|
#include <variant>
|
|
|
|
namespace bts::orderman {
|
|
|
|
using bts::api::Side_Name;
|
|
using bts::api::Venue_Name;
|
|
using bts::api::orderman::ExecType_Name;
|
|
using bts::api::orderman::NativeOrderStatus_Name;
|
|
using bts::api::orderman::NativeOrderType_Name;
|
|
using bts::api::orderman::TimeInForce_Name;
|
|
using std::ostringstream;
|
|
using std::string;
|
|
using std::uint32_t;
|
|
|
|
void ExecutionReport::get_ts(
|
|
ExchangeTimeStampStr *ts_str, ExchangeTimeStamp64 *ts_64) const {
|
|
std::visit(
|
|
overloaded{
|
|
[ts_str, ts_64](ExchangeTimeStampStr const &str) {
|
|
ts_64->value() = 0;
|
|
*ts_str = str;
|
|
},
|
|
[ts_str, ts_64](ExchangeTimeStamp64 ts) {
|
|
*ts_64 = ts;
|
|
memset(ts_str->value().data(), 0, ts_str->value().size());
|
|
}},
|
|
transact_time);
|
|
}
|
|
|
|
uint32_t ExecutionReport::security_id() const {
|
|
return security == nullptr ? security->id() : 0;
|
|
}
|
|
|
|
const string &ExecutionReport::security_name() const {
|
|
return bts::securities::descriptor(security);
|
|
}
|
|
|
|
string ExecutionReport::to_string() const {
|
|
ostringstream rv;
|
|
rv << "account_name: " << to_trim_strn(account_name)
|
|
<< " operator_id: " << to_trim_strn(operator_id)
|
|
<< " order_key: " << order_key.value() << " msg_seq_num: " << msg_seq_num
|
|
<< " security: " << (security == nullptr ? 0 : security->id())
|
|
<< " leg_security: " << (leg_security == nullptr ? 0 : leg_security->id())
|
|
<< " side: " << Side_Name(side)
|
|
<< " time_in_force: " << TimeInForce_Name(time_in_force)
|
|
<< " order_type: " << NativeOrderType_Name(order_type)
|
|
<< " exec_type: " << ExecType_Name(exec_type)
|
|
<< " order_status: " << NativeOrderStatus_Name(order_status)
|
|
<< " price: " << price.value() << " quantity: " << quantity
|
|
<< " filled_quantity: " << filled_quantity
|
|
<< " avg_price: " << avg_price.value() << " last_shares: " << last_shares
|
|
<< " last_price: " << last_price.value() << " msg: " << msg
|
|
<< " exchange: " << Venue_Name(exchange);
|
|
return rv.str();
|
|
}
|
|
|
|
} // namespace bts::orderman
|