Back to Community
Get date of current backtest day


I am trying to figure out how to set a variable that returns the date the current day of the back test running and will update with each new day. Currently I have tried the following, today = but this will only work for live data. I have also tried today = get_environment('start').date() , but this date remain fixed with the earliest date set for back test. If I ran back test today 4/2/17 for the period of 3/27/17 to 3/31/17, the variable would need to return the 27th on the first back test period the 28th on the next and so forth.

2 responses

str(get_datetime().date()) would be '2017-03-27' on the 27th.

Thank you, exactly what I need.