# codefinance.training

Coding for Finance

# Financial Modeling

### Financial Modeling

Financial modeling is the task of building an abstract representation (a model) of a real world financial situation.[1] This is a mathematical model designed to represent (a simplified version of) the performance of a financial asset or portfolio of a business, project, or any other investment.

Typically, then, financial modeling is understood to mean an exercise in either asset pricing or corporate finance, of a quantitative nature. It is about translating a set of hypotheses about the behavior of markets or agents into numerical predictions.[2] At the same time, "financial modeling" is a general term that means different things to different users; the reference usually relates either to accounting and corporate finance applications or to quantitative finance applications.

## Accounting

In corporate finance and the accounting profession, financial modeling typically entails financial statement forecasting; usually the preparation of detailed company-specific models used for decision making purposes[1] and financial analysis.

Applications include:

To generalize [citation needed] as to the nature of these models: firstly, as they are built around financial statements, calculations and outputs are monthly, quarterly or annual; secondly, the inputs take the form of "assumptions", where the analyst specifies the values that will apply in each period for external / global variables (exchange rates, tax percentage, etc....; may be thought of as the model parameters), and for internal / company specific variables (wages, unit costs, etc....). Correspondingly, both characteristics are reflected (at least implicitly) in the mathematical form of these models: firstly, the models are in discrete time; secondly, they are deterministic. For discussion of the issues that may arise, see below; for discussion as to more sophisticated approaches sometimes employed, see Corporate finance § Quantifying uncertainty and Financial economics § Corporate finance theory.

Modelers are often designated "financial analyst" (and are sometimes referred to, tongue in cheek, as "number crunchers"). Typically,[6] the modeler will have completed an MBA or MSF with (optional) coursework in "financial modeling".[7] Accounting qualifications and finance certifications such as the CIIA and CFA generally do not provide direct or explicit training in modeling.[8] At the same time, numerous commercial training courses are offered, both through universities and privately. For the components and steps of business modeling here, see Outline of finance § Financial modeling; see also Valuation using discounted cash flows § Determine cash flow for each forecast period for further discussion and considerations.

Although purpose-built business software does exist, the vast proportion of the market is spreadsheet-based; this is largely since the models are almost always company-specific. Also, analysts will each have their own criteria and methods for financial modeling.[9] Microsoft Excel now has by far the dominant position, having overtaken Lotus 1-2-3 in the 1990s. Spreadsheet-based modelling can have its own problems,[10] and several standardizations and "best practices" have been proposed.[11] "Spreadsheet risk" is increasingly studied and managed;[11] see model audit.

One critique here, is that model outputs, i.e. line items, often inhere "unrealistic implicit assumptions" and "internal inconsistencies".[12] (For example, a forecast for growth in revenue but without corresponding increases in working capital, fixed assets and the associated financing, may imbed unrealistic assumptions about asset turnover, debt level and/or equity financing. See Sustainable growth rate § From a financial perspective.) What is required, but often lacking, is that all key elements are explicitly and consistently forecasted. Related to this, is that modellers often additionally "fail to identify crucial assumptions" relating to inputs, "and to explore what can go wrong".[13] Here, in general, modellers "use point values and simple arithmetic instead of probability distributions and statistical measures"[14] — i.e., as mentioned, the problems are treated as deterministic in nature — and thus calculate a single value for the asset or project, but without providing information on the range, variance and sensitivity of outcomes;[15] see Valuation using discounted cash flows § Determine equity value. A further, more general critique relates to the lack of basic computer programming concepts amongst modelers, [16] with the result that their models are often poorly structured, and difficult to maintain. Serious criticism is also directed at the nature of budgeting, and its impact on the organization.[17][18]

## Quantitative finance

In quantitative finance, financial modeling entails the development of a sophisticated mathematical model.[19] Models here deal with asset prices, market movements, portfolio returns and the like. A general distinction [citation needed] is between: (i) "quantitative asset pricing", models of the returns of different stocks; (ii) "financial engineering", models of the price or returns of derivative securities; (iii) "quantitative portfolio management", models underpinning automated trading, high-frequency trading, algorithmic trading, and program trading.

