Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kucoin - check prices of ticker because they are sometimes invalid #469

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/api/exchanges/src/kucoinpublicapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,23 @@ MarketOrderBookMap KucoinPublic::AllOrderBooksFunc::operator()(int depth) {
for (const json& tickerDetails : data["ticker"]) {
Market mk(tickerDetails["symbol"].get<std::string_view>(), '-');
if (!markets.contains(mk)) {
log::trace("Market {} is not present", mk);
log::debug("Market {} is not present", mk);
continue;
}
MonetaryAmount askPri(tickerDetails["sell"].get<std::string_view>(), mk.quote());
if (askPri == 0) {
log::debug("Discarding {} because of invalid ask price {}", mk, askPri);
continue;
}
MonetaryAmount bidPri(tickerDetails["buy"].get<std::string_view>(), mk.quote());
if (bidPri == 0) {
log::debug("Discarding {} because of invalid bid price {}", mk, bidPri);
continue;
}
// There is no volume in the response, we need to emulate it, based on the 24h volume
MonetaryAmount dayVolume(tickerDetails["vol"].get<std::string_view>(), mk.base());
if (dayVolume == 0) {
log::trace("No volume for {}", mk);
log::debug("Discarding {} because of invalid volume {}", mk, dayVolume);
continue;
}
const MarketsFunc::MarketInfo& marketInfo = marketInfoMap.find(mk)->second;
Expand Down
Loading