Book Image

Mastering R for Quantitative Finance

Book Image

Mastering R for Quantitative Finance

Overview of this book

Table of Contents (20 chapters)
Mastering R for Quantitative Finance
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Liquidity risk measurement


Traditional liquidity risk measurement tools are the so-called static and dynamic liquidity gap tables. A liquidity gap table gives a cash-flow view of the balance sheet, and organizes the balance sheet items according to their contractual cash-inflows and cash-outflows into maturity buckets. The net cash-flow gap in each bucket shows the bank structural liquidity position. The static view assumes a rundown balance sheet while the dynamic liquidity table also takes into account the cash-flows from rollovers and new businesses. For the sake of simplicity, we demonstrate here only the static view of the liquidity positions.

Starting with the preparation of daily cash-flow positions. Sometimes, we need to know what the forecasted liquidity position is on a given date. It is easy to aggregate the cashflow.table by date.

head(aggregate(. ~ date, FUN = sum, data = subset(cashflow.table,select = -c(id, account))))
        date            cf    interest    capital remaining...