Relatedly, applications include:

These problems are generally stochastic and continuous in nature, and models here thus require complex algorithms, entailing computer simulation, advanced numerical methods (such as numerical differential equations, numerical linear algebra, dynamic programming) and/or the development of optimization models. The general nature of these problems is discussed under Mathematical finance § History: Q versus P, while specific techniques are listed under Outline of finance § Mathematical tools. For further discussion here see also: Brownian model of financial markets; Martingale pricing; Financial models with long-tailed distributions and volatility clustering; Extreme value theory; Historical simulation (finance).

Modellers are generally referred to as "quants", i.e. quantitative analysts, and typically have advanced (Ph.D. level) backgrounds in quantitative disciplines such as statistics, physics, engineering, computer science, mathematics or operations research. Alternatively, or in addition to their quantitative background, they complete a finance masters with a quantitative orientation,[23] such as the Master of Quantitative Finance, or the more specialized Master of Computational Finance or Master of Financial Engineering; the CQF certificate is increasingly common.

Although spreadsheets are widely used here also (almost always requiring extensive VBA); custom C++, Fortran or Python, or numerical-analysis software such as MATLAB, are often preferred,[23] particularly where stability or speed is a concern. MATLAB is often used at the research or prototyping stage [citation needed] because of its intuitive programming, graphical and debugging tools, but C++/Fortran are preferred for conceptually simple but high computational-cost applications where MATLAB is too slow; Python is increasingly used due to its simplicity, and large standard library / available applications, including QuantLib. Additionally, for many (of the standard) derivative and portfolio applications, commercial software is available, and the choice as to whether the model is to be developed in-house, or whether existing products are to be deployed, will depend on the problem in question.[23] See Quantitative analysis (finance) § Library quantitative analysis.

The complexity of these models may result in incorrect pricing or hedging or both. This Model risk is the subject of ongoing research by finance academics, and is a topic of great, and growing, interest in the risk management arena.[24]

Criticism of the discipline (often preceding the financial crisis of 2007–08 by several years) emphasizes the differences between the mathematical and physical sciences, and finance, and the resultant caution to be applied by modelers, and by traders and risk managers using their models. Notable here are Emanuel Derman and Paul Wilmott, authors of the Financial Modelers' Manifesto. Some go further and question whether the mathematical- and statistical modeling techniques usually applied to finance are at all appropriate (see the assumptions made for options and for portfolios). In fact, these may go so far as to question the "empirical and scientific validity... of modern financial theory".[25] Notable here are Nassim Taleb and Benoit Mandelbrot.[26] See also Mathematical finance § Criticism, Financial economics § Challenges and criticism and Financial engineering § Criticisms.

## Competitive modeling

Several financial modeling competitions exist, emphasizing speed and accuracy in modeling. The Microsoft-sponsored ModelOff Financial Modeling World Championships were held annually from 2012 to 2019, with competitions throughout the year and a finals championship in New York or London. After its end in 2020, several other modeling championships have been started, including the Financial Modeling World Cup and Microsoft Excel Collegiate Challenge, also sponsored by Microsoft.[6]

## Philosophy of financial modeling

Philosophy of financial modeling is a branch of philosophy concerned with the foundations, methods, and implications of modeling science.

In the philosophy of financial modeling, scholars have more recently begun to question the generally-held assumption that financial modelers seek to represent any "real-world" or actually ongoing investment situation. Instead, it has been suggested that the task of the financial modeler resides in demonstrating the possibility of a transaction in a prospective investment scenario, from a limited base of possibility conditions initially assumed in the model.[27]

## References

