Fix: Change cttype from optional to string
This commit is contained in:
1 parent
5ae5a5dcbf
commit
bc6eb59110
2 files changed
+5
-5
No files matched your search
@@ -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;
|
||||
|
||||
@@ -34,7 +34,7 @@ class OkxInstrument {
|
||||
double tickSz;
|
||||
double lotSz;
|
||||
double minSz;
|
||||
std::optional<double> 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user