subhash494 commited on
Commit
2d56a56
β€’
1 Parent(s): 50a3fb8

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -15
app.py CHANGED
@@ -43,32 +43,40 @@ def get_ret_dic():
43
  # from json_loader import json_load
44
  # return json_load('streamlit_data_ppl.json')
45
  # with open('streamlit_data_ppl.json','r') as fr:
46
- # data=eval(fr.read().replace("'",'"'))
47
  # return data
48
  ret_dic=get_ret_dic()
49
 
50
  # charges_dic=requests.get(charges_url).json()
51
- botNameDic={"orb":"ORB","rsi":"RSI","it":"Intraday Trend","sh":"StopHunt","grb":"GRB","orb2pm":"ORB2pm","pcr":"NiftyOptionSelling","lapp":"Learnapp","bss":"BNF Straddle","nss":"Nifty Straddle","bos":"BNFOptionSelling","grbo":"GRB Options","bssr":"BNF Strangle","mlb":"ML Bot","bnfmon":"BNF ORB","mss":"1% Short Straddle (BNF)","mssn":"1% Short Straddle(NF)","dts":"Double Top","ats":"Auto Strangle","dbss":"BNF Straddle(Directional)","rbss":"Rolling BNF Straddle"}
52
- botCapitalDic={"orb":50000,"rsi":50000,"it":50000,"sh":50000,"grb":300000,"orb2pm":300000,"pcr":300000,"lapp":300000,"bss":300000,"nss":300000,"bos":300000,"grbo":150000,"bssr":300000,"bnfmon":150000,"mlb":400000,"mss":300000,"mssn":300000,"dts":150000,"ats":300000,"dbss":150000,"rbss":300000}
53
- curBots=['orb','rsi','it','grb','bss','grbo','bssr','bnfmon','mlb','mss','mssn','ats','dbss','rbss']
 
 
 
 
 
54
  botName = query_params["bot"][0] if "bot" in query_params else None
55
 
56
- botsList=list(botNameDic.keys())
57
- if botName not in botsList:
58
- botName='bss'
59
- botsList.remove('bss')
60
- botsList=['bss']+botsList
61
- if not botName:
62
- botName = st.selectbox('Select a Strategy',tuple(botsList))
63
 
64
 
 
 
 
 
 
 
 
 
 
 
 
65
  botCapital,capital_used_appendum,results_row,t_stats_Df,month_groups,strat_df,drawdown_df,i_fields,botFullName=ret_dic[botName]
66
  # with open('strat_df.txt','w') as fw:
67
  # fw.write(strat_df)
68
  def df_from_string(str):
69
  jstr=eval(str.replace('nan','0'))
70
- df=pd.DataFrame.from_dict(jstr)
71
-
72
  return df
73
 
74
  t_stats_Df=df_from_string(t_stats_Df)
@@ -80,8 +88,11 @@ drawdown_df=df_from_string(drawdown_df)
80
  results_row=results_row.replace('nan','0')
81
  results_row=eval(results_row)
82
 
83
- title_text="<h1 style='text-align: center; color: rgb(21, 86, 112);'>**β™Ÿ**SQUAREOFF BOTS PERFORMANCE**β™Ÿ**</h1><br><div style='text-align: center; color: rgb(21, 86, 112);'>**LIVE PERFORMANCE OF "+botFullName+"****[Capital used is "+str(botCapital)+capital_used_appendum+"]** </div>"
84
- st.markdown(title_text, unsafe_allow_html=True)
 
 
 
85
 
86
  fig=px.line(strat_df, x="Time", y='cum_pnl', title=botFullName+' PNL',width=800, height=400)
87
  dd_fig=px.line(drawdown_df,x="Time",y="drawdown", title=botFullName+' PNL',width=800, height=400)
