I am trying to do a filter in pipeline to ensure filter securities based on the financial_statement_filing.period_ending_date. For example, the period_ending_date as compared to the date when the backtest is carried out (obtained through
get_datetime()
) is compared to check whether the difference exceeds a certain number of days.
ending_date = datetime.strptime(mstar.financial_statement_filing.period_ending_date.latest, '%Y-%m-%d')
filter = (get_datetime().date() - ending_date).days <= 252/2
However, I get the following error message:
SecurityViolation: 0002 Security Violation(s): Accessing datetime.strptime raised an AttributeError. Did you mean to access datetime.datetime instead?
Any idea what this means?