spark-338 more complex than it looked
This commit is contained in:
1 parent
2935368f66
commit
b2033cf52e
8 files changed
+328
-123
No files matched your search
@@ -233,23 +233,20 @@ struct QueryServerImpl : public IQueryServer {
|
||||
snapshot = true;
|
||||
}
|
||||
if (HASFLAG(flags, MDRequest::BBO) || HASFLAG(flags, MDRequest::DEPTH)) {
|
||||
PriceSize bid, ask;
|
||||
std::array<PriceSize, COCONUT_MAX_DEPTH> bids, asks;
|
||||
TimeStamp time(snapshot ? 0 : chan.time());
|
||||
auto result = handle.get_bbo(time, bid, ask);
|
||||
size_t copy_depth = HASFLAG(flags, MDRequest::DEPTH) ? COCONUT_MAX_DEPTH : 1;
|
||||
auto result = handle.get_depth(time, copy_depth, bids.data(), asks.data());
|
||||
if (result == HandleReadResult::SUCCESS) {
|
||||
auto* p = pupd->mutable_book();
|
||||
convert(bid, p->add_bids());
|
||||
convert(ask, p->add_asks());
|
||||
if (HASFLAG(flags, MDRequest::DEPTH) && handle.has_depth()) {
|
||||
for (size_t x = 1; x < COCONUT_MAX_DEPTH; ++x) {
|
||||
PriceSize bid = handle.get_bid(x);
|
||||
if (bid != PriceSize::NO_MARKET) {
|
||||
convert(bid, p->add_bids());
|
||||
}
|
||||
PriceSize ask = handle.get_ask(x);
|
||||
if (ask != PriceSize::NO_MARKET) {
|
||||
convert(ask, p->add_asks());
|
||||
}
|
||||
for (size_t x = 0; x < COCONUT_MAX_DEPTH; ++x) {
|
||||
PriceSize b = bids[x];
|
||||
if (b != PriceSize::NO_MARKET) {
|
||||
convert(b, p->add_bids());
|
||||
}
|
||||
PriceSize a = asks[x];
|
||||
if (a != PriceSize::NO_MARKET) {
|
||||
convert(a, p->add_asks());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user