Home:ALL Converter>Django: saving data from API into database (postgres)

Django: saving data from API into database (postgres)

Ask Time:2015-09-10T01:22:04         Author:user4479529

Json Formatter

I am building an app that uses the Oanda API to retrieve historical forex data. There are 28 forex pairs and 10 years worth of historical data. Since none of this data changes I was planning on saving it into my database rather than blowing up the API.

My goal is to initially populate the database for all pairs and then update the data once per minute from then on.

What I can't figure out is how to do this effectively.

Where should the logic for this live inside the Django app? How can I execute the initial population of the data so that it will save?

It's the saving that is giving me the most problems. As far as I can tell Django only likes to save model instances from the shell.

Any help would be greatly appreciated.

Author:user4479529,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/32485757/django-saving-data-from-api-into-database-postgres
yy