codefinance.training

Coding for Finance

Quantitative Finance: An Object-Oriented Approach in C++

Quantitative Finance: An Object-Oriented Approach in C++ provides 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++.

Through an approach based on C++ classes and templates, the text highlights the basic principles common to various methods and models while the algorithmic implementation guides readers to a more thorough, hands-on understanding. By moving beyond a purely theoretical treatment to the actual implementation of the models using C++, readers greatly enhance their career opportunities in the field.

The book also helps readers implement models in a trading or research environment. It presents recipes and extensible code building blocks for some of the most widespread methods in risk management and option pricing.

The author provides fully functional C++ code, including additional C++ source files and examples which you can now download from codeFinance (zip file). The download also includes a suite of practical exercises for each chapter covering a range of difficulty levels and problem complexity.

Although the code is used to illustrate concepts as is not offered as a finished software product, it nevertheless compiles, runs, and deals with full, rather than toy, problems.

“… a comprehensive, dual-perspective introduction to quantitative finance methods. By providing implementation details alongside theory, Schlögl ensures that one is never overemphasized at the expense of the other. All of the code described is reusable and reliant on only a small number of external libraries, meaning that this book is an invaluable resource to students and professionals in the field alike.”
Computing Reviews, March 2015

 

“I recommend Erik Schlogl’s new book to all those interested in model implementation. From quasi-random sequences to HJM to the Excel interface, with full C++ code, there is something here for everyone.”
―Jim Gatheral, Presidential Professor, Baruch College, CUNY

 

“If 25 years ago I had started in finance using C instead of Visual Basic, perhaps now I might be approximating Prof. Schlogl’s balanced and professional C++ framework for pricing financial derivatives. From interacting with quants writing production code I have learnt that several years’ experience with C++ can be dangerous as the possibility of writing incomprehensible (to others) abstract code becomes attractive. In this respect Prof. Schlogl strikes just the right balance between using the full power of C++ to encapsulate, concentrate, and abstract code, while remaining comprehensible. His book thoroughly outlines a framework, including procedures and libraries, for constructing the various building blocks of pricing systems for financial derivatives. Users implementing his sort of framework can be confident their code will be understood, and that it can be maintained and revised without dating. It is one of the dozen or so books that ought to be on every financial quant’s bookshelf; if only I had had it earlier!”
―Alan Brace, Senior Quantitative Analyst in Market Risk, National Australia Bank, and Adjunct Professor, Quantitative Finance Research Centre, University Technology of Sydney

 

“While some view quantitative finance as just another playground for beautiful mathematical theories, it is ultimately a very practical discipline where one’s success is more often than not measured by the quality, speed, and accuracy of computer code written to solve real-world problems. Quantitative Finance: An Object-Oriented Approach in C++ embraces this pragmatic view wholeheartedly to great success. The three core competencies of a successful quant: firm grasp of theory, strong command of numerical methods, and software design and development skills are taught in parallel, inseparable in the book as they are in the real world. A fantastic resource for students looking to become quants, the book sets a standard on how practically relevant quantitative finance should be taught. Those already in the field will also no doubt learn a thing or two on how to represent common financial constructs as logical and reusable software components.”
―Vladimir V. Piterbarg, Head of Quantitative Analytics, Barclays

 

“Students and practitioners of quantitative analysis have long wanted a detailed exposition of computational finance that includes implementation details and quality C++ code. Their desires are no longer unrequited―this book contains a clear and careful discussion of many of the key derivatives pricing models together with object-oriented C++ code. Substantial discussion of the design choices made is also included. I believe that this book is destined to be part of every financial engineer’s toolkit.”
―Professor Mark Joshi, University of Melbourne

Relational Database Management Systems (RDBMS) In-Depth

Key Features

  • Practice SQL concepts by writing queries and perform your own data visualization and analysis.
  • Gain insights on Entity Relationship Model and how to implement in your business environment.
  • Series of question banks and case-studies to develop strong hold on RDBMS concepts.

Description

Relational Database Management Systems In-Depth brings the fundamental concepts of database management systems to you in more elaborated learning with conceptual clarity of RDBMS.

This book brings an extensive coverage of theoretical concepts on types of databases, concepts of relational database management systems, normalization and many more. You will explore exemplification of Entity Relational Model concepts that would teach the readers to design accurate business systems. Backed with a series of examples, you can practice the fundamental concepts of RDBMS and SQL queries including Oracle’s SQL queries, MySQL and SQL Server.

