Update trade upsert example to strip seconds, microseconds, and timezone information from the trade entry time

This commit is contained in:
moshferatu 2024-02-03 05:34:51 -08:00
parent e02b2e59e1
commit 75a5682e46
2 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,5 @@
pandas
psycopg2
python-dotenv
pytz
sqlalchemy

View File

@ -1,12 +1,17 @@
import pandas as pd
from database.trades import upsert
from datetime import datetime
from pytz import timezone
now = datetime.now().astimezone(timezone('US/Eastern'))
now = now.replace(second = 0, microsecond = 0, tzinfo = None)
trade_data = {
'Date': ['2024-01-22'],
'Date': [now.date()],
'Symbol': ['SPX'],
'Strategy': ['Iron Condor @ Market Open'],
'Entry Time': [pd.to_datetime('2024-01-22 09:30:00')],
'Strategy': ['Iron Condor'],
'Entry Time': [now],
'Exit Time': [None],
'Spreads': [
[