alexaxbreadbytes commited on
Commit
141e16c
1 Parent(s): 12ac470

Update historical_app.py

Browse files
Files changed (1) hide show
  1. historical_app.py +7 -7
historical_app.py CHANGED
@@ -45,7 +45,7 @@ class color:
45
  UNDERLINE = '\033[4m'
46
  END = '\033[0m'
47
 
48
- @st.cache_data
49
  def print_PL(amnt, thresh, extras = "" ):
50
  if amnt > 0:
51
  return color.BOLD + color.GREEN + str(amnt) + extras + color.END
@@ -56,7 +56,7 @@ def print_PL(amnt, thresh, extras = "" ):
56
  else:
57
  return str(amnt + extras)
58
 
59
- @st.cache_data
60
  def get_headers(logtype):
61
  otimeheader = ""
62
  cheader = ""
@@ -108,7 +108,7 @@ def get_headers(logtype):
108
 
109
  return otimeheader.lower(), cheader.lower(), plheader.lower(), fmat
110
 
111
- @st.cache_data
112
  def get_coin_info(df_coin, principal_balance,plheader):
113
  numtrades = int(len(df_coin))
114
  numwin = int(sum(df_coin[plheader] > 0))
@@ -129,7 +129,7 @@ def get_coin_info(df_coin, principal_balance,plheader):
129
 
130
  return numtrades, numwin, numloss, winrate, pfactor, cum_PL, cum_PL_perc, mean_PL, mean_PL_perc
131
 
132
- @st.cache_data
133
  def get_hist_info(df_coin, principal_balance,plheader):
134
  numtrades = int(len(df_coin))
135
  numwin = int(sum(df_coin[plheader] > 0))
@@ -147,7 +147,7 @@ def get_hist_info(df_coin, principal_balance,plheader):
147
  pfactor = np.nan
148
  return numtrades, numwin, numloss, winrate, pfactor
149
 
150
- @st.cache_data
151
  def get_rolling_stats(df, lev, otimeheader, days):
152
  max_roll = (df[otimeheader].max() - df[otimeheader].min()).days
153
 
@@ -162,13 +162,13 @@ def get_rolling_stats(df, lev, otimeheader, days):
162
  else:
163
  rolling_perc = np.nan
164
  return 100*rolling_perc
165
- @st.cache_data
166
  def cc_coding(row):
167
  return ['background-color: lightgrey'] * len(row) if row['Exit Date'] <= datetime.strptime('2022-12-16 00:00:00','%Y-%m-%d %H:%M:%S').date() else [''] * len(row)
168
  def ctt_coding(row):
169
  return ['background-color: lightgrey'] * len(row) if row['Exit Date'] <= datetime.strptime('2023-01-02 00:00:00','%Y-%m-%d %H:%M:%S').date() else [''] * len(row)
170
 
171
- @st.cache_data
172
  def my_style(v, props=''):
173
  props = 'color:red' if v < 0 else 'color:green'
174
  return props
 
45
  UNDERLINE = '\033[4m'
46
  END = '\033[0m'
47
 
48
+ @st.experimental_memo
49
  def print_PL(amnt, thresh, extras = "" ):
50
  if amnt > 0:
51
  return color.BOLD + color.GREEN + str(amnt) + extras + color.END
 
56
  else:
57
  return str(amnt + extras)
58
 
59
+ @st.experimental_memo
60
  def get_headers(logtype):
61
  otimeheader = ""
62
  cheader = ""
 
108
 
109
  return otimeheader.lower(), cheader.lower(), plheader.lower(), fmat
110
 
111
+ @st.experimental_memo
112
  def get_coin_info(df_coin, principal_balance,plheader):
113
  numtrades = int(len(df_coin))
114
  numwin = int(sum(df_coin[plheader] > 0))
 
129
 
130
  return numtrades, numwin, numloss, winrate, pfactor, cum_PL, cum_PL_perc, mean_PL, mean_PL_perc
131
 
132
+ @st.experimental_memo
133
  def get_hist_info(df_coin, principal_balance,plheader):
134
  numtrades = int(len(df_coin))
135
  numwin = int(sum(df_coin[plheader] > 0))
 
147
  pfactor = np.nan
148
  return numtrades, numwin, numloss, winrate, pfactor
149
 
150
+ @st.experimental_memo
151
  def get_rolling_stats(df, lev, otimeheader, days):
152
  max_roll = (df[otimeheader].max() - df[otimeheader].min()).days
153
 
 
162
  else:
163
  rolling_perc = np.nan
164
  return 100*rolling_perc
165
+ @st.experimental_memo
166
  def cc_coding(row):
167
  return ['background-color: lightgrey'] * len(row) if row['Exit Date'] <= datetime.strptime('2022-12-16 00:00:00','%Y-%m-%d %H:%M:%S').date() else [''] * len(row)
168
  def ctt_coding(row):
169
  return ['background-color: lightgrey'] * len(row) if row['Exit Date'] <= datetime.strptime('2023-01-02 00:00:00','%Y-%m-%d %H:%M:%S').date() else [''] * len(row)
170
 
171
+ @st.experimental_memo
172
  def my_style(v, props=''):
173
  props = 'color:red' if v < 0 else 'color:green'
174
  return props