I have an object like so. They key is a timestamp and the value is my number
var history = {
'1505845390000': 295426,
'1505757979000': 4115911,
'1505677767000': 4033384,
'1505675472000': 4033384,
'1505591090000': 3943956,
'1505502071000': 3848963,
'1505499910000': 3848963,
'1505499894000': 3848963
}
What I want to do is:
1) For the latest 5 dates (keys), get an average of the values 2) For a date range, get an average of the values