Update trade upsert example to strip seconds, microseconds, and timezone information from the trade entry time
This commit is contained in:
parent
e02b2e59e1
commit
75a5682e46
@ -1,4 +1,5 @@
|
|||||||
pandas
|
pandas
|
||||||
psycopg2
|
psycopg2
|
||||||
python-dotenv
|
python-dotenv
|
||||||
|
pytz
|
||||||
sqlalchemy
|
sqlalchemy
|
@ -1,12 +1,17 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
from database.trades import upsert
|
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 = {
|
trade_data = {
|
||||||
'Date': ['2024-01-22'],
|
'Date': [now.date()],
|
||||||
'Symbol': ['SPX'],
|
'Symbol': ['SPX'],
|
||||||
'Strategy': ['Iron Condor @ Market Open'],
|
'Strategy': ['Iron Condor'],
|
||||||
'Entry Time': [pd.to_datetime('2024-01-22 09:30:00')],
|
'Entry Time': [now],
|
||||||
'Exit Time': [None],
|
'Exit Time': [None],
|
||||||
'Spreads': [
|
'Spreads': [
|
||||||
[
|
[
|
||||||
|
Loading…
Reference in New Issue
Block a user