F# for Trading

F# for Trading
Phillip Trelford
Trayport
F# Community
F# Language

•   Strongly Typed
•   Functional First
•   Object Orientated
•   Open Source
•   First Class .Net language
•   In Visual Studio
Visual Studio
Joule Energy Trading Screen
Leverage

•   Existing code
•   Domain modelling
•   Computation
•   Concurrency
•   Libraries
Specification by Example
TickSpec: Breakpoint in text file
Thoughtworks Tech Radar
March 2012

    “F# is excellent at concisely expressing
         business and domain logic.”

 “Developers trying to achieve explicit business
     logic within an application may opt to
           express their domain in F#
  with the majority of plumbing code in C#.”
Order – Record type
type Order = {
  Side : Side
  LimitPrice : Price
  Quantity : Quantity
  IsAllOrNone : bool
  }
Time in Force – Union type
type TimeInForce =
  | Immediate
  | GoodForDay
  | GoodTillDate of DateTime
Units of Measure
Excel – Type Provider
Excel              Visual Studio
F# for Computation
• Standard F# tools
  ▫ F# language and core libraries

• Workstation libraries
  ▫ Math.NET Numerics (open source)
  ▫ StatFactory FCore

• Distributed libraries
  ▫ Microsoft Cloud Numerics
  ▫ Nessos {m}brace cloud
Monte Carlo estimation of Pi
R – Type Provider
ShowDialog – Async workflows
Rx

notifications.
    BufferWithTimeOrCount(
    TimeSpan.FromSeconds(0.01),
    50);
MiniRx

   int closure = i;
   mouseMove
     .Select(e => e.GetPosition(canvas))
     .Delay(closure * 100)
     .OnDispatcher()
     .Subscribe(pos =>
     {
        Canvas.SetLeft(label, pos.X + closure * 10);
        Canvas.SetTop(label, pos.Y);
     });
F# Agents – MailboxProcessor type
Agent.Start (fun inbox -> async {
    while true do
        let! instruction =
            instruction.Receive()
        instruction
        |> market.Update
        |> notify } )
The future – {m}brace the cloud

• Programming model that looks sequential but
  executes distributed
 ▫ async { }
 ▫…
 ▫ cloud { }
.Net 4.5 Garbage Collector
Latency Mode          Application Scenarios


Batch                 Command line
                      Server Side

Interactive           LOB applications


LowLatency            Trading Screens


SustainedLowLatency   Financial Applications
Meet the F#ers

     @rickasaurus

      @tomaspetricek

     @dmohl
Try F#: http://tryfsharp.org
Questions?
Me                               F#


Twitter: @ptrelford              Twitter: #fsharp
Feed: http://trelford.com/blog   Feed: http://fpound.net
1 of 25

Recommended

TechDaysNL 2015 - F# for C# Developers by
TechDaysNL 2015 - F# for C# DevelopersTechDaysNL 2015 - F# for C# Developers
TechDaysNL 2015 - F# for C# DevelopersRonald Harmsen
964 views35 slides
A Very Brief Intro to Golang by
A Very Brief Intro to GolangA Very Brief Intro to Golang
A Very Brief Intro to GolangJoshua Haupt
62 views29 slides
Consider the following BNF grammar: implement a recursive descent parser tha... by
Consider the following BNF grammar:  implement a recursive descent parser tha...Consider the following BNF grammar:  implement a recursive descent parser tha...
Consider the following BNF grammar: implement a recursive descent parser tha...hwbloom143
18 views1 slide
Unit iv by
Unit ivUnit iv
Unit ivsnehaarao19
308 views13 slides
06 Justenough Information by
06 Justenough Information06 Justenough Information
06 Justenough InformationAdithya Rao
292 views28 slides
Dynamic languages for .NET CLR by
Dynamic languages for .NET CLRDynamic languages for .NET CLR
Dynamic languages for .NET CLRpy_sunil
1.8K views22 slides

More Related Content

Similar to F# for Trading

F# for Trading NYC by
F# for Trading NYCF# for Trading NYC
F# for Trading NYCPhillip Trelford
3.7K views30 slides
Creating Domain Specific Languages in F# by
Creating Domain Specific Languages in F#Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#Tomas Petricek
7.6K views30 slides
F# and the DLR by
F# and the DLRF# and the DLR
F# and the DLRRichard Minerich
2.4K views33 slides
F# Tutorial @ QCon by
F# Tutorial @ QConF# Tutorial @ QCon
F# Tutorial @ QConTomas Petricek
1.7K views32 slides
Visual Studio .NET2010 by
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010Satish Verma
1.8K views42 slides
"The F# Path to Relaxation", Don Syme by
"The F# Path to Relaxation", Don Syme"The F# Path to Relaxation", Don Syme
"The F# Path to Relaxation", Don SymeFwdays
148 views65 slides

Similar to F# for Trading(20)

