Book Image

F# for Quantitative Finance

By : Johan Astborg
Book Image

F# for Quantitative Finance

By: Johan Astborg

Overview of this book

F# is a functional programming language that allows you to write simple code for complex problems. Currently, it is most commonly used in the financial sector. Quantitative finance makes heavy use of mathematics to model various parts of finance in the real world. If you are interested in using F# for your day-to-day work or research in quantitative finance, this book is a must-have.This book will cover everything you need to know about using functional programming for quantitative finance. Using a functional programming language will enable you to concentrate more on the problem itself rather than implementation details. Tutorials and snippets are summarized into an automated trading system throughout the book.This book will introduce you to F#, using Visual Studio, and provide examples with functional programming and finance combined. The book also covers topics such as downloading, visualizing and calculating statistics from data. F# is a first class programming language for the financial domain.
Table of Contents (17 chapters)
F# for Quantitative Finance
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Presenting information in the GUI


In this section, we'll look at ways of presenting information in a GUI which is updated on a regular basis. We'll use the MVC pattern to update the data.

In .NET, in general, the interface INotifyPropertyChanged is used when the notification of an update is needed in the model. In this example, we'll use a DataGridView control and a DataSource that consists of a list with items of a custom type implementing the INotifyPropertyChanged interface.

The updates to the model are handled by the controller and then the GUI is updated from the DataSource itself. Let's start by looking at the list of orders and how to present that list of orders in the DataGridView control. Add the following code to the GUI.fs file:

let initOrderList() =
  let modelList = new BindingList<Model.Order>()
  let buyOrder = Model.Order(Model.OrderSide.Buy, Model.OrderType.Limit, 54.50, Model.Tif.FillorKill, 100, "MSFT", 0.0)            
  modelList.Add(buyOrder)

  dataGridView.DataSource...