When handling timeseries data, quite often you may want to resample the data at a different frequency and use it that way.
One way to achieve this is to load all data with Python, and resample or reindex it with Pandas.
An alternative is to query directly in SQL by using a pattern like the one below. This allows you to only get the most recent data at each sample point you’re interested in.
I recently started working on my own autotrader. There’s still much to be done, but I’ve finished the first step – collecting data and put them in a database. I’ve got a PostgreSQL server running on Docker, and a script that reads data using the AlphaVantage API and writes to my database.
The next step would be to write my own Python API to query data from the database. The easy way for me would be to stick a bunch of SQL queries in some python functions, but why do that when you can make life more complicated!