Creating Domain Specific Languages in F# by Tomas Petricek
Creating Domain Specific Languages in F#Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#
Tomas Petricek7.6K views
Visual Studio .NET2010 by Satish Verma
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma1.8K views
"The F# Path to Relaxation", Don Syme by Fwdays
"The F# Path to Relaxation", Don Syme"The F# Path to Relaxation", Don Syme
"The F# Path to Relaxation", Don Syme
Fwdays148 views
F# for functional enthusiasts by Jack Fox
F# for functional enthusiastsF# for functional enthusiasts
F# for functional enthusiasts
Jack Fox2.4K views
Practical F# by Ryan Riley
Practical F#Practical F#
Practical F#
Ryan Riley1.5K views
TechDaysNL 2015 - DDD with F# by Ronald Harmsen
TechDaysNL 2015 - DDD with F#TechDaysNL 2015 - DDD with F#
TechDaysNL 2015 - DDD with F#
Ronald Harmsen902 views
Building scalable and language-independent Java services using Apache Thrift ... by IndicThreads
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...
IndicThreads772 views
Building scalable and language independent java services using apache thrift by Talentica Software
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thrift
Talentica Software1.9K views
TI1220 Lecture 14: Domain-Specific Languages by Eelco Visser
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser2K views
running Tensorflow in Production by Matthias Feys
running Tensorflow in Productionrunning Tensorflow in Production
running Tensorflow in Production
Matthias Feys4.2K views
[CLPE] Novidades do .net Framework 4.0 by Felipe Pimentel
[CLPE] Novidades do .net Framework 4.0[CLPE] Novidades do .net Framework 4.0
[CLPE] Novidades do .net Framework 4.0
Felipe Pimentel632 views
Functional Architecture - goto copenhagen 2012 by Phillip Trelford
Functional Architecture - goto copenhagen 2012Functional Architecture - goto copenhagen 2012
Functional Architecture - goto copenhagen 2012
Phillip Trelford1.6K views
Bay NET Aug 19 2009 presentation ppt by Art Scott
Bay  NET Aug 19 2009 presentation pptBay  NET Aug 19 2009 presentation ppt
Bay NET Aug 19 2009 presentation ppt
Art Scott777 views
Stream processing for the masses with beam, python and flink by Enrico Canzonieri
Stream processing for the masses with beam, python and flink Stream processing for the masses with beam, python and flink
Stream processing for the masses with beam, python and flink
Enrico Canzonieri388 views
FluentD for end to end monitoring by Phil Wilkins
FluentD for end to end monitoringFluentD for end to end monitoring
FluentD for end to end monitoring
Phil Wilkins1.1K views

More from Phillip Trelford

How to be a rock star developer by
How to be a rock star developerHow to be a rock star developer
How to be a rock star developerPhillip Trelford
880 views33 slides
Mobile F#un by
Mobile F#unMobile F#un
Mobile F#unPhillip Trelford
1.3K views36 slides
F# eXchange Keynote 2016 by
F# eXchange Keynote 2016F# eXchange Keynote 2016
F# eXchange Keynote 2016Phillip Trelford
591 views33 slides
FSharp eye for the Haskell guy - London 2015 by
FSharp eye for the Haskell guy - London 2015FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015Phillip Trelford
1.7K views35 slides
Beyond lists - Copenhagen 2015 by
Beyond lists - Copenhagen 2015Beyond lists - Copenhagen 2015
Beyond lists - Copenhagen 2015Phillip Trelford
1.4K views36 slides
F# for C# devs - Copenhagen .Net 2015 by
F# for C# devs - Copenhagen .Net 2015F# for C# devs - Copenhagen .Net 2015
F# for C# devs - Copenhagen .Net 2015Phillip Trelford
1K views31 slides

More from Phillip Trelford(20)

