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

Summary

In this chapter, we built on the simple-moving-average function using the more advanced partition Clojure data transformation function. Vars, binding, and lazy sequences helped us organize our expressions. And our function design was guided by the data input and desired data output. The goal here is to form a solid understanding of a problem, easily represent data, and quickly perform calculations. From our basic tick list, we were able to (from a starting point) calculate the average price at each point up to the current price. We did this by slicing or partitioning our list so that each price point had a history of the previous 20 price points. These are the kinds of functions that will empower us to manipulate and shape our data. We'll ...

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