So we can subscribe to depth for "FTX Options" or "FTX BTC Futures", rather than having to list each security explicitly. This commit also unhooks binance from MarketDataGateway. A new paradigm is emerging with the FTX impl, and it'll be easier to redo Binance than try to make the existing impl fit the new mold. Unfortunately, ccapi doesn't provide all the security metadata we need, such as the security type and expiration date/time, so we get the list of FTX securities directly from the exchange.
34 lines
979 B
C++
34 lines
979 B
C++
#ifdef SPARK_ENABLE_CCAPI
|
|
#include "CCApiMessageLogger.h"
|
|
#include "lib/core/StringJoiner.h"
|
|
#include "lib/core/TimeStamp.h"
|
|
#include <fmt/format.h>
|
|
#include <range/v3/view.hpp>
|
|
#include <range/v3/view/transform.hpp>
|
|
#include <string>
|
|
|
|
namespace bts::md {
|
|
|
|
using bts::core::StringJoiner;
|
|
using std::string;
|
|
|
|
CCApiMessageLogger::CCApiMessageLogger(std::string name)
|
|
: name_(std::move(name)) {}
|
|
|
|
void CCApiMessageLogger::on_messages(
|
|
const ccapi::Event & /*event*/,
|
|
ccapi::Session * /*session*/,
|
|
const std::vector<const ccapi::Message *> &msgs,
|
|
const CCApiCorrelationID &corr_id) {
|
|
|
|
auto msg_strs = msgs | ranges::views::transform([](const ccapi::Message *m) {
|
|
return m->toStringPretty();
|
|
});
|
|
auto msgs_str = StringJoiner::join(msg_strs.begin(), msg_strs.end(), "\n");
|
|
LOG(md, Info, "Received CCApi messages. name: {}; corr_id: {}; msgs:\n{}",
|
|
name_, corr_id, msgs_str);
|
|
}
|
|
|
|
} // namespace bts::md
|
|
#endif
|