O'Reilly logo

Clojure for Finance by Timothy Washington

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Knowing the data output

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required