Skip to content

Commit

Permalink
Add additional corner cases for volume loop steemit#3599
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandeberg committed Feb 11, 2020
1 parent 60d5fb4 commit 5b974a9
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ DEFINE_API_IMPL( market_history_api_impl, get_volume )
{
auto itr = bucket_idx.lower_bound( boost::make_tuple( args.market, bucket_size, latest_time ) );

while( itr != bucket_idx.end() && itr->symbol == args.market )
while( itr != bucket_idx.end()
&& itr->symbol == args.market
&& itr->seconds == bucket_size )
{
result.steem_volume.amount += itr->steem.volume;
result.sbd_volume.amount += itr->non_steem.volume;
Expand All @@ -83,7 +85,10 @@ DEFINE_API_IMPL( market_history_api_impl, get_volume )

itr = bucket_idx.lower_bound( boost::make_tuple( args.market, bucket_size, earliest_time ) );

while( itr->open < earliest_time )
while( itr != bucket_idx.end()
&& itr->open < earliest_time
&& itr->symbol == args.market
&& itr->seconds == bucket_size )
{
result.steem_volume.amount += itr->steem.volume;
result.sbd_volume.amount += itr->non_steem.volume;
Expand Down

0 comments on commit 5b974a9

Please sign in to comment.