PyZipline/pyzipline/utils.py

13 lines
339 B
Python
Raw Normal View History

2023-12-19 05:36:18 -05:00
from datetime import datetime
def convert_str_to_datetime(date_string: str) -> datetime:
"""Converts a Zipline date string to a datetime object
2023-12-19 05:36:18 -05:00
Args:
date_string (str): String to convert
Returns:
datetime (datetime): Datetime object
2023-12-19 05:36:18 -05:00
"""
return datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%fZ')