What would be a best practice to create a database of a JSON content retrieved from API?

Hello, community.

I started to learn Python two months ago, so I am a newbie developer and need some guidance about requests and databases.

My objective is to save stocks’ historical prices, retrieved from API (Alpha Vantage), on a database (models.py). This database would be used as inputs to process different outputs to users, such as stock returns, volatility, plot charts, and many other features for investors.

My questions are:

  1. How could I save API’s requested content (it returns a JSON content) to a database? Main fields would be: Datetime field, stock ticker (AAPL for Apple, for example), company name, and stock price on that specific date.

  2. How could I make daily requests to update this database automatically?

  3. In addition, could you suggest a specific documentation to learn about these topics?

Thank you!

Make a database model that matches the fields you want to save and create instances of that. Use the requests library to contact the API.

Write a custom management command and run it reguarly with Heroku Scheduler, a systemd timer, or cron

There’s a bunch of stuff on GitHub - wsvincent/awesome-django: A curated list of awesome things related to Django .