The output that we ultimately want is a running average of the last few ticks of our time series. For the number of our last few ticks, I'm going to pick 20 because it's a nice round number. However, we'll make our algorithm flexible enough to accept different time intervals for our running average. So, now it looks like our output can start with the input with an added entry for the running average at each tick, which is described in the following output. We can't evaluate this data structure yet. The elided values after the :average
key, are just pseudo code, representing the result we need to reach:
({:average <…>, :last-trade-time #inst "2015-09-24T04:13:13.868-00:00", :last-trade-price {:last 5.466160487301605}} {:average <…>, :last-trade-time #inst "2015-09-24T04:13:15.868-00:00", :last-trade-price {:last 6.540895364039775}} {:average <…>, :last-trade-time #inst "2015-09-24T04:13:16.868-00:00", :last-trade-price {:last 5.53301182972796}} {:average <…>, :last-trade-time #inst "2015-09-24T04:13:17.868-00:00", :last-trade-price {:last 5.827927905654936}} {:average <…>, :last-trade-time #inst "2015-09-24T04:13:19.868-00:00", :last-trade-price {:last 6.31043832017862}} {:average <…>, :last-trade-time #inst "2015-09-24T04:13:21.868-00:00", :last-trade-price {:last 7.1373823393671865}} {:average <…>, :last-trade-time #inst "2015-09-24T04:13:24.868-00:00", :last-trade-price {:last 8.564858807240624}} {:average <…>, :last-trade-time #inst "2015-09-24T04:13:24.868-00:00", :last-trade-price {:last 10.277830568688747}} {:average <…>, :last-trade-time #inst "2015-09-24T04:13:25.868-00:00", :last-trade-price {:last 8.222264454950999}} {:average <…>, :last-trade-time #inst "2015-09-24T04:13:28.868-00:00", :last-trade-price {:last 9.866717345941199}} ...)
3.148.113.229