Stock performance in a post

Hi,

I run the latest version of Ghost, hosted by Ghost, and customised with the Krabi theme.

My site is focused on due diligence on stocks and although I haven’t been actively publishing for a while, I’d like to pick it up again.

One thing I’d like to add is that it shows how the stock has performed since I published my post. So, for example, I do due diligence on AAPL on 1st August and that it’d show “+15.2% since 1st August”.

Would something like this be possible?

It may be possible to use Code Injection to grab the latest stock price for given symbol for current time and published time , then calculate the difference. {{date}} helper can be used figure out the published date as an input to the JS code.

Also do you already have access to a Stock Prices API? Where will you get stock price data?

Thank you for your response.

Your post makes sense in theory, how to put it in practice I’m clueless about. I picked Ghost because I virtually have to make no changes to it, as it’s so good already! :slight_smile:

I made a free account at iexcloud.io, which is reasonably priced and seems to have historical data: IEX Cloud API | IEX

The API for historical prices also has a changeOverTime attribute: “number, Percent change of each interval relative to first value. Useful for comparing multiple stocks.”