Timestamp of Previous Trading Day
Dustin_Lang
Posts: 25
What is the best way to get the timestamp of the previous trading day close? Only solution I can think of is converting to a datetime object and maintaining a list of half days and holidays and use a conditional for the proper offset for holidays or Monday-Friday calculations.
Comments
try this
use
previous_trading_date = service.get_market_hours( date_offset=i )[0]
to get the day desired via the offset.use
service.time_to_string(previous_trading_date, '%Y-%m-%d')
to desired formatformatting options strftime.org/