feat: trade analysis overhaul — editing, grouping, comparison views
Trade Analysis: - Add editable raw trade log with # index and Group column - Group column merges multiple entries into one position on Update - Reset button clears edited version back to original upload - View selector: Original / Edited / Both — appears after first Update - Both mode: stats show with coloured delta arrows vs edited version - Both mode: equity, drawdown and daily P&L charts overlay both versions - Both mode: strategy comparison table shows inline delta values - Position Summary expander above monthly table — all positions listed (grouped with entry count, individual as single rows) sorted by open time - Download exports edited version when available, original otherwise - Trade # multiselect filter to show specific trades - All charts and tables (DOW, hour, monthly) respect view selection - Fix: Group column positioned second after # index - Fix: DataFrame truth value error in download button - Fix: Both mode now uses edited df for DOW/hour/monthly charts mt5_parser: - Add trading_days and trades_per_day to calc_stats - Add ISO datetime format fallback for CSV imports - Fix missing comment column KeyError in _enrich - Fix NaT in date filter when open_time has null values
This commit is contained in:
@@ -350,8 +350,13 @@ def calc_stats(df):
|
||||
longs = df[df['type'] == 'buy']
|
||||
shorts = df[df['type'] == 'sell']
|
||||
|
||||
trading_days = df['open_time'].dt.date.nunique() if 'open_time' in df.columns else 0
|
||||
trades_per_day = round(total / trading_days, 2) if trading_days > 0 else 0
|
||||
|
||||
return {
|
||||
'total_trades' : total,
|
||||
'trading_days' : trading_days,
|
||||
'trades_per_day' : trades_per_day,
|
||||
'win_rate' : win_rate,
|
||||
'net_profit' : net_profit,
|
||||
'gross_profit' : gross_profit,
|
||||
|
||||
Reference in New Issue
Block a user