#47 Fix bug with not initializing base volume

This commit is contained in:
Daniel Larimer 2015-06-25 09:47:56 -04:00
parent fef77a15a2
commit 88aeaa5e69
2 changed files with 6 additions and 5 deletions

@ -1 +1 @@
Subproject commit 707b9497c6ffd00e8ea45ffca429ac60880d7acc Subproject commit c09035dba0cdab7fcb2c11bf81aaeaffaa981f66

View file

@ -109,6 +109,7 @@ struct operation_process_fill_order
const auto& obj = db.create<bucket_object>( [&]( bucket_object& b ){ const auto& obj = db.create<bucket_object>( [&]( bucket_object& b ){
b.key = key; b.key = key;
b.quote_volume += trade_price.quote.amount; b.quote_volume += trade_price.quote.amount;
b.base_volume += trade_price.base.amount;
b.open_base = trade_price.base.amount; b.open_base = trade_price.base.amount;
b.open_quote = trade_price.quote.amount; b.open_quote = trade_price.quote.amount;
b.close_base = trade_price.base.amount; b.close_base = trade_price.base.amount;
@ -118,11 +119,11 @@ struct operation_process_fill_order
b.low_base = b.close_base; b.low_base = b.close_base;
b.low_quote = b.close_quote; b.low_quote = b.close_quote;
}); });
wlog( " creating bucket ${b}", ("b",obj) ); //wlog( " creating bucket ${b}", ("b",obj) );
} }
else else
{ // update existing bucket { // update existing bucket
wlog( " before updating bucket ${b}", ("b",*itr) ); // wlog( " before updating bucket ${b}", ("b",*itr) );
db.modify( *itr, [&]( bucket_object& b ){ db.modify( *itr, [&]( bucket_object& b ){
b.base_volume += trade_price.base.amount; b.base_volume += trade_price.base.amount;
b.quote_volume += trade_price.quote.amount; b.quote_volume += trade_price.quote.amount;
@ -139,7 +140,7 @@ struct operation_process_fill_order
b.low_quote = b.close_quote; b.low_quote = b.close_quote;
} }
}); });
wlog( " after bucket bucket ${b}", ("b",*itr) ); // wlog( " after bucket bucket ${b}", ("b",*itr) );
} }
if( max_history != 0 ) if( max_history != 0 )
@ -153,7 +154,7 @@ struct operation_process_fill_order
itr->key.seconds == bucket && itr->key.seconds == bucket &&
itr->key.open < cutoff ) itr->key.open < cutoff )
{ {
elog( " removing old bucket ${b}", ("b", *itr) ); // elog( " removing old bucket ${b}", ("b", *itr) );
auto old_itr = itr; auto old_itr = itr;
++itr; ++itr;
db.remove( *old_itr ); db.remove( *old_itr );