In this post, I write about building an API to help me analyze real estate properties.
One of the best ways to build passive incomes is through investing in real estate. I have read a few books on real estate investing and bought my first rental property back in 2020. Before buying a property, a prudent investor may want to analyze the property by figuring out the rental income, expenses, cash flow, cash on cash return, net operating income, cap rate etc. If you are not familiar with these concepts and want to learn more, I suggest reading The Book On Rental Property Investing.
Knowing the metrics give the investor an idea of how the property performs when compared to another property. The more properties an investor analyze, the higher chance the investor can land on a good deal. For instance, with the cash flow metric, you can have an idea of whether a property can produce positive income, or it will cost money as you have to pay additional to cover all the expenses. To calculate cash flow, you need to have an idea of the expenses and incomes. While it’s not possible to know the exact costs of the expenses, you can make an educated guess by estimating the common expenses such as insurance, mortgage, tax as well as costs for repairs, vacancy, and capital expenditures. For the incomes, you can estimate how much rent the property can produce. One way is to use Zillow Rent Estimator website, which automatically looks at the rental prices of properties similar to the targeted property and let you know the range of rental prices for the property. Other metrics require just simple calculations, nothing much beyond algebra, as shown in the code snippets below.
public static double CalculateNetOperatingIncome(IDictionary<string, double> incomes, IDictionary<string, double> expenses)
// NOI = The profit you’ve received in a year, excluding your mortgage payment.
var totalMonthlyExpenseExcludingMortgage =
expenses.Where(keyValuePair => keyValuePair.Key != Enum.GetName(CommonExpenseType.Mortgage)).Sum(keyValuePair => keyValuePair.Value);
var totalMonthlyIncome = incomes.Sum(keyValuePair => keyValuePair.Value);
return (totalMonthlyIncome * 12) - (totalMonthlyExpenseExcludingMortgage * 12);