From bc6eb591102ef4df261bf1a2d846bc212960e4bb Mon Sep 17 00:00:00 2001 From: Mohammad Arham Date: Wed, 12 Mar 2025 20:45:27 +0000 Subject: [PATCH] Fix: Change cttype from optional to string --- src/server/sparkd/md/okx/OkxInstrument.cpp | 6 ++---- src/server/sparkd/md/okx/OkxInstrument.h | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/sparkd/md/okx/OkxInstrument.cpp b/src/server/sparkd/md/okx/OkxInstrument.cpp index bc1b239cc..38271b7d6 100644 --- a/src/server/sparkd/md/okx/OkxInstrument.cpp +++ b/src/server/sparkd/md/okx/OkxInstrument.cpp @@ -22,7 +22,7 @@ void from_json(const nlohmann::json &inst_j, OkxInstrument &inst) { r.read("tickSz", inst.tickSz); r.read("lotSz", inst.lotSz); r.read("minSz", inst.minSz); - r.read_optional("ctType", inst.ctType); + r.read("ctType", inst.ctType); r.read("alias", inst.alias); r.read("state", inst.state); r.read("maxLmtSz", inst.maxLmtSz); @@ -61,9 +61,7 @@ void to_json(nlohmann::json &inst_j, const OkxInstrument &inst) { inst_j["tickSz"] = inst.tickSz; inst_j["lotSz"] = inst.lotSz; inst_j["minSz"] = inst.minSz; - if (inst.ctType) { - inst_j["ctType"] = *inst.ctType; - } + inst_j["ctType"] = inst.ctType; inst_j["alias"] = inst.alias; inst_j["state"] = inst.state; inst_j["maxLmtSz"] = inst.maxLmtSz; diff --git a/src/server/sparkd/md/okx/OkxInstrument.h b/src/server/sparkd/md/okx/OkxInstrument.h index edd0097db..a2484da82 100644 --- a/src/server/sparkd/md/okx/OkxInstrument.h +++ b/src/server/sparkd/md/okx/OkxInstrument.h @@ -34,7 +34,7 @@ class OkxInstrument { double tickSz; double lotSz; double minSz; - std::optional ctType; + std::string ctType; std::string alias; OkxInstrumentStatus state; double maxLmtSz; @@ -57,6 +57,8 @@ std::ostream &operator<<(std::ostream &out, const OkxInstrument &inst) noexcept; inline std::ostream &operator<<( std::ostream &out, const OkxInstrument &inst) noexcept { out << inst.instId; + nlohmann::json inst_j = inst; + out << inst_j.dump(); return out; }