I have the following code snippet below. I have print statements so it'll print what part of the code it's currently working through in the console window. I was wondering if there was a way to add the time it took to calculate each block of code in the print statements as well?
print('Starting Backtest Instantiation')
backtester_example = Backtest(new_data_sample, position_logic_example)
print('Running Output DF')
aggstats = backtester_example.agg_stats()
stats_df = backtester_example.output_all_metrics_as_df()
print('Running Tabular Trades')
compact_data = backtester_example.tabular_trades()
print('FinishedTabularTrades')