In addition to the illustration of concepts on SQL, there is an implementation of crucial business rules using PL/SQL based stored procedures and database triggers.Finally, by the end of this book there is a mention of the useful data oriented technologies like Big Data, Data Lake etc and the crucial role played by such techniques in the current data driven decisions.

Throughout the book, you will come across key learnings and key terms that will help you to understand and revise the concepts learned.

What you will learn

  • Depiction of Entity Relationship Model with various business case studies.
  • Illustration of the normalization concept to make the database stronger and consistent.
  • Designing the successful client-server applications using PL/SQL concepts.
  • Learning the concepts of OODBS and Database Design with Normalization and Relationships.

Who this book is for

This book is meant for academicians, students, developers and administrators including beginners and readers experienced in some other programming languages and database systems.

Table of Contents

1. Database Systems Architecture
2. Database Management System Models
3. Relational query languages
4. Relational Database Design
5. Query Processing and Optimization
6. Transaction Processing
7. Implementation Techniques
8. SQL Concepts
9. PL/SQL Concepts
10. Collections in PL/SQL
11. What Next?

Quantitative finance with R and cryptocurrencies

The main objective of this book is to provide the necessary background to analyze cryptocurrencies markets and prices. To this end, the book consists of three parts: the first one is devoted to cryptocurrencies markets and explains how to retrieve cryptocurrencies data, how to compute liquidity measures with these data, how to calculate bounds for Bitcoin (and cryptocurrencies) fundamental value and how competing exchanges contribute to the price discovery process in the Bitcoin market. The second part is devoted to time series analysis with cryptocurrencies and presents a large set of univariate and multivariate time series models, tests for financial bubbles and explosive price behavior, as well as univariate and multivariate volatility models. The third part focuses on risk and portfolio management with cryptocurrencies and shows how to measure and backtest market risk, how to build an optimal portfolio according to several approaches, how to compute the probability of closure/bankruptcy of a crypto-exchange, and how to compute the probability of death of crypto-assets.

All the proposed methods are accompanied by worked-out examples in R using the packages bitcoinFinance and bubble.

This book is intended for both undergraduate and graduate students in economics, finance and statistics, financial and IT professionals, researchers and anyone interested in cryptocurrencies financial modelling. Readers are assumed to have a background in statistics and financial econometrics, as well as a working knowledge of R software.

 

Note from the Author
Given the content which is full of R code and formulas, I strongly advise the reader to consider only the paper version of this book. The kindle version was created by compiling the original R-markdown/latex file into an epub file, where all formulas were transformed into figures. Unfortunately, the limitations of the epub format strongly decreased the quality of the final epub book compared to the original high-quality pdf file used for the paper version of the book. Despite these issues, several people asked me for a digital copy so there is one <a href=”https://amzn.to/2W3nzPx”>available here</a>.

Quantitative Finance (Statistics in Practice)

Written by expert teachers and researchers in the field, this book presents quantitative finance theory through applications to specific practical problems and comes with accompanying coding techniques in R and MATLAB, and some generic pseudo-algorithms to modern finance. It also offers over 300 examples and exercises that are appropriate for the beginning student as well as the practitioner in the field.

This title is divided into four parts. Part One begins by providing readers with the theoretical backdrop needed from probability and stochastic processes. We also present some useful finance concepts used throughout the book. In part two of the book we present the classical Black-Scholes-Merton model in a uniquely accessible and understandable way. Implied volatility as well as local volatility surfaces are also discussed. Next, solutions to Partial Differential Equations (PDE), wavelets and Fourier transforms are presented. Several methodologies for pricing options namely, tree methods, finite difference method and Monte Carlo simulation methods are also discussed. We conclude this part with a discussion on stochastic differential equations (SDE’s). In the third part of this book, several new and advanced models from current literature such as general Levy processes, nonlinear PDE’s for stochastic volatility models in a transaction fee market, PDE’s in a jump-diffusion with stochastic volatility models and factor and copulas models are discussed. In part four of the book, we conclude with a solid presentation of the typical topics in fixed income securities and derivatives. We discuss models for pricing bonds market, marketable securities, credit default swaps (CDS) and securitizations.

  • Classroom-tested over a three-year period with the input of students and experienced practitioners
  • Emphasizes the volatility of financial analyses and interpretations
  • Weaves theory with application throughout the book
  • Utilizes R and MATLAB software programs
  • Presents pseudo-algorithms for readers who do not have access to any particular programming system
  • Supplemented with extensive author-maintained web site that includes helpful teaching hints, data sets, software programs, and additional content

