alexaxbreadbytes commited on
Commit
5ab2834
1 Parent(s): 0106cf9

close 50 reindex

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -207,6 +207,8 @@ def tv_reformat(close50filename):
207
  df['P/L %'] = exit_df['Profit %']
208
  df['Drawdown %'] = exit_df['Drawdown %']
209
  df['Close 50'] = [int(i == "Close 50% of Position") for i in exit_df['Signal']]
 
 
210
  df.loc[df['Close 50'] == 1, 'Exit Date'] = np.copy(df.loc[df[df['Close 50'] == 1].index.values -1]['Exit Date'])
211
 
212
  grouped_df = df.groupby('Entry Date').agg({'Entry Date': 'min', 'Buy Price':'mean',
 
207
  df['P/L %'] = exit_df['Profit %']
208
  df['Drawdown %'] = exit_df['Drawdown %']
209
  df['Close 50'] = [int(i == "Close 50% of Position") for i in exit_df['Signal']]
210
+ df = df.sort_values(['Entry Date','Close 50'], ascending = [False, True])
211
+ df.index = range(len(df))
212
  df.loc[df['Close 50'] == 1, 'Exit Date'] = np.copy(df.loc[df[df['Close 50'] == 1].index.values -1]['Exit Date'])
213
 
214
  grouped_df = df.groupby('Entry Date').agg({'Entry Date': 'min', 'Buy Price':'mean',