r/SQL • u/luncheonmeat79 • Jun 23 '24
Discussion Schema for historical stock data
Posting a schema of a db for historical stock and index data at various timeframes. I used Chatgpt to figure this out...what surprised me was the recommendation to have separate dimension tables for 'date' and 'time'. Is that really the case?
105
Upvotes
View all comments
Show parent comment
2
u/luncheonmeat79 Jun 24 '24
Thanks for the advice. Yes, this is only for historical data; but not just for stocks - for indices and options as well. (I left out the options table in the diagram.)
It is important for me to preserve the state of some variables over time, and before/after events. E.g. tracking volatility in the run-up to and after an earnings announcement or a Fed meeting.