Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
unexpected date time behavior

Hi, I am trying to code the algo to only process buy signals in the last 15 minutes of the day, so 3:45 to 4:00 PM EST, so I have an evaluation time variable to create that condition.

# Timestamp of last 15 minutes (15:45 or 3:45 PM EST)  
evaluation_time = datetime(year, month, day, 15, 45)  

However, what I put in my comment does not match reality. The very first trade executes at 7:48 AM (of which time zone, I have no idea, Quantopia doesn't show it), which is clearly not what I want. What time zone is native to the build?

I should add that the evaluation_time is being compared to this variable...so I have no idea if the two time zones are matching. I'm assuming one is UTC at least. Maybe there's a way to check the time zone but I'm going to have to come back to this later.

current_datetime = data.current(sid(8554), "last_traded")

2 responses

Update:

Here's the solution

# Timestamp of last 15 minutes (20:45 or 3:45 PM EST)  
evaluation_time = datetime(year, month, day, 20, 45)  
end_time = datetime(year, month, day, 21,0)

The last 15 minutes of the trading day

One more issue i ran into using a timestamp...daylight savings time. Using the code above my code only runs in the winter and spring LOL. So, I have to adjust for daylight savings time now...