Simulating with mid day price

A) I am trying to run a simulation of a program that needs to run every day 2.5H before closing
 
To test, I need access to the following data:
 
Current price today (at 2.5H before closing).
 
I am trying this syntax for the current price and I get NaN instead of the correct price at that time.
current_price = data.current(security, "last")  <<<<<<<<<<<<<<<<<< Nan
 
Can you suggest how to paper trade this?

Thanks
Alon

Hi Alon!


  1. To schedule a strategy run 2.5 hours before close, you may try something like :



    schedule_function(

    func=<Add name of function to run. This is a function you define to execute some strategy>,

    date_rule=date_rules.every_day(),

    time_rule=time_rules.market_close(hours=2, minutes=30)

    )



    2.  inside the function you have scheduled, you may access the latest price by :



    data.current(security, ‘last_traded’)



    Hope this helps!

for #2, please use  data.current(security, ‘close’).