F#

Predicting future with F# and Azure Machine Learning

Earlier this year I blogged about StockEstimator – my side project for predicting future stock prices. Recently in addition to F# module, which estimates future prices, I added Web Service that takes advantage of Azure Machine Learning to do the same much faster.

Last month I talked about my project at .NET Developers Association Meetup in Redmond and in Seattle. I streamed both session with YouTube live, and recordings are already available:

Both videos cover the same topics. Not sure, which one is better. However, there was one gentleman who went to both my talks and he said that the second one was better 🙂

In both presentations I do a quick intro to F#, an overview of Machine Learning, and how I took advantage of both to predict future stock prices.

If you are interested in F# I recommend you to check my Getting started with F#.

Presentation slides are available here (you can find there a lot of references to materials about F#, Machine Learning and Azure Machine Learning).

StockEstimator project is open source and available on github.

I’m not going to stop here. As you can see on my slides, and at the end of my presentations I have future plans to evolve this overnight project 🙂


Getting started with F#

F#

tl;dr This post is a list of resources for learning F# and overview of my mini-project: Stock Estimator.

I couldn’t resist anymore, and I finally tried F#. For the first two days it was painful. Some elements of F# syntax are weird. However after getting use to that, F# became a joy, and instead of a week (as I planned) I spent with F# almost two months.

Getting Started

Deep Dive

There is also a book written by Jon Skeet and Tomas Petricek: Real World Functional Programming: With Examples in F# and C#.

Testing

Web Development

The most popular F# Web Framework is Suave. There is great SuaveMusicStore tutorial (code), which is inspired by ASP.NET MVC Music Store tutorial. If you want to build Web API with F#, check Building REST Api in Fsharp Using Suave.

It is also worth to check End-to-end Functional Web Development by Tomas Petricek where he showcases building web app with Suave.

For more, check Web Programming with F# Guide.

Stock Estimator

I created F# based app for predicting future stock prices ($1,000,000 idea!). The back-end is written in F#, and communicates with stock data API (Yahoo Finance) through F# type provider. There is also Suave Web API (microservice), and ASP.NET Core web app that communicates with it. Front-end is powered by Aurelia Framework, and D3 library. In other words: I built F# microservice, consumed it from non-F# app, and have reusable logic in separated project. All communication with microservice happens through the client (with Aurelia Framework). So, there is no usage of F# from C#, but…I also created simple Console app (with C#) that uses mentioned F# logic. There is also Windows Forms app for displaying estimates, written in F#, that also use reusable logic.

Entire source code is available on github. Check it out!

Summary

Programming in F# is pure joy! It’s a great language for working with data. Moreover, F# fits perfectly into today’s World of microservices. You don’t have to rewrite your already existing app, or create entire app with F#. You can just create one microservice with F#, and see how it works for you!