diff --git a/src/ripple/rpc/handlers/GetAggregatePrice.cpp b/src/ripple/rpc/handlers/GetAggregatePrice.cpp index 5c0a8f32d0e..982a628dd25 100644 --- a/src/ripple/rpc/handlers/GetAggregatePrice.cpp +++ b/src/ripple/rpc/handlers/GetAggregatePrice.cpp @@ -314,6 +314,7 @@ doGetAggregatePrice(RPC::JsonContext& context) return result; } + result[jss::time] = latestTime; // calculate stats auto const [avg, sd, size] = getStats(prices.right.begin(), prices.right.end()); diff --git a/src/test/rpc/GetAggregatePrice_test.cpp b/src/test/rpc/GetAggregatePrice_test.cpp index e3b5f0c27f9..798419b9049 100644 --- a/src/test/rpc/GetAggregatePrice_test.cpp +++ b/src/test/rpc/GetAggregatePrice_test.cpp @@ -139,6 +139,7 @@ class GetAggregatePrice_test : public beast::unit_test::suite BEAST_EXPECT( ret[jss::trimmed_set][jss::standard_deviation] == "0.187082869338697"); + BEAST_EXPECT(ret[jss::time] == 90); } // reduced data set as some price oracles have the price data @@ -179,6 +180,7 @@ class GetAggregatePrice_test : public beast::unit_test::suite BEAST_EXPECT( ret[jss::trimmed_set][jss::standard_deviation] == "0.158113883008419"); + BEAST_EXPECT(ret[jss::time] == 90); } // reduced data set because of the time threshold @@ -205,6 +207,7 @@ class GetAggregatePrice_test : public beast::unit_test::suite BEAST_EXPECT(ret[jss::entire_set][jss::size].asUInt() == 8); BEAST_EXPECT(ret[jss::entire_set][jss::standard_deviation] == "0"); BEAST_EXPECT(ret[jss::median] == "74"); + BEAST_EXPECT(ret[jss::time] == 1009); } }