1. ^ a b Investopedia Staff (2020). "Financial Modeling".
2. ^ Low, R.K.Y.; Tan, E. (2016). "The Role of Analysts' Forecasts in the Momentum Effect" (PDF). International Review of Financial Analysis. 48: 67–84. doi:10.1016/j.irfa.2016.09.007.
3. ^ Joel G. Siegel; Jae K. Shim; Stephen Hartman (1 November 1997). Schaum's quick guide to business formulas: 201 decision-making tools for business, finance, and accounting students. McGraw-Hill Professional. ISBN 978-0-07-058031-2. Retrieved 12 November 2011. §39 "Corporate Planning Models". See also, §294 "Simulation Model".
4. ^ See for example: "Renewable Energy Financial Model". Renewables Valuation Institute. Retrieved 2023-03-19.
5. ^ Confidential disclosure of a financial model is often requested by purchasing organizations undertaking public sector procurement in order that the government department can understand and if necessary challenge the pricing principles which underlie a bidder's costs. E.g. First-tier Tribunal, Department for Works and Pensions v. Information Commissioner, UKFTT EA_2010_0073, paragraph 58, decided 20 September 2010, accessed 11 January 2024
6. ^ a b Fairhurst, Danielle Stein (2022). Financial Modeling in Excel for Dummies. John Wiley & Sons. ISBN 978-1-119-84451-8. OCLC 1264716849.
7. ^ Example course: Financial Modelling, University of South Australia
8. ^ The MiF can offer an edge over the CFA Financial Times, June 21, 2015.
9. ^ See for example, Valuing Companies by Cash Flow Discounting: Ten Methods and Nine Theories, Pablo Fernandez: University of Navarra - IESE Business School
10. ^ Danielle Stein Fairhurst (2009). Six reasons your spreadsheet is NOT a financial model Archived 2010-04-07 at the Wayback Machine, fimodo.com
11. ^ a b Best Practice Archived 2018-03-29 at the Wayback Machine, European Spreadsheet Risks Interest Group
12. ^ Krishna G. Palepu; Paul M. Healy; Erik Peek; Victor Lewis Bernard (2007). Business analysis and valuation: text and cases. Cengage Learning EMEA. pp. 261–. ISBN 978-1-84480-492-4. Retrieved 12 November 2011.
13. ^ Richard A. Brealey; Stewart C. Myers; Brattle Group (2003). Capital investment and valuation. McGraw-Hill Professional. pp. 223–. ISBN 978-0-07-138377-6. Retrieved 12 November 2011.
14. ^
15. ^ Prof. Aswath Damodaran. Probabilistic Approaches: Scenario Analysis, Decision Trees and Simulations, NYU Stern Working Paper
16. ^ Blayney, P. (2009). Knowledge Gap? Accounting Practitioners Lacking Computer Programming Concepts as Essential Knowledge. In G. Siemens & C. Fulford (Eds.), Proceedings of World Conference on Educational Multimedia, Hypermedia and Telecommunications 2009 (pp. 151-159). Chesapeake, VA: AACE.
17. ^ Loren Gary (2003). Why Budgeting Kills Your Company, Harvard Management Update, May 2003.
18. ^ Michael Jensen (2001). Corporate Budgeting Is Broken, Let's Fix It, Harvard Business Review, pp. 94-101, November 2001.
19. ^ See discussion here: "Careers in Applied Mathematics" (PDF). Society for Industrial and Applied Mathematics. Archived (PDF) from the original on 2019-03-05.
20. ^ See for example: Low, R.K.Y.; Faff, R.; Aas, K. (2016). "Enhancing mean–variance portfolio selection by modeling distributional asymmetries" (PDF). Journal of Economics and Business. 85: 49–72. doi:10.1016/j.jeconbus.2016.01.003.; Low, R.K.Y.; Alcock, J.; Faff, R.; Brailsford, T. (2013). "Canonical vine copulas in the context of modern portfolio management: Are they worth it?" (PDF). Journal of Banking & Finance. 37 (8): 3085–3099. doi:10.1016/j.jbankfin.2013.02.036. S2CID 154138333.
21. ^ See David Shimko (2009). Quantifying Corporate Financial Risk. archived 2010-07-17.
22. ^ See for example this problem (from John Hull's Options, Futures, and Other Derivatives), discussing cash position modeled stochastically.
23. ^ a b c Mark S. Joshi, On Becoming a Quant Archived 2012-01-14 at the Wayback Machine.
24. ^
25. ^ Nassim Taleb (2009)."History Written By The Losers", Foreword to Pablo Triana's Lecturing Birds How to Fly ISBN 978-0470406755
26. ^ Nassim Taleb and Benoit Mandelbrot. "How the Finance Gurus Get Risk All Wrong" (PDF). Archived from the original (PDF) on 2010-12-07. Retrieved 2010-06-15.
27. ^ Mebius, A. (2023). "On the epistemic contribution of financial models". Journal of Economic Methodology. 30 (1): 49–62. doi:10.1080/1350178X.2023.2172447. S2CID 256438018.

## Bibliography

General

• Avon, Jack (2017). The Financial Modellers VBA Compendium. London: Begawans Veranda. ISBN 978-0-9956-7254-3.
• Benninga, Simon (1997). Financial Modeling. Cambridge, MA: MIT Press. ISBN 0-585-13223-2.
• Benninga, Simon (2006). Principles of Finance with Excel. New York: Oxford University Press. ISBN 0-19-530150-1.
• Fabozzi, Frank J. (2012). Encyclopedia of Financial Models. Hoboken, NJ: Wiley. ISBN 978-1-118-00673-3.
• Ho, Thomas; Sang Bin Lee (2004). The Oxford Guide to Financial Modeling. New York: Oxford University Press. ISBN 978-0-19-516962-1.
• Sengupta, Chandan (2009). Financial Analysis and Modeling Using Excel and VBA, 2nd Edition. Hoboken, NJ: John Wiley & Sons. ISBN 9780470275603.
• Winston, Wayne (2014). Microsoft Excel 2013 Data Analysis and Business Modeling. Microsoft Press. ISBN 978-0735669130.
• Yip, Henry (2005). Spreadsheet Applications to securities valuation and investment theories. John Wiley and Sons Australia Ltd. ISBN 0470807962.

Corporate finance

• Avon, Jack. (2021). The Handbook of Financial Modeling (2nd ed.). New York: Springer. doi:10.1007/978-1-4842-6540-6. ISBN 978-1-4842-6540-6. S2CID 227164870.
• Bastick, Liam (2020). Introduction to Financial Modeling. Wiley. ISBN 978-1615470662.
• Beech, G. and Thayser, D. (2015). Valuations, Mergers and Acquisitions. Oxford: Oxford University Press. ISBN 978-0-585-13223-5.`{{cite book}}`: CS1 maint: multiple names: authors list (link)
• Day, Alastair (2007). Mastering Financial Modelling in Microsoft Excel. London: Pearson Education. ISBN 978-0-273-70806-3.
• Fairhurst, Danielle (2022). Financial Modeling in Excel for Dummies. John Wiley & Sons. p. 120. ISBN 978-1-119-84451-8. OCLC 1264716849.
• Lynch, Penelope (1997). Financial Modelling for Project Finance, 2nd Edition. Euromoney Trading. ISBN 9781843745488.
• Mayes, Timothy R.; Shank, Todd M. (2014). Financial Analysis with Microsoft Excel (7th ed.). Boston: Cengage Learning. ISBN 978-1-285-43227-4.
• Peter K Nevitt; Frank J. Fabozzi (2000). Project Financing. Euromoney Institutional Investor PLC. ISBN 978-1-85564-791-6.
• Ongkrutaraksa, Worapot (2006). Financial Modeling and Analysis: A Spreadsheet Technique for Financial, Investment, and Risk Management, 2nd Edition. Frenchs Forest: Pearson Education Australia. ISBN 0-7339-8474-6.
• Palepu, Krishna G.; Paul M. Healy (2012). Business Analysis and Valuation Using Financial Statements, 5th Edition. Boston: South-Western College Publishing. ISBN 978-1111972288.
• Pignataro, Paul (2003). Financial Modeling and Valuation: A Practical Guide to Investment Banking and Private Equity. Hoboken, NJ: Wiley. ISBN 978-1118558768.
• Proctor, Scott (2009). Building Financial Models with Microsoft Excel: A Guide for Business Professionals, 2nd Edition. Hoboken, NJ: Wiley. ISBN 978-0-470-48174-5.
• Rees, Michael (2008). Financial Modelling in Practice: A Concise Guide for Intermediate and Advanced Level. Hoboken, NJ: Wiley. ISBN 978-0-470-99744-4.
• Rees, Michael (2023). The Essentials of Financial Modeling in Excel: A Concise Guide to Concepts and Methods. Hoboken, NJ: Wiley. ISBN 978-1394157785.
• Soubeiga, Eric (2013). Mastering Financial Modeling: A Professional's Guide to Building Financial Models in Excel. New York: McGraw-Hill. ISBN 978-0071808507.
• Swan, Jonathan (2007). Financial Modelling Special Report. London: Institute of Chartered Accountants in England & Wales.
• Swan, Jonathan (2008). Practical Financial Modelling, 2nd Edition. London: CIMA Publishing. ISBN 978-0-7506-8647-1.
• Tham, Joseph; Ignacio Velez-Pareja (2004). Principles of Cash Flow Valuation: An Integrated Market-Based Approach. Amsterdam: Elsevier. ISBN 0-12-686040-8.
• Tjia, John (2003). Building Financial Models. New York: McGraw-Hill. ISBN 0-07-140210-1.

Quantitative finance

• Hirsa, Ali (2013). Computational Methods in Finance. Boca Raton: CRC Press. ISBN 9781439829578.
• Brooks, Robert (2000). Building Financial Derivatives Applications with C++. Westport: Praeger. ISBN 978-1567202878.
• Brigo, Damiano; Fabio Mercurio (2006). Interest Rate Models - Theory and Practice with Smile, Inflation and Credit (2nd ed.). London: Springer Finance. ISBN 978-3-540-22149-4.
• Clewlow, Les; Chris Strickland (1998). Implementing Derivative Models. New Jersey: Wiley. ISBN 0-471-96651-7.
• Duffy, Daniel (2004). Financial Instrument Pricing Using C++. New Jersey: Wiley. ISBN 978-0470855096.
• Fabozzi, Frank J. (1998). Valuation of fixed income securities and derivatives, 3rd Edition. Hoboken, NJ: Wiley. ISBN 978-1-883249-25-0.
• Fabozzi, Frank J.; Sergio M. Focardi; Petter N. Kolm (2004). Financial Modeling of the Equity Market: From CAPM to Cointegration. Hoboken, NJ: Wiley. ISBN 0-471-69900-4.
• Shayne Fletcher; Christopher Gardner (2010). Financial Modelling in Python. John Wiley and Sons. ISBN 978-0-470-74789-6.
• Fusai, Gianluca; Andrea Roncoroni (2008). Implementing Models in Quantitative Finance: Methods and Cases. London: Springer Finance. ISBN 978-3-540-22348-1.
• Haug, Espen Gaarder (2007). The Complete Guide to Option Pricing Formulas, 2nd edition. McGraw-Hill. ISBN 978-0071389976.
• M. Henrard (2014). Interest Rate Modelling in the Multi-Curve Framework. Springer. ISBN 978-1137374653.
• Hilpisch, Yves (2015). Derivatives Analytics with Python: Data Analysis, Models, Simulation, Calibration and Hedging. New Jersey: Wiley. ISBN 978-1-119-03799-6.
• Jackson, Mary; Mike Staunton (2001). Advanced modelling in finance using Excel and VBA. New Jersey: Wiley. ISBN 0-471-49922-6.
• Jondeau, Eric; Ser-Huang Poon; Michael Rockinger (2007). Financial Modeling Under Non-Gaussian Distributions. London: Springer. ISBN 978-1849965996.
• Joerg Kienitz; Daniel Wetterau (2012). Financial Modelling: Theory, Implementation and Practice with MATLAB Source. Hoboken, NJ: Wiley. ISBN 978-0470744895.
• Kwok, Yue-Kuen (2008). Mathematical Models of Financial Derivatives, 2nd edition. London: Springer Finance. ISBN 978-3540422884.
• Levy, George (2004). Computational Finance: Numerical Methods for Pricing Financial Instruments. Butterworth-Heinemann. ISBN 978-0750657228.
• London, Justin (2004). Modeling Derivatives in C++. New Jersey: Wiley. ISBN 978-0471654643.
• Löeffler, G; Posch, P. (2011). Credit Risk Modeling using Excel and VBA. Hoboken, NJ: Wiley. ISBN 978-0470660928.
• Rouah, Fabrice Douglas; Gregory Vainberg (2007). Option Pricing Models and Volatility Using Excel-VBA. New Jersey: Wiley. ISBN 978-0471794646.
• Antoine Savine and Jesper Andreasen (2018). Modern Computational Finance: Scripting for Derivatives and xVA. Wiley. ISBN 978-1119540786.
• Alexander Sokol (2014). Long-Term Portfolio Simulation - For XVA, Limits, Liquidity and Regulatory Capital. Risk Books. ISBN 978-1782720959.
• Charles Tapiero (2004). Risk and Financial Management: Mathematical and Computational Methods. John Wiley & Son. ISBN 0-470-84908-8.
• Humphrey Tung; Donny Lai; Michael Wong; Stephen Ng (2010). Professional Financial Computing Using Excel and VBA. John Wiley & Sons. ISBN 9780470824399.

Create and Implement Mathematical Models in C++ using Quantitative Finance.

Alonso Peña -
If you are a quantitative analyst, risk manager, actuary, or a professional working in the field of quantitative finance and want a quick hands-on introduction to the pricing of financial derivatives, this book is ideal for you.

Implementing QuantLib:
Quantitative finance in C++: An inside look at the architecture of the QuantLib library

- Luigi Ballabio
This book is a report on the design and implementation of the QuantLib Library for C++

QuantLib Python Cookbook:
Quantitative finance in Python.

Goutham Balaraman and - Luigi Ballabio
A hands-on, interactive look at the QuantLib library through the use of Jupyter notebooks as working examples.

Reproducible Finance with R:
Code Flows and Shiny Apps for Portfolio Analysis

Jonathan K. Regenstein Jr. -
A unique introduction to data science for investment management.

Stochastic Simulation and Applications in Finance with MATLAB Programs:
Huu Tue Huynh, Van Son Lai, Issouf Soumare -
Stochastic Simulation and Applications in Finance with MATLAB Programs explains the fundamentals of Monte Carlo simulation techniques, their use in the numerical resolution of stochastic differential equations and their current applications in finance.

The Heston Model and its Extensions in Matlab and C#:
Fabrice D. Rouah, with Foreword by Steven L. Heston -
Tap into the power of the most popular stochastic volatility model for pricing equity derivatives.

Mastering Python for Finance:
Implement advanced state-of-the-art financial statistical applications using Python, 2nd Edition

James Ma Weiming -

Financial Modelling: Theory, Implementation and Practice with MATLAB Source:
Daniel Wetterau - Jörg Kienitz
A unique contribution to the application of quantitative techniques to financial problems and programming using Matlab.

Quantitative Research and Platform Development

Chris Conlan -
Automated Trading with R explains automated trading, starting with its mathematics and moving to its computation and execution.

Quantitative Finance (Statistics in Practice):
Maria C. Mariani and Ionut Florescu -
This book presents quantitative finance theory through applications to specific practical problems and comes with accompanying coding techniques in R and MATLAB.

Quantitative finance with R and cryptocurrencies:
Dean Fantazzini -
The aim of this book is to provide the necessary background to analyse cryptocurrencies markets and prices using quantitative techniques.

Quantitative Finance: An Object-Oriented Approach in C++:
Erik Schlögl -
Providing readers with a foundation in the key methods and models of quantitative finance. Keeping the material as self-contained as possible, the author introduces computational finance with a focus on practical implementation in C++.