Quantitative Finance is an ideal textbook for upper-undergraduate and beginning graduate students in statistics, financial engineering, quantitative finance, and mathematical finance programs. It will also appeal to practitioners in the same fields.

Applied Quantitative Finance: Using Python for Financial Analysis

This book provides both conceptual knowledge of quantitative finance and a hands-on approach to using Python. It begins with a description of concepts prior to the application of Python with the purpose of understanding how to compute and interpret results. This book offers practical applications in the field of finance concerning Python, a language that is more and more relevant in the financial arena due to big data. This will lead to a better understanding of finance as it gives a descriptive process for students, academics and practitioners.

Options and Derivatives Programming in C++20

Master the features of C++ that are frequently used to write financial software for options and derivatives, including the STL, templates, functional programming, and numerical libraries. This book also covers new features introduced in C++20 and other recent standard releases: modules, concepts, spaceship operators, and smart pointers.

You will explore how-to examples covering all the major tools and concepts used to build working solutions for quantitative finance. These include advanced C++ concepts as well as the basic building libraries used by modern C++ developers, such as the STL and Boost, while also leveraging knowledge of object-oriented and template-based programming. Options and Derivatives Programming in C++ provides a great value for readers who are trying to use their current programming knowledge in order to become proficient in the style of programming used in large banks, hedge funds, and other investment institutions. The topics covered in the book are introduced in a logical and structured way and even novice programmers will be able to absorb the most important topics and competencies.

This book is written with the goal of reaching readers who need a concise, algorithms-based book, providing basic information through well-targeted examples and ready-to-use solutions. You will be able to directly apply the concepts and sample code to some of the most common problems faced in the analysis of options and derivative contracts.
You will:

  • Discover how C++ is used in the development of solutions for options and derivatives trading in the financial industry
  • Grasp the fundamental problems in options and derivatives trading
  • Converse intelligently about credit default swaps, Forex derivatives, and more
  • Implement valuation models and trading strategies
  • Build pricing algorithms around the Black-Sholes model, and also using the binomial and differential equations methods
  • Run quantitative finance algorithms using linear algebra techniques
  • Recognize and apply the most common design patterns used in options trading

 

Machine Learning for Risk Calculations: A Practitioner′s view

The computational demand of risk calculations in financial institutions has ballooned and shows no sign of stopping. It is no longer viable to simply add more computing power to deal with this increased demand. The solution? Algorithmic solutions based on deep learning and Chebyshev tensors represent a practical way to reduce costs while simultaneously increasing risk calculation capabilities. Deep Learning and Tensoring Risk Calculations: A Practitioner’s View provides an in-depth review of a number of algorithmic solutions and demonstrates how they can be used to overcome the massive computational burden of risk calculations in financial institutions.

This book will get you started by reviewing fundamental techniques, including deep learning and Chebyshev tensors. You’ll then discover algorithmic tools that, in combination with the fundamentals, deliver actual solutions to the real problems financial institutions encounter on a regular basis. Numerical tests and examples demonstrate how these solutions can be applied to practical problems, including XVA and Counterparty Credit Risk, IMM capital, PFE, VaR, FRTB, Dynamic Initial Margin, pricing function calibration, volatility surface parametrisation, portfolio optimisation and others. Finally, you’ll uncover the

benefits these techniques provide, the practicalities of implementing them, and the software which can be used.

  • Review the fundamentals of deep learning and Chebyshev tensors
  • Discover pioneering algorithmic techniques that can create new opportunities in complex risk calculation
  • Learn how to apply the solutions to a wide range of real-life risk calculations.
  • Download sample code used in the book, so you can follow along and experiment with your own calculations
  • Realize improved risk management whilst overcoming the burden of limited computational power

Quants, IT professionals, and financial risk managers will benefit from this practitioner-oriented approach to state-of-the-art risk calculation.

An Introduction for Statistical Learning (with R examples)