FSharp eye for the Haskell guy - London 2015 by Phillip Trelford
FSharp eye for the Haskell guy - London 2015FSharp eye for the Haskell guy - London 2015
FSharp eye for the Haskell guy - London 2015
Phillip Trelford1.7K views
Generative Art - Functional Vilnius 2015 by Phillip Trelford
Generative Art - Functional Vilnius 2015Generative Art - Functional Vilnius 2015
Generative Art - Functional Vilnius 2015
Phillip Trelford2.1K views
Building cross platform games with Xamarin - Birmingham 2015 by Phillip Trelford
Building cross platform games with Xamarin - Birmingham 2015Building cross platform games with Xamarin - Birmingham 2015
Building cross platform games with Xamarin - Birmingham 2015
Phillip Trelford841 views
Beyond Lists - Functional Kats Conf Dublin 2015 by Phillip Trelford
Beyond Lists - Functional Kats Conf Dublin 2015Beyond Lists - Functional Kats Conf Dublin 2015
Beyond Lists - Functional Kats Conf Dublin 2015
Phillip Trelford1.2K views
FSharp On The Desktop - Birmingham FP 2015 by Phillip Trelford
FSharp On The Desktop - Birmingham FP 2015FSharp On The Desktop - Birmingham FP 2015
FSharp On The Desktop - Birmingham FP 2015
Phillip Trelford1.7K views
Ready, steady, cross platform games - ProgNet 2015 by Phillip Trelford
Ready, steady, cross platform games - ProgNet 2015Ready, steady, cross platform games - ProgNet 2015
Ready, steady, cross platform games - ProgNet 2015
Phillip Trelford7.2K views
Build a compiler in 2hrs - NCrafts Paris 2015 by Phillip Trelford
Build a compiler in 2hrs -  NCrafts Paris 2015Build a compiler in 2hrs -  NCrafts Paris 2015
Build a compiler in 2hrs - NCrafts Paris 2015
Phillip Trelford2.3K views
24 Hours Later - NCrafts Paris 2015 by Phillip Trelford
24 Hours Later - NCrafts Paris 201524 Hours Later - NCrafts Paris 2015
24 Hours Later - NCrafts Paris 2015
Phillip Trelford1.5K views
Machine learning from disaster - GL.Net 2015 by Phillip Trelford
Machine learning from disaster  - GL.Net 2015Machine learning from disaster  - GL.Net 2015
Machine learning from disaster - GL.Net 2015
Phillip Trelford2.2K views

Recently uploaded

Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueShapeBlue
218 views20 slides
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericShapeBlue
130 views9 slides
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...ShapeBlue
161 views13 slides
Cencora Executive Symposium by
Cencora Executive SymposiumCencora Executive Symposium
Cencora Executive Symposiummarketingcommunicati21
159 views14 slides
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOsPriyanka Aash
158 views59 slides
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...ShapeBlue
166 views28 slides

Recently uploaded(20)

Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue218 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue130 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue161 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash158 views
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue166 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue203 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue263 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue198 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue139 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li85 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue238 views
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue138 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc170 views
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue194 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays56 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE79 views
State of the Union - Rohit Yadav - Apache CloudStack by ShapeBlue
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStack
ShapeBlue297 views

F# for Trading

  • 1. F# for Trading Phillip Trelford Trayport
  • 3. F# Language • Strongly Typed • Functional First • Object Orientated • Open Source • First Class .Net language • In Visual Studio
  • 6. Leverage • Existing code • Domain modelling • Computation • Concurrency • Libraries
  • 9. Thoughtworks Tech Radar March 2012 “F# is excellent at concisely expressing business and domain logic.” “Developers trying to achieve explicit business logic within an application may opt to express their domain in F# with the majority of plumbing code in C#.”
  • 10. Order – Record type type Order = { Side : Side LimitPrice : Price Quantity : Quantity IsAllOrNone : bool }
  • 11. Time in Force – Union type type TimeInForce = | Immediate | GoodForDay | GoodTillDate of DateTime
  • 13. Excel – Type Provider Excel Visual Studio
  • 14. F# for Computation • Standard F# tools ▫ F# language and core libraries • Workstation libraries ▫ Math.NET Numerics (open source) ▫ StatFactory FCore • Distributed libraries ▫ Microsoft Cloud Numerics ▫ Nessos {m}brace cloud
  • 16. R – Type Provider
  • 17. ShowDialog – Async workflows
  • 18. Rx notifications. BufferWithTimeOrCount( TimeSpan.FromSeconds(0.01), 50);
  • 19. MiniRx int closure = i; mouseMove .Select(e => e.GetPosition(canvas)) .Delay(closure * 100) .OnDispatcher() .Subscribe(pos => { Canvas.SetLeft(label, pos.X + closure * 10); Canvas.SetTop(label, pos.Y); });
  • 20. F# Agents – MailboxProcessor type Agent.Start (fun inbox -> async { while true do let! instruction = instruction.Receive() instruction |> market.Update |> notify } )
  • 21. The future – {m}brace the cloud • Programming model that looks sequential but executes distributed ▫ async { } ▫… ▫ cloud { }
  • 22. .Net 4.5 Garbage Collector Latency Mode Application Scenarios Batch Command line Server Side Interactive LOB applications LowLatency Trading Screens SustainedLowLatency Financial Applications
  • 23. Meet the F#ers @rickasaurus @tomaspetricek @dmohl
  • 25. Questions? Me F# Twitter: @ptrelford Twitter: #fsharp Feed: http://trelford.com/blog Feed: http://fpound.net

Editor's Notes

  1. F# - not explicitly built for trading butBased on Ocaml which Janes St & others have been using for over a decadeEarly adopters in trading community Credit Suisse, E-OnF# community dominated by finance, insurance
  2. Community MattersPython PrincipleEarly adopters = Traders > DevelopersExcelF#Hedge FundsBanks IT Departments are ConservativeLanguage/Tool approve listRunning VS2005/2008 (via phone interviews)Credit Suisse, Trafigura, BarCap
  3. Leverage