vibhorag101
commited on
Commit
•
bf3ca0c
1
Parent(s):
f823eaa
minor changes
Browse files- app.py +3 -8
- indicators.py +1 -3
app.py
CHANGED
@@ -1,16 +1,11 @@
|
|
1 |
import locale
|
|
|
2 |
import gradio as gr
|
3 |
-
import matplotlib.pyplot as plt
|
4 |
-
import numpy as np
|
5 |
-
import numpy_financial as npf
|
6 |
import pandas as pd
|
7 |
-
|
8 |
-
import seaborn as sns
|
9 |
-
from pandas.tseries.offsets import DateOffset, MonthEnd
|
10 |
-
from scipy import optimize
|
11 |
|
12 |
from portfolio import calculate_portfolio_returns
|
13 |
-
from utils import get_all_mf_schemes_df,get_mf_scheme_data
|
14 |
|
15 |
js_func = """
|
16 |
function refresh() {
|
|
|
1 |
import locale
|
2 |
+
|
3 |
import gradio as gr
|
|
|
|
|
|
|
4 |
import pandas as pd
|
5 |
+
from pandas.tseries.offsets import DateOffset
|
|
|
|
|
|
|
6 |
|
7 |
from portfolio import calculate_portfolio_returns
|
8 |
+
from utils import get_all_mf_schemes_df, get_mf_scheme_data
|
9 |
|
10 |
js_func = """
|
11 |
function refresh() {
|
indicators.py
CHANGED
@@ -20,10 +20,8 @@ def get_investment_sharpe_ratio(investment_df, start_date, end_date, SIP_date,ri
|
|
20 |
# calculate annualized standard deviation of monthly returns
|
21 |
annualized_sd = return_df['monthly_return'].std()*np.sqrt(12)
|
22 |
monthly_mean_return = return_df['monthly_return'].mean()
|
23 |
-
|
24 |
annualized_return = ((1+monthly_mean_return/100)**12 - 1)*100
|
25 |
-
print(annualized_return)
|
26 |
-
|
27 |
# calculate Sharpe Ratio
|
28 |
return ((annualized_return - risk_free_rate) / annualized_sd)
|
29 |
|
|
|
20 |
# calculate annualized standard deviation of monthly returns
|
21 |
annualized_sd = return_df['monthly_return'].std()*np.sqrt(12)
|
22 |
monthly_mean_return = return_df['monthly_return'].mean()
|
23 |
+
# calculate annualized return, as the risk free rate is annualized
|
24 |
annualized_return = ((1+monthly_mean_return/100)**12 - 1)*100
|
|
|
|
|
25 |
# calculate Sharpe Ratio
|
26 |
return ((annualized_return - risk_free_rate) / annualized_sd)
|
27 |
|