An Introduction to Statistical Learning provides an accessible overview of the field of statistical learning, an essential toolset for making sense of the vast and complex data sets that have emerged in fields ranging from biology to finance to marketing to astrophysics in the past twenty years. This book presents some of the most important modeling and prediction techniques, along with relevant applications. Topics include linear regression, classification, resampling methods, shrinkage approaches, tree-based methods, support vector machines, clustering, deep learning, survival analysis, multiple testing, and more. Color graphics and real-world examples are used to illustrate the methods presented. Since the goal of this textbook is to facilitate the use of these statistical learning techniques by practitioners in science, industry, and other fields, each chapter contains a tutorial on implementing the analyses and methods presented in R, an extremely popular open source statistical software platform.

Two of the authors co-wrote The Elements of Statistical Learning (Hastie, Tibshirani and Friedman, 2nd edition 2009), a popular reference book for statistics and machine learning researchers. An Introduction to Statistical Learning covers many of the same topics, but at a level accessible to a much broader audience. This book is targeted at statisticians and non-statisticians alike who wish to use cutting-edge statistical learning techniques to analyze their data. The text assumes only a previous course in linear regression and no knowledge of matrix algebra.

This Second Edition features new chapters on deep learning, survival analysis, and multiple testing, as well as expanded treatments of naïve Bayes, generalized linear models, Bayesian additive regression trees, and matrix completion. R code has been updated throughout to ensure compatibility.

Automated Trading with R

Learn to trade algorithmically with your existing brokerage, from data management, to strategy optimization, to order execution, using free and publicly available data. Connect to your brokerage’s API, and the source code is plug-and-play.

Automated Trading with R explains automated trading, starting with its mathematics and moving to its computation and execution. You will gain a unique insight into the mechanics and computational considerations taken in building a back-tester, strategy optimizer, and fully functional trading platform.

The platform built in this book can serve as a complete replacement for commercially available platforms used by retail traders and small funds. Software components are strictly decoupled and easily scalable, providing opportunity to substitute any data source, trading algorithm, or brokerage. This book will:

  • Provide a flexible alternative to common strategy automation frameworks, like Tradestation, Metatrader, and CQG, to small funds and retail traders
  • Offer an understanding of the internal mechanisms of an automated trading system
  • Standardize discussion and notation of real-world strategy optimization problems

What You Will Learn

  • Understand machine-learning criteria for statistical validity in the context of time-series
  • Optimize strategies, generate real-time trading decisions, and minimize computation time while programming an automated strategy in R and using its package library
  • Best simulate strategy performance in its specific use case to derive accurate performance estimates
  • Understand critical real-world variables pertaining to portfolio management and performance assessment, including latency, drawdowns, varying trade size, portfolio growth, and penalization of unused capital

Who This Book Is For

Traders/practitioners at the retail or small fund level with at least an undergraduate background in finance or computer science; graduate level finance or data science students

Computational Finance Using C and C#: Derivatives and Valuation

Computational Finance Using C and C#: Derivatives and Valuation, Second Edition provides derivatives pricing information for equity derivatives, interest rate derivatives, foreign exchange derivatives, and credit derivatives. By providing free access to code from a variety of computer languages, such as Visual Basic/Excel, C++, C, and C#, it gives readers stand-alone examples that they can explore before delving into creating their own applications. It is written for readers with backgrounds in basic calculus, linear algebra, and probability. Strong on mathematical theory, this second edition helps empower readers to solve their own problems.

  • Features new programming problems, examples, and exercises for each chapter.
  • Includes freely-accessible source code in languages such as C, C++, VBA, C#, and Excel.
  • Includes a new chapter on the history of finance which also covers the 2008 credit crisis and the use of mortgage backed securities, CDSs and CDOs.
  • Emphasizes mathematical theory.

“I recommend this book to anyone who needs a strong reference on the computational aspects of financial calculations. The reader will find not only all the relevant computer codes in Visual Basic/Excel, C++, C, and C#, but also the required theory for a better understanding of financial concepts.” —Francois-Eric Racicot, University of Ottawa

“This is a book with equal coverage of financial mathematics, derivatives, and computer programming. It will be a welcome addition to any student’s or practitioner’s library.” —Yuh-Dauh Lyuu, National Taiwan University

“The use of derivatives for hedging possible finance risks became extremely popular due to the globalisation of international trade. This book provides for readers interesting linkage of theoretical background for valuation of all types of derivatives with their practical impact. Professional valuers would appreciate the 8th chapter dealing with C# portfolio pricing app. Very topical is the last chapter dealing with 2008 credit crisis. I would like to strongly recommend this book for publishing.” — Jiri Strouhal, University of Economics Prague and President of Association of Czech Professional Accountants