<jupyter_start><jupyter_text>Valuing Securities<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
# expected return AAPL

div = 2.92
p0 = 152.60
p1 = 178.71
er = (div + p1) / p0
print('Expected return {}'.format(er - 1))

pv = (div + p1) / er
print('Current value: {}'.format(pv))
# dividend discount model
g = .08
er = .12
p1 = 81
div = 3.

horizon = pd.DataFrame({'div': np.zeros(3), 'exp_price': np.zeros(3)})
horizon.index = np.arange(1, len(horizon) + 1)
horizon.index.name = 'Year'
for year in range(1,horizon['div'].count() + 1):
    if year == 1:
        horizon['div'][year] = div
        horizon['exp_price'][year] = p1
    else:    
        horizon['div'][year] = div * (1 + g) ** (year - 1)
        horizon['exp_price'][year] = p1 * (1 + g) ** (year -1)
    
horizon
(horizon['div'][1] + horizon['exp_price'][1]) / (1 + er)
horizon['div'][1] / (1+ er) + (horizon['div'][2] + horizon['exp_price'][2]) / (1 + er) **2
# constant growth model
div = 3.
g = .08
er = .12

div / (er - g)
# what about stocks with no dividend?
eps = 5.60
pe = 15
er = .12

eps * pe / (1 + er)
ea = 5.30

ea * 14 /(1+er)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19596299411269974, 'fraction_numerical': 0.057190916736753576, 'mean_word_length': 3.2805755395683454, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '429963', 'license': 'MIT', 'n_tokens_mistral': 518, 'n_tokens_neox': 492, 'n_words': 132, 'path': 'Section 5/Valuation.ipynb', 'repo_name': 'PacktPublishing/Hands-on-Python-for-Finance-V-', 'size': '1189'}