wnstnb commited on
Commit
816b291
Β·
1 Parent(s): 238240f

simplify top of fold

Browse files
Files changed (1) hide show
  1. app.py +30 -37
app.py CHANGED
@@ -419,7 +419,8 @@ with st.form("choose_model"):
419
  data = {
420
  'Confidence':[f'{text_cond} {score:.1%}'],
421
  'Success':[f'{historical_proba:.1%}'],
422
- f'N{operator}{score:.1%}':[f'{num_obs} / {len(data)}']
 
423
  })
424
 
425
  prices = pd.DataFrame(index=[
@@ -549,44 +550,36 @@ with st.form("choose_model"):
549
  tab1, tab2, tab3, tab4 = st.tabs(["πŸ€– Stats", "✨ New Data", "πŸ“š Historical", "πŸ“Š Performance"])
550
 
551
  with tab1:
552
- st.dataframe(prices.T.set_index('PrevClose', drop=True))
553
  st.write(df_probas)
554
 
555
- em_option = st.radio(f'🌊 VIX EM ({curr_em:.2f} / {fwd_em:.2f})',['Curr','Fwd'],horizontal=True)
556
- em_use = None
557
- close_use = None
558
- if em_option == 'Curr':
559
- em_use = curr_em
560
- close_use = prev_close
561
-
562
- elif em_option == 'Fwd':
563
- em_use = fwd_em
564
- close_use = curr_close
565
-
566
- df_em = pd.DataFrame(columns=['EM','Low','High','WithinRange','Tested'])
567
- df_em.index.name = f'{close_use:.2f}'
568
- df_em.loc['EM 1X'] = [
569
- f"{em_use:.2f} ({em_use / close_use:.1%})",
570
- f"{close_use - em_use:.2f}",
571
- f"{close_use + em_use:.2f}",
572
- f"{len(data.query('Close <= VIX_EM_High & Close >= VIX_EM_Low')) / len(data):.1%}",
573
- f"{len(data.query('High > VIX_EM_High | Low < VIX_EM_Low')) / len(data):.1%}"
574
- ]
575
- df_em.loc['EM 1.25X'] = [
576
- f"{curr_em * 1.25:.2f} ({(em_use * 1.25) / close_use:.1%})",
577
- f"{close_use - (em_use * 1.25):.2f}",
578
- f"{close_use + (em_use * 1.25):.2f}",
579
- f"{len(data.query('Close <= VIX_EM_125_High & Close >= VIX_EM_125_Low')) / len(data):.1%}",
580
- f"{len(data.query('High > VIX_EM_125_High | Low < VIX_EM_125_Low')) / len(data):.1%}"
581
- ]
582
- df_em.loc[f"EM 1.5X"] = [
583
- f"{curr_em * 1.5:.2f} ({(em_use * 1.5) / close_use:.1%})",
584
- f"{close_use - (em_use * 1.5):.2f}",
585
- f"{close_use + (em_use * 1.5):.2f}",
586
- f"{len(data.query('Close <= VIX_EM_15_High & Close >= VIX_EM_15_Low')) / len(data):.1%}",
587
- f"{len(data.query('High > VIX_EM_15_High | Low < VIX_EM_15_Low')) / len(data):.1%}"
588
- ]
589
- st.write(df_em)
590
 
591
  with tab2:
592
  st.subheader('Latest Data for Pred')
 
419
  data = {
420
  'Confidence':[f'{text_cond} {score:.1%}'],
421
  'Success':[f'{historical_proba:.1%}'],
422
+ f'N{operator}{score:.1%}':[f'{num_obs} / {len(data)}'],
423
+ 'Prev / Curr':[f'{prev_close:.2f} / {curr_close:.2f}']
424
  })
425
 
426
  prices = pd.DataFrame(index=[
 
550
  tab1, tab2, tab3, tab4 = st.tabs(["πŸ€– Stats", "✨ New Data", "πŸ“š Historical", "πŸ“Š Performance"])
551
 
552
  with tab1:
553
+ # st.dataframe(prices.T.set_index('PrevClose', drop=True))
554
  st.write(df_probas)
555
 
556
+ for close_use, em_use, lbl in zip([prev_close, curr_close], [curr_em, fwd_em], ['Current','Forward']):
557
+
558
+ st.write(f'🌊 VIX EM {lbl}: {em_use:.2f}')
559
+ df_em = pd.DataFrame(columns=['EM','Low','High','InRange','Tested'])
560
+ df_em.index.name = f'{close_use:.2f}'
561
+ df_em.loc['EM 1X'] = [
562
+ f"{em_use:.2f} ({em_use / close_use:.1%})",
563
+ f"{close_use - em_use:.2f}",
564
+ f"{close_use + em_use:.2f}",
565
+ f"{len(data.query('Close <= VIX_EM_High & Close >= VIX_EM_Low')) / len(data):.1%}",
566
+ f"{len(data.query('High > VIX_EM_High | Low < VIX_EM_Low')) / len(data):.1%}"
567
+ ]
568
+ df_em.loc['EM 1.25X'] = [
569
+ f"{curr_em * 1.25:.2f} ({(em_use * 1.25) / close_use:.1%})",
570
+ f"{close_use - (em_use * 1.25):.2f}",
571
+ f"{close_use + (em_use * 1.25):.2f}",
572
+ f"{len(data.query('Close <= VIX_EM_125_High & Close >= VIX_EM_125_Low')) / len(data):.1%}",
573
+ f"{len(data.query('High > VIX_EM_125_High | Low < VIX_EM_125_Low')) / len(data):.1%}"
574
+ ]
575
+ df_em.loc[f"EM 1.5X"] = [
576
+ f"{curr_em * 1.5:.2f} ({(em_use * 1.5) / close_use:.1%})",
577
+ f"{close_use - (em_use * 1.5):.2f}",
578
+ f"{close_use + (em_use * 1.5):.2f}",
579
+ f"{len(data.query('Close <= VIX_EM_15_High & Close >= VIX_EM_15_Low')) / len(data):.1%}",
580
+ f"{len(data.query('High > VIX_EM_15_High | Low < VIX_EM_15_Low')) / len(data):.1%}"
581
+ ]
582
+ st.write(df_em)
 
 
 
 
 
 
 
 
583
 
584
  with tab2:
585
  st.subheader('Latest Data for Pred')