@@ -89,6 +100,8 @@ dd_fig=px.line(drawdown_df,x="Time",y="drawdown", title=botFullName+' PNL',width
89
  if botCapital>50000 and botName!='mlb':
90
  # col1.write("**(Capital used before July 2021 is "+str(int(botCapital/1.5))+capital_used_appendum+")**")
91
  st.markdown("<div style='text-align: center; color: rgb(21, 86, 112);'>**(Capital used before July 2021 is "+str(int(botCapital/1.5))+capital_used_appendum+")** </div>", unsafe_allow_html=True)
 
 
92
  col1, col2 = st.columns(2)
93
  col2.markdown('##')
94
 
 
43
  # from json_loader import json_load
44
  # return json_load('streamlit_data_ppl.json')
45
  # with open('streamlit_data_ppl.json','r') as fr:
46
+ # data=eval(fr.read().replace("'",'"')) comment
47
  # return data
48
  ret_dic=get_ret_dic()
49
 
50
  # charges_dic=requests.get(charges_url).json()
51
+ botNameDic={"orb":"ORB","rsi":"RSI","it":"Intraday Trend","sh":"StopHunt","grb":"GRB","orb2pm":"ORB2pm","pcr":"NiftyOptionSelling","lapp":"Learnapp","bss":"BNF Straddle","nss":"Nifty Straddle","bos":"BNFOptionSelling","grbo":"GRB Options","bssr":"BNF Strangle","mlb":"ML Bot","bnfmon":"BNF ORB","mss":"1% Short Straddle (BNF)","mssn":"1% Short Straddle(NF)","dts":"Double Top","ats":"Auto Strangle","dbss":"BNF Straddle(Directional)"}
52
+ botCapitalDic={"orb":50000,"rsi":50000,"it":50000,"sh":50000,"grb":300000,"orb2pm":300000,"pcr":300000,"lapp":300000,"bss":300000,"nss":300000,"bos":300000,"grbo":150000,"bssr":300000,"bnfmon":150000,"mlb":400000,"mss":300000,"mssn":300000,"dts":150000,"ats":300000,"dbss":150000}
53
+ curBots=['bss','orb','rsi','it','grb','grbo','bssr','bnfmon','mlb','mss','mssn','ats','dbss']
54
+ basket_bots=['banknifty_bskt','finnifty_bskt','nifty_bskt']
55
+ curBots+=basket_bots
56
+ for bskt in basket_bots:
57
+ botNameDic[bskt]=bskt.upper()
58
+ botCapitalDic[bskt]=300000
59
  botName = query_params["bot"][0] if "bot" in query_params else None
60
 
 
 
 
 
 
 
 
61
 
62
 
63
+ # if botName not in botsList:
64
+ # botName='bss'
65
+ # botsList.remove('bss')
66
+ # botsList=['bss']+botsList
67
+ # if not botName:
68
+ # botName = st.selectbox('Select a Strategy',tuple(botsList))
69
+
70
+ title_text="<h1 style='text-align: center; color: rgb(21, 86, 112);'>**β™Ÿ**SQUAREOFF BOTS PERFORMANCE**β™Ÿ**</h1>"
71
+ st.markdown(title_text, unsafe_allow_html=True)
72
+ if not botName:
73
+ botName=st.selectbox('Strategy',curBots,index=0)
74
  botCapital,capital_used_appendum,results_row,t_stats_Df,month_groups,strat_df,drawdown_df,i_fields,botFullName=ret_dic[botName]
75
  # with open('strat_df.txt','w') as fw:
76
  # fw.write(strat_df)
77
  def df_from_string(str):
78
  jstr=eval(str.replace('nan','0'))
79
+ df=pd.DataFrame.from_dict(jstr)
 
80
  return df
81
 
82
  t_stats_Df=df_from_string(t_stats_Df)
 
88
  results_row=results_row.replace('nan','0')
89
  results_row=eval(results_row)
90
 
91
+
92
+
93
+ title_text2="<div style='text-align: center; color: rgb(21, 86, 112);'>**LIVE PERFORMANCE OF "+botFullName+"****[Capital used is "+str(botCapital)+capital_used_appendum+"]** </div>"
94
+
95
+ st.markdown(title_text2, unsafe_allow_html=True)
96
 
97
  fig=px.line(strat_df, x="Time", y='cum_pnl', title=botFullName+' PNL',width=800, height=400)
98
  dd_fig=px.line(drawdown_df,x="Time",y="drawdown", title=botFullName+' PNL',width=800, height=400)
 
100
  if botCapital>50000 and botName!='mlb':
101
  # col1.write("**(Capital used before July 2021 is "+str(int(botCapital/1.5))+capital_used_appendum+")**")
102
  st.markdown("<div style='text-align: center; color: rgb(21, 86, 112);'>**(Capital used before July 2021 is "+str(int(botCapital/1.5))+capital_used_appendum+")** </div>", unsafe_allow_html=True)
103
+
104
+
105
  col1, col2 = st.columns(2)
106
  col2.markdown('##')
107