Convert most recent trade date to a datetime object for the sake of consistency
This commit is contained in:
parent
fadb01b2a4
commit
329086b578
@ -1,4 +1,4 @@
|
||||
from datetime import datetime
|
||||
from datetime import datetime, time
|
||||
from dotenv import load_dotenv
|
||||
from os import getenv
|
||||
from sqlalchemy import create_engine, text
|
||||
@ -11,11 +11,11 @@ database_url = (
|
||||
f"@{getenv('DATABASE_HOST')}:{getenv('DATABASE_PORT')}/{getenv('DATABASE_NAME')}"
|
||||
)
|
||||
|
||||
def most_recent_trade_date() -> datetime.date:
|
||||
def most_recent_trade_date() -> datetime:
|
||||
with sessionmaker(bind = create_engine(database_url))() as session:
|
||||
query = text('SELECT * FROM most_recent_trade_date()')
|
||||
result = session.execute(query)
|
||||
return result.scalar()
|
||||
return datetime.combine(result.scalar(), time.min)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(most_recent_trade_date())
|
Loading…
Reference in New Issue
Block a user