Lirsen Myrtaj Yim-Koi commited on
Commit
58ea282
1 Parent(s): 08c23df

Updated variable names in ef.py (#16)

Browse files

- Updated variable names in ef.py (ad1fa7f216e5b9b49f922e4d5c01352c4808175f)


Co-authored-by: Vi Koi Nguyen <Yim-Koi@users.noreply.huggingface.co>

Files changed (1) hide show
  1. ef.py +4 -3
ef.py CHANGED
@@ -77,8 +77,9 @@ def ef_viz(stock_df,choices):
77
  port_ef_df = pd.DataFrame(data)
78
  #st.write(port_ef_df[tickers].T)
79
  ## NEEDS INPUT INSTEAD OF HARD CODE
80
- a = 5 #the coefficient of risk aversion is A. If an invest is less risk averse A is small. We assume 25 < A < 35.
81
- rf = 0.041
 
82
  min_vol_port = port_ef_df.iloc[port_ef_df['Volatility'].idxmin()]
83
  optimal_risky_port = port_ef_df.iloc[((port_ef_df['Returns']-rf)/port_ef_df['Volatility']).idxmax()]
84
 
@@ -92,7 +93,7 @@ def ef_viz(stock_df,choices):
92
 
93
  for er in np.linspace(rf, max(data['Returns']),20):
94
  sd = (er - rf)/ ((optimal_risky_port[0] - rf)/ optimal_risky_port[1])
95
- u = er - 0.5*a*(sd**2)
96
  cal_x.append(sd)
97
  cal_y.append(er)
98
  utl.append(u)
 
77
  port_ef_df = pd.DataFrame(data)
78
  #st.write(port_ef_df[tickers].T)
79
  ## NEEDS INPUT INSTEAD OF HARD CODE
80
+ #a = 5 #the coefficient of risk aversion is A. If an invest is less risk averse A is small. We assume 25 < A < 35.
81
+ #rf = 0.041
82
+
83
  min_vol_port = port_ef_df.iloc[port_ef_df['Volatility'].idxmin()]
84
  optimal_risky_port = port_ef_df.iloc[((port_ef_df['Returns']-rf)/port_ef_df['Volatility']).idxmax()]
85
 
 
93
 
94
  for er in np.linspace(rf, max(data['Returns']),20):
95
  sd = (er - rf)/ ((optimal_risky_port[0] - rf)/ optimal_risky_port[1])
96
+ u = er - 0.5*A_coef*(sd**2)
97
  cal_x.append(sd)
98
  cal_y.append(er)
99
  utl.append(u)