f# in finance tour

22
F# IN FINANCE TOUR Phillip Trelford Trayport Ltd F# in Finance 2013

Upload: phillip-trelford

Post on 17-Aug-2014

1.194 views

Category:

Economy & Finance


1 download

DESCRIPTION

Talk at F# in Finance conference at Microsoft in London

TRANSCRIPT

Page 1: F# in Finance Tour

F# IN FINANCE TOUR Phillip TrelfordTrayport LtdF# in Finance 2013

Page 2: F# in Finance Tour

F#UNCTIONAL LONDONERS Founded Feb 2010 600+ Members 50+ Meetups 3 Conferences Topics Finance Machine Learning Reactive Programming Functional Programming

Page 3: F# in Finance Tour

F# GROUPS WORLDWIDE

Page 4: F# in Finance Tour

SECTORS

Investment Banks

Hedge funds

Prop shops

Utilities

Insurance

Page 5: F# in Finance Tour

TIME TO MARKET

We are using F# because it considerably increases speed of software development which is crucial for a

small company with limited development resources. Boston-based Financial Services Firm

Page 6: F# in Finance Tour

EFFICIENCY

F# … to reduce the amount of code required and its simplicity when developing massive parallel computations. The

performance is phenomenal. We can now re-calculate the entire bank portfolio from scratch in less than a second

Handelsbanken  

Page 7: F# in Finance Tour

CORRECTNESS

The efficient use of functional programming throughout the R&D cycle helped make the cycle faster and more efficient. Less

time was spent on translating requirements, miscommunications etc. and more on producing a fast and accurate solution

quickly. CME Group

Page 8: F# in Finance Tour

COMPLEXITY  

We have set up a complete risk management system that combines several data sources…

When the calculation requires a proper algorithm (i.e. anything that is more complex than a simple for loop), our choice has been

F#. London-Based Asset Management Company

Page 9: F# in Finance Tour

TRAYPORT JOULE

Page 10: F# in Finance Tour

SPECIFICATIONS WITH TICKSPEC

Page 11: F# in Finance Tour

CURRENCY CONVERSIONS[<Measure>] type EUR[<Measure>] type GBPlet rateEurGbp = 0.783M<GBP/EUR>

// Converts amount in EUR to GBPlet euroToPounds (eur:decimal<EUR>) = eur * rateEurGbp

Page 12: F# in Finance Tour

OPTION PRICING let euroCallValue exercisePrice actualPrice = max (actualPrice - exercisePrice) 0.0

let euroPutValue exercisePrice actualPrice = max (exercisePrice - actualPrice) 0.0

let butterflySpread lowPrice highPrice actualPrice = (euroCallValue lowPrice actualPrice) + (euroCallValue highPrice actualPrice) - 2.0 * (euroCallValue ((lowPrice + highPrice) / 2.0) actualPrice)

Page 13: F# in Finance Tour

R – TYPE PROVIDER

Page 14: F# in Finance Tour

ORDERS – RECORD TYPESF#

type LimitOrder = { LimitPrice : decimal Quantity : int Side : Side }

C#

Page 15: F# in Finance Tour

TIME IN FORCE – UNION TYPEtype TimeInForce = | GoodTillCancel | GoodForDay | GoodTillDate of DateTime

Page 16: F# in Finance Tour

UNITS IN CELLStype UnitType =

| Empty

| Unit of string * int

| CompositeUnit of UnitType list

Page 17: F# in Finance Tour

TRAINING Phillip TrelfordTrayport LtdF# in Finance 2013

Page 18: F# in Finance Tour

SKILLS MATTERTraining Fast Track to F# 2 days (quarterly)

Tutorials F# Tutorials (London & NYC) 2 days (annually)

Page 19: F# in Finance Tour

F# KOANS[<Koan>]let SquareEvenNumbersWithPipelineOperator() =(* In F#, you can use the pipeline operator to get the benefit of the parens style with the readability of the statement style. *)

let result = [0..5] |> List.filter isEven |> List.map square AssertEquality result __

Page 20: F# in Finance Tour

TRYFSHARP.ORG - FINANCE

Page 21: F# in Finance Tour

F# JOB DEMAND - UK

Source: IT Jobs Watch Nov 2013

Page 22: F# in Finance Tour

Phillip TrelfordTrayport LtdF# in Finance 2013