REIT SBRA & EQR Project

Hi everyone! Just finished the REIT personal project, would love to hear your feedback on how my codes look. Cheers!

import numpy as np
###
adj_closings_sbra = np.loadtxt('SBRA.csv', skiprows=1, usecols=5, delimiter=',')
print("Adjusted Closings SBRA:")
print(adj_closings_sbra)
adj_closings_eqr = np.loadtxt('EQR.csv', skiprows=1, usecols=5, delimiter=',')
print("------------------------------------------------------------------------")
print("Adjusted Closings EQR:")
print(adj_closings_eqr)
###
def display_as_percentage(val):
    return '{:.2f}%'.format(val * 100)
###
def daily_rate_of_return(adj_closings):
    daily_simple_ror = np.diff(adj_closings)/adj_closings[:-1]
    return daily_simple_ror
###
print("------------------------------------------------------------------------")
print("Daily rate of return of SBRA:")
dror_sbra = daily_rate_of_return(adj_closings_sbra)
print(dror_sbra)

###
print("------------------------------------------------------------------------")
print("Daily rate of return of EQR:")
dror_eqr = daily_rate_of_return(adj_closings_eqr)
print(dror_eqr)

###
average_daily_ror_sbra = np.mean(dror_sbra)
average_daily_ror_eqr = np.mean(dror_eqr)
print("------------------------------------------------------------------------")
print("Average daily return of SBRA:", display_as_percentage(average_daily_ror_sbra))
print("Average daily return of EQR:", display_as_percentage(average_daily_ror_eqr))
###
def log_returns(adj_closings):
    log_adj_closings = np.log(adj_closings)
    daily_log_returns = np.diff(log_adj_closings)
    return daily_log_returns
###
print("------------------------------------------------------------------------")
print("Log returns of SBRA: ")
print(log_returns(adj_closings_sbra))
daily_log_returns_sbra = log_returns(adj_closings_sbra)
print("------------------------------------------------------------------------")
print("Log returns of EQR: ")
print(log_returns(adj_closings_eqr))
daily_log_returns_eqr = log_returns(adj_closings_eqr)
###
def annualize_log_return(daily_log_returns):
    average_daily_log_returns = np.mean(daily_log_returns)
    annualized_log_return = average_daily_log_returns * 126
    return annualized_log_return
annualized_log_return_sbra = annualize_log_return(daily_log_returns_sbra)
annualized_log_return_eqr = annualize_log_return(daily_log_returns_eqr)
print("------------------------------------------------------------------------")
print("Annualized log return of SBRA: ",
      display_as_percentage(annualized_log_return_sbra))
print("Annualized log return of EQR: ",
      display_as_percentage(annualized_log_return_eqr))
###
daily_variance_sbra = np.var(daily_log_returns_sbra)
daily_variance_eqr = np.var(daily_log_returns_eqr)
print("------------------------------------------------------------------------")
print("Daily variance SBRA: ", daily_variance_sbra)
print("Daily variance EQR: ", daily_variance_eqr)
###
daily_sd_sbra = np.std(daily_log_returns_sbra)
daily_sd_eqr = np.std(daily_log_returns_eqr)
print("------------------------------------------------------------------------")
print("Standard Deviation SBRA: ", daily_sd_sbra)
print("Standard Deviation EQR: ", daily_sd_eqr)
###
corr_sbra_eqr = np.corrcoef(daily_log_returns_sbra, daily_log_returns_eqr)
print(corr_sbra_eqr)