Skip to content

Commit

Permalink
fix: extract account info error and subscribe ORDER_UPDATE error in b…
Browse files Browse the repository at this point in the history
…itget_futures
  • Loading branch information
MrrDrr committed Jan 6, 2024
1 parent 8956581 commit 4f957be
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,11 @@ class ExecutionManagementServiceBitgetFutures : public ExecutionManagementServic
case Request::Operation::GET_ACCOUNT_BALANCES: {
for (const auto& x : document["data"].GetArray()) {
Element element;
element.insert(CCAPI_EM_ASSET, x["coinName"].GetString());
std::string available = x["available"].GetString();
element.insert(CCAPI_EM_ASSET, x["marginCoin"].GetString());
std::string available = x["crossMaxAvailable"].GetString();
element.insert(CCAPI_EM_QUANTITY_AVAILABLE_FOR_TRADING, available);
std::string frozen = x["frozen"].GetString();
std::string lock = x["lock"].GetString();
element.insert(CCAPI_EM_QUANTITY_TOTAL, (Decimal(available).add(Decimal(frozen)).add(Decimal(lock))).toString());
std::string locked = x["locked"].GetString();
element.insert(CCAPI_EM_QUANTITY_TOTAL, (Decimal(available).add(Decimal(locked))).toString());
elementList.emplace_back(std::move(element));
}
} break;
Expand Down Expand Up @@ -331,6 +330,7 @@ class ExecutionManagementServiceBitgetFutures : public ExecutionManagementServic
rj::Value args(rj::kArrayType);
const auto& fieldSet = subscription.getFieldSet();
const auto& instrumentSet = subscription.getInstrumentSet();
const auto& instrumentType = subscription.getInstrumentType();
for (const auto& field : fieldSet) {
std::string channel;
if (fieldSet.find(CCAPI_EM_ORDER_UPDATE) != fieldSet.end() || fieldSet.find(CCAPI_EM_PRIVATE_TRADE) != fieldSet.end()) {
Expand All @@ -340,7 +340,7 @@ class ExecutionManagementServiceBitgetFutures : public ExecutionManagementServic
rj::Value arg(rj::kObjectType);
arg.AddMember("channel", rj::Value(channel.c_str(), allocator).Move(), allocator);
arg.AddMember("instId", rj::Value(instrument.c_str(), allocator).Move(), allocator);
arg.AddMember("instType", rj::Value("spbl").Move(), allocator);
arg.AddMember("instType", rj::Value(instrumentType.c_str(), allocator).Move(), allocator);
args.PushBack(arg, allocator);
}
}
Expand Down

0 comments on commit 4f957be

Please sign in to comment.