Return latest price in get_ticker even if older than 24 hours
This commit is contained in:
parent
12be59db79
commit
b209915a36
1 changed files with 14 additions and 8 deletions
|
|
@ -1125,6 +1125,12 @@ market_ticker database_api_impl::get_ticker( const string& base, const string& q
|
||||||
result.percent_change = ( (result.latest / price_yesterday) - 1 ) * 100;
|
result.percent_change = ( (result.latest / price_yesterday) - 1 ) * 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto last_trade = get_trade_history( base, quote, now, fc::time_point_sec(), 1 );
|
||||||
|
if( !last_trade.empty() )
|
||||||
|
result.latest = last_trade[0].price;
|
||||||
|
}
|
||||||
|
|
||||||
const auto orders = get_order_book( base, quote, 1 );
|
const auto orders = get_order_book( base, quote, 1 );
|
||||||
if( !orders.asks.empty() ) result.lowest_ask = orders.asks[0].price;
|
if( !orders.asks.empty() ) result.lowest_ask = orders.asks[0].price;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue