Hey All,
I am wondering how to get some values from an API using GET(I assume thats what I need)
I can’t say I have any real experience in this so forgive me but I have been trying to work it out.
I am trying to get my current portfolio value that is on Ghostfolio (and maybe other items if i can get that working) listed as a sensor within a local home assistant instance.
I am self hosting my instance so not too concerned about hitting it every hour or whatever. (I have anonymized the below URL/data values so they are not leaking my info)
It appears they have a restful sensor that can be created as per here;
When poking around in the network dev mode in the browser I believe i am trying to access;
https://ghostfol.io/api/v2/portfolio/performance?range=max
With some mucking about I have managed to run a curl get request in terminal such as this;
curl -X GET https://ghostfol.io/api/v2/portfolio/performance?range=max -H “Authorization: Bearer some-big-auth-token”
and I end up with a huge output of data.
It appears to be everyday… however i can see in there that there is this output.
“performance”:{“currentValue”:$$$$$,“currentGrossPerformance”:$$$$$$,“currentGrossPerformancePercent”:$$$$$$$,“currentNetPerformance”:$$$$$$,“currentNetPerformancePercent”:$$$$$$$,“totalInvestment”:$$$$$$}}
It would seem “currentValue” is what I am after but have no idea how to parse that in order to get the sensor to output just that value…
Thanks for any help.
I did try and have a look through their docs and the home assistant docs and a bunch of googling but as I have no real idea other than trial and error so far I am at a bit of a loss.