1 / 21

F# - An Introduction Under an Application of Quantitative Finance

F# - An Introduction Under an Application of Quantitative Finance. Christopher J. Barwick a.k.a. optionsScalper http://www.jjbresearch.org.acs/blogs/optionsScalper Affiliated with: www.ironwake.com www.syslogicinc.com http://www.wi-ineta.org JJB Research. Disclaimer.

ita
Download Presentation

F# - An Introduction Under an Application of Quantitative Finance

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. F# - An Introduction Under an Application of Quantitative Finance Christopher J. Barwick a.k.a. optionsScalper http://www.jjbresearch.org.acs/blogs/optionsScalper Affiliated with: www.ironwake.com www.syslogicinc.com http://www.wi-ineta.org JJB Research

  2. Disclaimer • I’m not licensed (brokerage, trading, etc.) in any capital markets. This is by choice. • I’m not a CFA, CFP or other professional. • This information is not a recommendation to purchase or sell securities. • The target audience for this presentation is the .NET developer, not capital markets professionals nor investors with capital in search of investment ideas.

  3. Purpose • To provide a sample perspective on the use of technology in capital markets. • To apply a few common techniques in capital markets to everyday situations. • To use .NET to implement these ideas and in particular to leverage F# as the language for mathematics computation.

  4. What to expect • This material is dense, fast-paced, has some non-everyday mathematics (that the typical .NET developer usually avoids) and covers a few disciplines. Be patient. • Because focus is important, we’ll take two breaks, so that the level of concentration and intensity can be maintained for the entire session. • Questions are encouraged throughout this presentation, but in-depth questions will be deferred until the end as time permits.

  5. What is F#? • F# is a .NET research language from Microsoft Research - Cambridge. • F# is a language that allows for functional and imperative programming models. • F# is CLS compliant, i.e. it plays well with others in .NET. • F# has ancestry in languages that have a rich history in mathematics and logics and in particular automated proof assistance.

  6. What are the origins of F#? • A group of computer scientists at Microsoft Research – Cambridge, led by Dr. Don Syme (one of the original champions of Generics in .NET). • F# is a derivative and sibling of the ML and OCaml languages. • ML and OCaml libraries from standard distributions are included.

  7. Some example F# • // strongly typed with type inference • let car1Year = 1995 (* assignment *) • let car1Make = "Ford" • let car1Model = "Taurus" • let car1Tuple = (car1Year, car1Make, car1Model) (* tuple assignment *) • let car2Year = 2005 • let car2Make = "Pontiac" • let car2Model = "G6" • let car2Tuple = (car2Year, car2Make, car2Model) (* tuple assignment *) • let carYearList = [ car1Year; car2Year ] (* list assignment *) • let carList = [ car1Tuple; car2Tuple ] (* a list of tuples *) • // function assignment using conditional • let age x = if (x < 2000) then "old" else "new“ • // function to extract a value from a tuple • let giveYearOfCar (x, _, _) = x;; • // Check the age • let car1Age = age(car1Year) • let car1AgeAlt = age(giveYearOfCar(car1Tuple))

  8. What is Quantitative Finance? • Quantitative Finance is finance “by the numbers”. • QF is applied mathematics as practiced in capital markets. • QF has many disciplines that are separated either by asset class (stocks, bonds, currencies, etc.) or by style (optimization, PDEs, volatility, etc.) or some combination (hedge, convertible arbitrage, etc.)

  9. Our Example Application • Use of the Sharpe Ratio – A reactive data mining perspective. • We will look at a few ETFs (Exchange Traded Funds). • We will compare our qualitative “feel” to a quantitative view. • Note that we are going to walk through how to construct the Sharpe Ratio in F#.

  10. We will not consider (for simplicity): • Efficient Market Hypothesis (and theory) • Rational Pricing Mechanics • Derivatives and other higher-order instruments (futures, options, swaps, exotics, etc.) • Dude, keep this simple . . .

  11. But we need some nomenclature • Market – Place of trading (physical or electronic). • Instrument – Something that can be traded, e.g. a stock, a mutual fund, a bond, an ETF, etc. • Index – A measure of a market, usually as a composite of instruments in that market. • ETF – Exchange Traded Fund. An instrument, representing a company, that provides for returns that are the same as a particular index.

  12. . . . and a few more terms • Interval – Period of time of interest. • View – A perspective about an instrument. • Horizon – An interval for a view. • Benchmark – A measure of comparison. • Cash – money, dough, moola, coin, bread, cabbage, green, jack, scratch (can be traded for bling).

  13. Our Best Friend: The Time Series • We need observations of our data. • Prices in capital markets are associated with a point in time. • Instruments have open, high, low, close prices and volumes for a given interval (day). • We’ll use an F# list of tuples to work with this data.

  14. Time Series • We will use regular time series, i.e. daily observations. • Irregular intervals are introduced because of market holidays. We’ll ignore those.

  15. Our Tool: Sharpe Ratio • Named for William F. Sharpe (I’m not making this up, F# -- William F. Sharpe) • Measures the risk adjusted return, i.e. “how much return per unit risk” • Used in both forecast model measurement (ex-ante) and asset measurement (ex-post) • Warning, MATH on the next slide.

  16. Ex-Post Sharpe Ratio Math • We will use the “Ex-Post Sharpe Ratio”, i.e. we are studying something we know from the past. • RFt is our ETF return • RBt is the riskfree rate of return (T-Bills) • T is the number of intervals in a study • S is the Sharpe Ratio (bigger is better)

  17. Get out your helmets, we’re going data mining. • We’re going to look at some F# that implements some of the functionality of the Sharpe Ratio • Keep in mind that this is not functional code, i.e. a considerable amount of data is needed to calculate.

  18. Acknowledgements • Dr. Don Syme and Matt Terski – Gave commentary and review of this work in early stages. • Thank you to both of you for your time and efforts. • All revisions and errors are obviously mine alone.

  19. F# References • The F# page – http://research.microsoft.com/projects/fsharp • Dr. Syme’s Blog – http://blogs.msdn.com/dsyme/default.aspx • F# Wiki – http://www.strangelights.com/fsharp/Wiki • Many other resources on the above pages and on my blogroll. • I’m sure that there will be many more to come.

  20. QF References • William F. Sharpe’s web page: http://www.stanford.edu/~wfsharpe/art/sr/sr.htm • Most QF books on the market focus on the capital markets professional, so I’ll reserve comment. • But for those that need overviews of markets, one of these two are great: • Fabozzi, Modigliani, Ferri and Jones – “Foundations of Capital Markets and Institutions (3rd Edition)”, Prentice Hall, 2002 • Fabozzi, Modigliani – “Capital Markets: Institutions and Instruments (3rd Edition)”, Prentice Hall, 2002

  21. Contact me • “chris (( at )) ironwake.com” – My startup software firm (with other partners). • “cbarwick (( at )) syslogicinc.com” - I’m engaged in consulting activities through SysLogic, Inc. • “os (( at )) jjbresearch.org” - I run JJB Research • http://www.jjbresearch.org/acs/blogs/optionsScalper - my blog • I’ve misplaced my other affiliations. If you find them, let me know.

More Related