-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusions about the timestamp #620
Comments
Hey @eiphy , I was checking this out and just wanted to make sure you resolved it on your end? Was it a timezone issue? |
Hi @justinpolygon , yes, it's a timezone issue. |
Timestamp Looks like it still has problem, I'm looking at option data, and I think there should not be data before 1430pm in UTC |
Hi @ywave620, can you give more detail about what you're looking at here? What is the query you are using so that I can try and reproduce? |
from polygon import RESTClient
import pickle
client = RESTClient(api_key="xx")
aggs = []
for a in client.list_aggs(ticker=ticker, multiplier=1, timespan="minute",
from_="2022-06-15", to="2022-06-15", limit=50000):
aggs.append(a)
print(aggs)
with open('option-paid-data/' + ticker, 'wb') as f:
pickle.dump(aggs, f)
def read_pickle_as_dataframe(file_name):
# Load the data from the pickle file
with open('option-paid-data/' + file_name, 'rb') as f:
data = pickle.load(f)
# Convert the list of objects to a list of dictionaries
data_dicts = [vars(obj) for obj in data]
# Convert the list of dictionaries to a DataFrame
df = pd.DataFrame(data_dicts)
# Capitalize the first letter of each column name
df.columns = [col.capitalize() for col in df.columns]
df['Timestamp'] = df['Timestamp'] + 1000*3600
# Convert the Unix timestamp to a datetime object
df['Timestamp'] = pd.to_datetime(df['Timestamp'], unit='ms')
# Set the 'Timestamp' column as the index
df.set_index('Timestamp', inplace=True)
start_time = pd.to_datetime('2022-06-15 9:30:00')
end_time = pd.to_datetime('2022-06-15 21:00:00')
filtered_df = df[(df.index >= start_time) & (df.index <= end_time)]
return filtered_df
option_data = read_pickle_as_dataframe('O:QQQ220615C00280000') |
Please note that I added "df['Timestamp'] = df['Timestamp'] + 1000*3600" to workaround this issue |
Describe the bug
The timestamp returned from polygon does not make sense to me. After converting to normal datetime object, it spans from 0am to 8am and then 17pm to 23pm. However, the core trading time of NASDAQ should be 1430pm to 21pm in UTC. And the volume values are quite large in intertrading time.
To Reproduce
Use this python script to reproduce:
Expected behavior
Data should be within the core trading time, i.e., 1430 to 2100
Screenshots
An example:
Additional context
N.A.
The text was updated successfully, but these errors were encountered: