Skip to content

Commit

Permalink
[FOLD] Add time stamp to get_aggregate_price output
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatcam committed Oct 23, 2023
1 parent 25a4219 commit 19c0ef3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ripple/rpc/handlers/GetAggregatePrice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 3 additions & 0 deletions src/test/rpc/GetAggregatePrice_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
}

Expand Down

0 comments on commit 19c0ef3

Please sign in to comment.