fundManageR — R’s Investment Management Toolkit
Because the Industry Must Liberate Itself from the Chains of Excel
What is fundManageR?
Outside of a few isolated pockets, the participants in the $67,0000,000,000 + United States investment management are trapped in Excel-centric universe. This is a dangerous state of being
Whether you are talking about Private Equity, Venture Capital, Real Estate Private Equity or Hedge Funds, industry professionals are executing important business functions dangerously and inefficiently through a maze of Excel spreadsheets.
The purpose of this package is to provide R proficient industry professionals a generalized framework that provides out-of-the-box access to functions that perform many standardizable industry pertinent calculations.
As an added bonus this package also wraps access to a growing array of data silos, including the first full wrapper of the SEC’s Investment Adviser Public Disclosure database in any of the major programming languages. It’s my hope that this package’s data acquisition functionality will be of use to industry professionals, academics, journalists, or anyone who enjoys exploring interesting data sets.
Excel, while convenient for some, is poorly suited for important data analysis and modelling. Billions of dollars have been lost throughout the investment management universe as a direct result of uncaught Excel errors. Here are few examples:
- Spreadsheet Errors Costing Business Billions, a CNBC Exploration
- Spreadsheet Mistake Costs Tibco Shareholders $100 Million
- The $400 Million Mistake at Lazard: Solarcity “Undervalued” in Tesla Purchase
- Eight of the Worst Spreadsheet Blunders
- ASB ALLEGIANCE REAL ESTATE FUND vs SCION
- warning, PDF file of a lawsuit.
- Did an Excel error bring down the London Whale?
Further more, for many of the most common calculations, there is countless duplication of methods to perform common calculations, and in many cases formulas are left unchecked and errors end up having extreme consequences down the line.
Though in its extreme infancy,
fundManageR is my attempt to provide an
easy to use framework for these calculations to be performed in R,
through an open and readable API, consistent with Hadley
manifesto. These calculations have fault checks to ensure accuracy and
designed for iteration which allows for complex calculations that Excel
would be unable to execute.
The package’s other motive is to provide easy access to the financial
industry’s dark data,
hidden and public APIs. This should enable better transparency around
one of the United States’ most vital industries. As the old saying goes,
when in doubt
Follow the Money,
help to do this.
In order for this package to work you need the packages listed below must be installed. You can run the code snippet to install them if necessary.
pdftools you may need to follow the installation instructions
packages <- c("curl", "curlconverter", "dplyr", "formattable", "httr", "jsonlite", 'devtools', "lazyeval", "lubridate", "magrittr", "pdftools", "purrr", "readr", 'quantmod', "readxl", "rvest", "stringi", "stringr", "tibble", "tidyr", 'tidyverse', "xml2") lapply(packages, install.packages)
fundManageR is built around 2 full function families and another with
1 usable, but powerful, with many more on the way.
calculate_– this function family performs common industry specific and generalized calculations.
get_data_– this function family retrieves data either from a specified silo or based upon user inputs.
visualize_– this function family performs pre-packaged visualizations geared towards the data this package brings in or helps the user to create.
calculate_cash_flow_dates– Calculates summary cash flows for a specified dates and cash flows
calculate_irr_periods– Calculates interal rate of return for specified dates and cash flows
calculate_cash_flows_returns– Calculates investment returns for specified dates and cash flows
calculate_cash_flow_waterfall– Calculates a cash flow waterfall given specified dates, cash flows and promote structure
calculate_cash_flow_waterfall_partnership– Calculates partnership level returns and waterfall given specified equity splits, promote structure, and cash flows.
calculate_loan_payment– Calculates loan repayment data given specified parameters
calculate_residual_valuation_ebitda_multiples– Calculates residual values given specified EBITDA and EBITDA Multiples
calculate_residual_valuation_cap_rates– Calculates residual value given specified Net Operating Income and Capitalization Rates
calculate_leverage_metrics– Caluclates crude leveraged cash flow metrics for a given set of inputs. Ideal for back of the envelope type calculations of a potential leveraged asset purchase.
calculate_valuation_post_money– Calculates entity ownership post investment
calculate_days_accrued_pref– Calculates accrued preference/interest for a specified period.
get_data_ycombinator_alumni– Retrieves data on YCombinator graduates.
get_data_libor_current–Retrieves most recent LIBOR by duration.
get_data_promote_structure– Returns a carried/promoted interest given promote syntax.
get_data_fred_index_symbol_time_series– Retrieves time series data for specified index from the FRED Database.
get_data_index_symbol_current_value– Retrieves current value for a specified symbol.
get_data_cik_codes– Retrieves all entities with a registered Central Index Key.
get_data_adv_period_urls– Retrieves all possible ADV summary periods.
get_data_adv_managers_current_period_summary– Retrieves summary data for ADV filing managers from the most recent monthly filing period.
get_data_adv_managers_periods_summaries– Retrieves summary ADV filings for specified periods and filing type. By default the files will be saved to and loaded from a temporary directory however a user can override this default by specifying a file directory. If you specify a file directory you can also specify folder name, if you don’t do this the folder
adv_datais created by default. You can also tell the function to delete the folders and empty the trash by setting
get_data_sec_adv_manager_sitemap– Retrieves a data frame with the possible detailed ADV sections and their descriptions.
get_data_adv_managers_metadata– Retrieves metadata for specified search name or CRD ID; fastest way to search for managers you may wish to explore further.
get_data_adv_managers_filings– Retrieves detailed ADV filing for specified Central Registration Depository ID [CRD] and/or company name by by specified ADV section.
get_data_adv_managers_brochures– Retrieves and OCRs for SEC mandated annual Uniform Requirements for the Investment Adviser Brochure and Brochure Supplements for specified CRDs and/or company names.
visualize_data_frame– This function allows the user to visualize a data frame object to better understand the structure and contents of a data frame. The function utlizes the fantastic listviewer package which wraps Jos de Jong’s JSON Editor project
- ADV Function Tutorial: Sleuthing The Blackstone Group
- Partnership Waterfall Calculation: Hypothetical Facebook Seed Investment
Interactive Analysis Tools
Most Recent ADV Summary Data
library(fundManageR) recent_period_summary <- get_data_adv_managers_current_period_summary(file_directory = NULL)
Detailed Manager Search
test_manager <- fundManageR::get_data_adv_managers_filings( search_names = 'EJF Capital', crd_ids = 156663, all_sections = T, assign_to_environment = T )
ycombinator_alumni <- fundManageR::get_data_ycombinator_alumni() ycombinator_alumni %>% visualize_data_frame(edit = F) ## visualize it
library(dplyr) dates <- c("2015-10-09", "2016-09-26") %>% lubridate::ymd land_purchase_price <- -1000000 %>% formattable::currency() land_sale_price <- 1300000 %>% formattable::currency() cash_flows <- c(land_purchase_price, land_sale_price) fundManageR::calculate_irr_periods(dates = dates, cash_flows = cash_flows, return_wide = T)