Files
spark/src/lib_binance/binance/websocket_api_response.h
T
John Colvin 588b86710f refactor: Rename lib_binance_execution lib_binance
Implementing md and execution for the same exchange in separate projects
has proven to be messy and impractical. I'm renaming this project in
advance of a binance md rewrite which will join md and execution
together in the same lib.
2025-07-17 16:25:23 +00:00

36 lines
755 B
C++

#pragma once
#include "spark/core/FMT_IMPL.h"
#include "spark/io/json_formatter.h"
#include <nlohmann/json.hpp>
namespace binance {
template <typename Result>
struct WebsocketApiResponse {
std::string id;
std::int64_t status;
Result result;
nlohmann::json error;
std::string to_string() const;
};
template <typename Result>
void to_json(nlohmann::json &j, const WebsocketApiResponse<Result> &req);
template <typename Result>
void from_json(const nlohmann::json &j, WebsocketApiResponse<Result> &req);
} // namespace binance
template <typename Result>
FMT_IMPL_T(
binance::WebsocketApiResponse<Result>,
r,
R"({{"id": "{}", "status": {}, "result": {} }})",
r.id,
r.status,
bts::io::json_formatter(r.result));