<jupyter_start><jupyter_text>Simple Rate ReturnP_final - P_start / P_start = (P_final / P_start) - 1<jupyter_code>#creating a new column for my dataframe
# assumtion_1: for calculating simple return we are considering the Adj.Price
TSLA['simple_return'] = (TSLA['Adj Close'] / TSLA['Adj Close'].shift(1)) - 1
TSLA.tail(10)
import matplotlib as plt

TSLA['simple_return'].plot(figsize=(8,5))
plt.show(TSLA)
avg_return_d = TSLA['simple_return'].mean()
avg_return_d
avg_return_annual = TSLA['simple_return'].mean()*250
print(avg_return_annual)

#converting annual return in percentage
print(str(round(avg_return_annual,5)*100) + '%')<jupyter_output>0.6329752656897204
63.298%<jupyter_text>Calculating log returnln(price_final/price_start)<jupyter_code>TSLA.head(10)
#creating new column on my dataset for lofg_retunr
TSLA['log_return'] = np.log(TSLA['Adj Close']/ TSLA['Adj Close'].shift(1))
TSLA.head(10)
avg_log_return_annual = TSLA['log_return'].mean()*250
print(f' The annual log_retun is {avg_log_return_annual}')

#converting annual return in percentage
print(str(round(avg_log_return_annual,5)*100) + '%')<jupyter_output>The annual log_retun is 0.47647912252010416
47.648%
{'fraction_non_alphanumeric': 0.13435374149659865, 'fraction_numerical': 0.061224489795918366, 'mean_word_length': 8.124031007751938, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '615299', 'license': 'MIT', 'n_tokens_mistral': 512, 'n_tokens_neox': 453, 'n_words': 87, 'path': '2022/Python-for-finance/Section 10/simple_return.ipynb', 'repo_name': 'millennialseb/EDU_python', 'size': '1176'}