I am building a service (web via html/css/nodejs and iOS app via swift 4 for now) that will calculate how much you have total of all stocks across multiple brokers, in your country's currency. The website and app both pull from the same database, and therefore display the same information.
Let's say hypothetically, I can only pull the quantity owned of each stock (in # of stocks, not any currency) and I store this in a database. The website/app will retrieve it from the database when a user requests a refresh.
I want to be able to calculate the sum of all stocks in an account using that quantity and the exchange's price for that stock (pulled from elsewhere).
Users don't need real time accuracy, and there is a daily cap of 200 on the amount of calls you can make to the exchange. This could be increased through a request.
I was thinking of the best practice for how to retrieve/store the price data. Seems like I have 2 options:
1) Store it in the database with the quantity owned and have the website/app query the database for both the amount owned and price. This could be updated centrally and all users could pull from it or request new updates, but I feel that is a lot of I/O on the database and exchange's API.
2) Retrieve the price info and store locally each time a user requests it straight from the exchange. This is less storage than option 1, but is still fairly I/O heavy especially on the exchange's API
Which is the best way to do this? Or is there a better way that I'm missing?