build: Install boost via vcpkg on linux, update ccapi

Old ccapi wasn't compatible with new boost
This commit is contained in:
John Colvin committed 2026-03-20 17:02:44 +00:00
1 parent b061509126
commit bef84d6dc3
38 files changed
+149 -77

No files matched your search

@@ -21,10 +21,11 @@ using bts::domain::SecurityMarketDataStatistics;
using bts::io::JsonReader;
using std::map;
using std::string;
using std::string_view;
using std::vector;
static bool parse(
const map<string, string> &name_values,
const map<string_view, string> &name_values,
vector<BinanceMiniTickerUpdate> &ticker_upds) {
auto it = name_values.find(CCAPI_HTTP_BODY);
if (it == name_values.end()) {
@@ -21,10 +21,11 @@ using bts::domain::SecurityMarketDataStatistics;
using bts::io::JsonReader;
using std::map;
using std::string;
using std::string_view;
using std::vector;
static bool parse(
const map<string, string> &name_values,
const map<string_view, string> &name_values,
vector<BinancePriceStatistics> &result) {
CCApiReader ccapi_reader{&name_values};
nlohmann::json js;
@@ -180,7 +180,7 @@ struct BinanceSecurityRequestor::PImpl {
for (const auto *msg : msgs) {
bts_assert_msgf(
msg->getType() == ccapi::Message::Type::GENERIC_PUBLIC_REQUEST,
"Received msg w/ unexpected type:\n{}", msg->toStringPretty());
"Received msg w/ unexpected type:\n{}", msg->toPrettyString());
parse_secs(*msg, types, added_secs);
}
auto added_sec_descs = get_sec_descs(added_secs);
@@ -214,7 +214,7 @@ struct BinanceSecurityRequestor::PImpl {
_FATAL_MSGF(
"on_exchange_info. {} event was unexpected:\n{}",
ccapi::Event::typeToString(event.getType()),
event.toStringPretty());
event.toPrettyString());
break;
}
return true;
@@ -21,10 +21,11 @@ using std::map;
using std::pair;
using std::size_t;
using std::string;
using std::string_view;
using std::vector;
static bool parse(
const map<string, string> &name_values,
const map<string_view, string> &name_values,
vector<BinanceCoinFuturesPriceStatistics> &result) {
CCApiReader ccapi_reader{&name_values};
nlohmann::json js;
@@ -60,7 +60,7 @@ void BinanceCoinFuturesPriceStatisticsAdaptor::on_messages(
const auto n_total = n_hits + n_misses;
_ERROR(
"on_messages. Parse failed on {}/{} elements:\n{}", n_misses,
n_total, event.toStringPretty());
n_total, event.toPrettyString());
continue;
}
for (const auto &bsr : binance_stats_recs) {
@@ -177,7 +177,7 @@ struct BinanceCoinFuturesSecurityRequestor::PImpl {
for (const auto *msg : msgs) {
bts_assert_msgf(
msg->getType() == ccapi::Message::Type::GENERIC_PUBLIC_REQUEST,
"Received msg w/ unexpected type:\n{}", msg->toStringPretty());
"Received msg w/ unexpected type:\n{}", msg->toPrettyString());
parse_secs(*msg, added_secs);
}
auto added_sec_descs = get_sec_descs(added_secs);
@@ -211,7 +211,7 @@ struct BinanceCoinFuturesSecurityRequestor::PImpl {
_FATAL_MSGF(
"on_exchange_info. {} event was unexpected:\n{}",
ccapi::Event::typeToString(event.getType()),
event.toStringPretty());
event.toPrettyString());
break;
}
return true;
@@ -23,10 +23,11 @@ using std::int64_t;
using std::map;
using std::ostream;
using std::string;
using std::string_view;
using std::vector;
static bool parse(
const map<string, string> &name_values,
const map<string_view, string> &name_values,
vector<BinanceUsPriceStatistics> &result) {
CCApiReader ccapi_reader{&name_values};
nlohmann::json js;
@@ -69,10 +69,10 @@ static vector<string> get_sec_descs(const vector<Security> &sec_ptrs) {
static void validate_response(const ccapi::Event &event, bool is_expected) {
bts_assert_msgf(
event.getType() == ccapi::Event::Type::RESPONSE,
"Received event w/ unexpected type:\n{}", event.toStringPretty());
"Received event w/ unexpected type:\n{}", event.toPrettyString());
bts_assert_msgf(
is_expected, "Received unexpected response from Binance US:\n{}",
event.toStringPretty());
event.toPrettyString());
}
struct BinanceUsSecurityRequestor::PImpl {
@@ -181,7 +181,7 @@ struct BinanceUsSecurityRequestor::PImpl {
for (const auto *msg : msgs) {
bts_assert_msgf(
msg->getType() == ccapi::Message::Type::GENERIC_PUBLIC_REQUEST,
"Received msg w/ unexpected type:\n{}", msg->toStringPretty());
"Received msg w/ unexpected type:\n{}", msg->toPrettyString());
parse_secs<T>(*msg, types, added_secs);
}
auto added_sec_descs = get_sec_descs(added_secs);
@@ -200,7 +200,7 @@ struct BinanceUsSecurityRequestor::PImpl {
const CCApiCorrelationID & /*corr_id*/) {
validate_response(event, exch_info_req_pending);
LOG(md, Diag, "Received Binance US exchange info (spots):\n{}",
event.toStringPretty());
event.toPrettyString());
update_securities<BinanceUsSpot>(msgs, {SEC_TYPE(SPOT)});
exch_info_req_pending = false;
if (external_req_pending && !is_busy()) {
@@ -21,10 +21,11 @@ using std::map;
using std::pair;
using std::size_t;
using std::string;
using std::string_view;
using std::vector;
static bool parse(
const map<string, string> &name_values,
const map<string_view, string> &name_values,
vector<BinanceUsdsFuturesPriceStatistics> &result) {
CCApiReader ccapi_reader{&name_values};
nlohmann::json js;
@@ -60,7 +60,7 @@ void BinanceUsdsFuturesPriceStatisticsAdaptor::on_messages(
const auto n_total = n_hits + n_misses;
_ERROR(
"on_messages. Parse failed on {}/{} elements:\n{}", n_misses,
n_total, event.toStringPretty());
n_total, event.toPrettyString());
continue;
}
for (const auto &bsr : binance_stats_recs) {
@@ -178,7 +178,7 @@ struct BinanceUsdsFuturesSecurityRequestor::PImpl {
for (const auto *msg : msgs) {
bts_assert_msgf(
msg->getType() == ccapi::Message::Type::GENERIC_PUBLIC_REQUEST,
"Received msg w/ unexpected type:\n{}", msg->toStringPretty());
"Received msg w/ unexpected type:\n{}", msg->toPrettyString());
parse_secs(*msg, added_secs);
}
auto added_sec_descs = get_sec_descs(added_secs);
@@ -212,7 +212,7 @@ struct BinanceUsdsFuturesSecurityRequestor::PImpl {
_FATAL_MSGF(
"on_exchange_info. {} event was unexpected:\n{}",
ccapi::Event::typeToString(event.getType()),
event.toStringPretty());
event.toPrettyString());
break;
}
return true;
@@ -8,7 +8,7 @@ namespace bts::md {
using bts::domain::Quantity;
bool CCApiDepthWalker::parse_field(
const std::string &name, const std::string &value) {
const std::string_view &name, const std::string &value) {
bts_assert(depth_ptr);
auto &depth = *depth_ptr;
if (name == price_key) {
@@ -15,7 +15,7 @@ class CCApiDepthWalker {
std::size_t price_idx = 0;
std::size_t qty_idx = 0;
bool parse_field(const std::string &name, const std::string &value);
bool parse_field(const std::string_view &name, const std::string &value);
};
} // namespace bts::md
@@ -57,7 +57,7 @@ CCApiEventDemuxer::CCApiEventDemuxer(std::size_t corr_id_len)
CCApiEventDemuxer::~CCApiEventDemuxer() = default;
bool CCApiEventDemuxer::processEvent(
void CCApiEventDemuxer::processEvent(
const ccapi::Event &event, ccapi::Session *session) {
unordered_map<CCApiCorrelationID, vector<const ccapi::Message *>>
demuxed_msgs;
@@ -91,7 +91,6 @@ bool CCApiEventDemuxer::processEvent(
hnd.on_messages(event, session, msgs, hnd_corr_id);
}
}
return true;
}
void CCApiEventDemuxer::on_messages(
@@ -19,7 +19,7 @@ class CCApiEventDemuxer : public ccapi::EventHandler,
explicit CCApiEventDemuxer(std::size_t corr_id_len = 0);
~CCApiEventDemuxer() override;
bool processEvent(
void processEvent(
const ccapi::Event &event, ccapi::Session *session) override;
void on_messages(
@@ -10,7 +10,7 @@ class CCApiRequestor_Handler : public ccapi::EventHandler {
public:
bool processEvent(
const ccapi::Event &event, ccapi::Session * /*session*/) override {
LOG(md, Info, "on ccapi event: {}", event.toStringPretty(2, 2));
LOG(md, Info, "on ccapi event: {}", event.toPrettyString(2, 2));
return true;
}
};
@@ -40,7 +40,7 @@ inline ccapi::Subscription CCApiJsonRpcRequest::rpc_sub(
const io::websocket::JsonRpcRequest &req,
std::string venue_name,
const CCApiCorrelationID &corr_id) {
return {
return ccapi::Subscription{
std::move(venue_name), "", CCAPI_GENERIC_PUBLIC_SUBSCRIPTION,
req.to_string(), corr_id.to_string()};
}
@@ -38,7 +38,7 @@ void CCApiJsonRpcRouter::on_messages(
BTS_FATAL_MSGF(
"Exception occurred handling rpc "
"message.\n***ex***:{}\n***event***:\n{}",
msg, event.toStringPretty());
msg, event.toPrettyString());
});
}
@@ -45,7 +45,7 @@ static bool parse(const ccapi::Message &msg, domain::Book &book) {
ask_walker.parse_field(name, value);
} catch (const std::exception &ex) {
LOG(md, Fatal, "Error parsing depth update: {}\nmsg:\n{}",
std::string{ex.what()}, msg.toStringPretty());
std::string{ex.what()}, msg.toPrettyString());
bts_assert_msg(false, "Fatal error parsing depth update.");
}
}
@@ -22,7 +22,7 @@ void CCApiMessageLogger::on_messages(
const CCApiCorrelationID &corr_id) {
auto msg_strs = msgs | ranges::views::transform([](const ccapi::Message *m) {
return m->toStringPretty();
return m->toPrettyString();
});
auto msgs_str = join(msg_strs.begin(), msg_strs.end(), "\n");
LOG(md, Info, "Received CCApi messages. name: {}; corr_id: {}; msgs:\n{}",
+1 -1
View File
@@ -15,7 +15,7 @@ namespace bts::md {
class CCApiReader {
public:
using NameValues = std::map<std::string, std::string>;
using NameValues = std::map<std::string_view, std::string>;
explicit CCApiReader(const NameValues *name_values);
@@ -39,7 +39,7 @@ void CCApiTradeAdaptor::on_messages(
ccapi::Message::typeToString(msg->getType()));
return;
}
LOG(md, Diag, "Received CCApi trade msg:\n{}", msg->toStringPretty());
LOG(md, Diag, "Received CCApi trade msg:\n{}", msg->toPrettyString());
auto ts = TimeStamp::from_int64(
msg->getTimeReceived().time_since_epoch().count());
auto sec_desc = corr_id.peek_string();
@@ -54,7 +54,7 @@ void CCApiTradeAdaptor::on_messages(
}
if (trades.empty()) {
LOG(md, Warn, "Received ccapi trade msg with no trades:\n{}",
event.toStringPretty());
event.toPrettyString());
return;
}
std::vector<const domain::TradeRecord *> trade_ptrs;
@@ -21,10 +21,11 @@ using std::int64_t;
using std::map;
using std::ostream;
using std::string;
using std::string_view;
using std::vector;
static bool parse(
const map<string, string> &name_values,
const map<string_view, string> &name_values,
vector<CoinbasePriceStatistics> &result) {
auto it = name_values.find(CCAPI_HTTP_BODY);
const auto &body = it->second;
@@ -62,10 +62,10 @@ static vector<string> get_sec_descs(const vector<Security> &sec_ptrs) {
static void validate_response(const ccapi::Event &event, bool is_expected) {
bts_assert_msgf(
event.getType() == ccapi::Event::Type::RESPONSE,
"Received event w/ unexpected type:\n{}", event.toStringPretty());
"Received event w/ unexpected type:\n{}", event.toPrettyString());
bts_assert_msgf(
is_expected, "Received unexpected response from Coinbase:\n{}",
event.toStringPretty());
event.toPrettyString());
}
struct CoinbaseSecurityRequestor::PImpl {
@@ -172,7 +172,7 @@ struct CoinbaseSecurityRequestor::PImpl {
for (const auto *msg : msgs) {
bts_assert_msgf(
msg->getType() == ccapi::Message::Type::GET_INSTRUMENTS,
"Received msg w/ unexpected type:\n{}", msg->toStringPretty());
"Received msg w/ unexpected type:\n{}", msg->toPrettyString());
parse_secs<T>(*msg, types, added_secs);
}
auto added_sec_descs = get_sec_descs(added_secs);
@@ -191,7 +191,7 @@ struct CoinbaseSecurityRequestor::PImpl {
const CCApiCorrelationID & /*corr_id*/) {
validate_response(event, exch_info_req_pending);
LOG(md, Diag, "Received Coinbase exchange info (spots):\n{}",
event.toStringPretty());
event.toPrettyString());
std::cout << msgs.size();
update_securities<CoinbaseSpot>(msgs, {SEC_TYPE(SPOT)});
exch_info_req_pending = false;
@@ -99,7 +99,7 @@ static ccapi::Subscription mk_deribit_sub(Channels channels, size_t sub_id) {
"public/subscribe",
{{"channels", vector<string>{channels.begin(), channels.end()}}},
JsonRpcId::create()};
return {
return ccapi::Subscription{
CCAPI_VENUE_NAME, "", CCAPI_GENERIC_PUBLIC_SUBSCRIPTION, req.to_string(),
FMT("{}.SUBSCRIPTION_{}", VENUE_NAME, sub_id)};
}
@@ -19,10 +19,11 @@ using bts::domain::SecurityMarketDataStatistics;
using bts::io::JsonReader;
using std::map;
using std::string;
using std::string_view;
using std::vector;
static bool parse(
const map<string, string> &name_values,
const map<string_view, string> &name_values,
std::vector<FTXHistoricalPriceRecord> &price_recs) {
CCApiReader ccapi_reader{&name_values};
nlohmann::json js;
@@ -84,10 +84,10 @@ static vector<string> get_sec_descs(const vector<Security> &sec_ptrs) {
static void validate_response(const ccapi::Event &event, bool is_expected) {
bts_assert_msgf(
event.getType() == ccapi::Event::Type::RESPONSE,
"Received event w/ unexpected type:\n{}", event.toStringPretty());
"Received event w/ unexpected type:\n{}", event.toPrettyString());
bts_assert_msgf(
is_expected, "Received unexpected response from FTX:\n{}",
event.toStringPretty());
event.toPrettyString());
}
struct FTXSecurityRequestor::PImpl {
@@ -200,7 +200,7 @@ struct FTXSecurityRequestor::PImpl {
for (const auto *msg : msgs) {
bts_assert_msgf(
msg->getType() == ccapi::Message::Type::GENERIC_PUBLIC_REQUEST,
"Received msg w/ unexpected type:\n{}", msg->toStringPretty());
"Received msg w/ unexpected type:\n{}", msg->toPrettyString());
parse_secs<T>(*msg, types, added_secs);
}
auto added_sec_descs = get_sec_descs(added_secs);
@@ -218,7 +218,7 @@ struct FTXSecurityRequestor::PImpl {
const vector<const ccapi::Message *> &msgs,
const CCApiCorrelationID & /*corr_id*/) {
validate_response(event, mkts_req_pending);
LOG(md, Diag, "Received FTX markets:\n{}", event.toStringPretty());
LOG(md, Diag, "Received FTX markets:\n{}", event.toPrettyString());
update_securities<FTXMarket>(msgs, {SEC_TYPE(SPOT)});
mkts_req_pending = false;
if (external_req_pending && !is_busy()) {
@@ -236,7 +236,7 @@ struct FTXSecurityRequestor::PImpl {
const vector<const ccapi::Message *> &msgs,
const CCApiCorrelationID & /*corr_id*/) {
validate_response(event, futs_req_pending);
LOG(md, Diag, "Received FTX futures:\n{}", event.toStringPretty());
LOG(md, Diag, "Received FTX futures:\n{}", event.toPrettyString());
update_securities<FTXFuture>(msgs, {SEC_TYPE(FUTURE)});
futs_req_pending = false;
if (external_req_pending && !is_busy()) {
@@ -131,7 +131,7 @@ void OkxChannelDemuxer::on_messages(
if (me_->process_subscription_error(payload_j)) {
continue;
}
_ERROR("on_messages. Unknown payload type:\n{}", event.toStringPretty());
_ERROR("on_messages. Unknown payload type:\n{}", event.toPrettyString());
}
me_->flush();
}
@@ -281,7 +281,7 @@ struct OkxSecuritySubscription::PImpl {
} catch (const std::exception &ex) {
_ERROR(
"on_underlying_. Parse error: {}\n***Event***:\n{}",
string{ex.what()}, event.toStringPretty());
string{ex.what()}, event.toPrettyString());
return true;
}
option_ulys = {unds.begin(), unds.end()};
@@ -306,7 +306,7 @@ struct OkxSecuritySubscription::PImpl {
_ERROR(
"on_instruments_snapshot_. Failed to read instruments. Exception: "
"{}.\n***Event***\n{}",
string{ex.what()}, event.toStringPretty());
string{ex.what()}, event.toPrettyString());
}
return true;
}
@@ -1,16 +1,44 @@
function(get_link_libraries dest)
find_package(
Boost
REQUIRED
COMPONENTS
asio
atomic
chrono
circular_buffer
date_time
filesystem
format
interprocess
lockfree
regex
signals2
spirit
system
thread
variant
)
find_package(fmt CONFIG REQUIRED)
find_package(Catch2 CONFIG REQUIRED)
set(${dest}
Boost::asio
Boost::atomic
Boost::chrono
Boost::circular_buffer
Boost::date_time
Boost::filesystem
Boost::format
Boost::interprocess
Boost::lockfree
Boost::regex
Boost::signals2
Boost::spirit
Boost::system
Boost::thread
Boost::variant
curl
tbb
boost_system
boost_thread
boost_filesystem
boost_regex
boost_chrono
boost_date_time
boost_atomic
Catch2::Catch2
protobuf
protoc
@@ -1,17 +1,49 @@
function(get_link_libraries dest)
find_package(
Boost
REQUIRED
COMPONENTS
asio
atomic
beast
chrono
circular_buffer
date_time
dll
filesystem
format
interprocess
lockfree
regex
signals2
spirit
system
thread
variant
)
find_package(fmt CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(Catch2 CONFIG REQUIRED)
set(${dest}
Boost::asio
Boost::atomic
Boost::beast
Boost::chrono
Boost::circular_buffer
Boost::date_time
Boost::dll
Boost::filesystem
Boost::format
Boost::interprocess
Boost::lockfree
Boost::regex
Boost::signals2
Boost::spirit
Boost::system
Boost::thread
Boost::variant
protobuf
double-conversion
boost_system
boost_thread
boost_filesystem
boost_regex
boost_chrono
boost_date_time
boost_atomic
Catch2::Catch2
SQLiteCpp
sqlite3
@@ -4,8 +4,8 @@
#include "spark/utils/bts_no_copy.h"
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/phoenix/function.hpp>
#include <boost/phoenix/operator.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/support_utree.hpp>
@@ -61,7 +61,7 @@ class OrderEventHandler : public ccapi::EventHandler {
: dispatch_queue(dispatch_queue),
event_types(event_types.begin(), event_types.end()),
nolog_corrids(nolog_corrids_arg) {}
bool processEvent(
void processEvent(
const ccapi::Event &event, ccapi::Session *session) override {
bts_assert(session != nullptr);
bool interested = event_types.find(event.getType()) != event_types.end();
@@ -70,10 +70,9 @@ class OrderEventHandler : public ccapi::EventHandler {
"CCAPIDeribitOrderMux::OrderEventHandler::processEvent tid: {} "
"interested: {} "
"event: {}",
os::get_thread_id(), interested, event.toStringPretty(2, 2));
os::get_thread_id(), interested, event.toPrettyString(2, 2));
if (interested)
dispatch_queue.push(event);
return true;
}
bool should_log_event(const ccapi::Event &event) const {
for (const auto &msg : event.messageList) {
@@ -697,7 +696,7 @@ void log_unhandled_msg(
const std::string &log) {
LOG(OrderMan, Error,
"CCAPIDeribitOrderMux::log_unhandled_msg {} msg: {} element: {}", log,
ccapi::Message::typeToString(msg_type), element.toStringPretty());
ccapi::Message::typeToString(msg_type), element.toPrettyString());
}
// There are only 3 types of events we handle
@@ -732,7 +731,7 @@ void CCAPIDeribitOrderMux::_handle_event(const ccapi::Event &event) {
// assert
LOG(OrderMan, Fatal,
"CCAPIDeribitOrderMux::_handle_event Unhandled event: {}",
event.toStringPretty());
event.toPrettyString());
break;
}
}
@@ -5,7 +5,7 @@
namespace bts::orderman {
const std::string &getm(
const std::map<std::string, std::string> &map, char const *key_name) {
const std::map<std::string_view, std::string> &map, char const *key_name) {
auto it = map.find(key_name);
bts_assert_msg(
it != map.end(), "Could not find key_name" + std::string(key_name));
@@ -15,7 +15,7 @@
namespace bts::orderman {
const std::string &getm(
const std::map<std::string, std::string> &map, char const *key_name);
const std::map<std::string_view, std::string> &map, char const *key_name);
bts::api::orderman::OrderStatus convert_ccapi_status(const std::string &status);
// 1.
@@ -58,7 +58,7 @@ struct CCAPICreateOrderMsg {
bts::api::orderman::OrderStatus status;
std::string corr_id;
CCAPICreateOrderMsg(
const std::map<std::string, std::string> &map,
const std::map<std::string_view, std::string> &map,
const std::string &corr_id)
: order_id(getm(map, CCAPI_EM_ORDER_ID)),
instrument(getm(map, CCAPI_INSTRUMENT)),
@@ -70,7 +70,7 @@ struct CCAPICreateOrderMsg {
price(std::stod(getm(map, CCAPI_EM_ORDER_LIMIT_PRICE))),
qty(std::stod(getm(map, CCAPI_EM_ORDER_QUANTITY))),
cumm_filled_price(std::stod(
getm(map, CCAPI_EM_ORDER_CUMULATIVE_FILLED_PRICE_TIMES_QUANTITY))),
getm(map, CCAPI_EM_ORDER_CUMULATIVE_FILLED_QUOTE_QUANTITY))),
cumm_filled_qty(
std::stod(getm(map, CCAPI_EM_ORDER_CUMULATIVE_FILLED_QUANTITY))),
status(convert_ccapi_status(getm(map, CCAPI_EM_ORDER_STATUS))),
@@ -152,7 +152,7 @@ struct CCAPIOrderUpdateMsg {
double cumm_filled_price;
double cumm_filled_qty;
api::orderman::OrderStatus status;
CCAPIOrderUpdateMsg(const std::map<std::string, std::string> &map)
CCAPIOrderUpdateMsg(const std::map<std::string_view, std::string> &map)
: order_id(getm(map, CCAPI_EM_ORDER_ID)),
side(
getm(map, CCAPI_EM_ORDER_SIDE) == CCAPI_EM_ORDER_SIDE_BUY
@@ -162,7 +162,7 @@ struct CCAPIOrderUpdateMsg {
price(std::stod(getm(map, CCAPI_EM_ORDER_LIMIT_PRICE))),
qty(std::stod(getm(map, CCAPI_EM_ORDER_QUANTITY))),
cumm_filled_price(std::stod(
getm(map, CCAPI_EM_ORDER_CUMULATIVE_FILLED_PRICE_TIMES_QUANTITY))),
getm(map, CCAPI_EM_ORDER_CUMULATIVE_FILLED_QUOTE_QUANTITY))),
cumm_filled_qty(
std::stod(getm(map, CCAPI_EM_ORDER_CUMULATIVE_FILLED_QUANTITY))),
status(convert_ccapi_status(getm(map, CCAPI_EM_ORDER_STATUS))) {}
@@ -204,7 +204,7 @@ struct CCAPITradeMsg {
double last_exec_price;
double last_exec_qty;
std::string trade_id;
CCAPITradeMsg(const std::map<std::string, std::string> &map)
CCAPITradeMsg(const std::map<std::string_view, std::string> &map)
: order_id(getm(map, CCAPI_EM_ORDER_ID)),
side(
getm(map, CCAPI_EM_ORDER_SIDE) == CCAPI_EM_ORDER_SIDE_BUY
@@ -22,10 +22,10 @@ namespace bts::orderman {
class MyEventHandler : public ccapi::EventHandler {
public:
std::string order_id = "";
bool processEvent(
void processEvent(
const ccapi::Event &event, ccapi::Session *session) override {
bts_assert(session != nullptr);
std::cout << "Received an event:\n" + event.toStringPretty(2, 2)
std::cout << "Received an event:\n" + event.toPrettyString(2, 2)
<< std::endl;
const auto &msg_list = event.getMessageList();
for (const auto &m : msg_list) {
@@ -41,7 +41,6 @@ class MyEventHandler : public ccapi::EventHandler {
}
}
}
return true;
}
};
+8
View File
@@ -2,9 +2,17 @@
"dependencies": [
"boost-asio",
"boost-atomic",
{
"name": "boost-beast",
"platform": "linux"
},
"boost-chrono",
"boost-circular-buffer",
"boost-date-time",
{
"name": "boost-dll",
"platform": "linux"
},
"boost-filesystem",
"boost-format",
"boost-interprocess",