custom-components / sensor.avanza_stock

Custom component to get stock data from Avanza for Home Assistant
MIT License
46 stars 10 forks source link

Reverse Conversion Currency #87

Closed fabir-git closed 4 years ago

fabir-git commented 4 years ago

It would be nice to have a "reverse conversion currency" flag.

Example: I want to show a stock in EUR that has USD but avanza only has a conversion for EUR->USD so this does not work at the moment.

If we would have a "reverse flag" it could divide the stockprice through the conversion factor instead of multiplying it so there are more currency options.

claha commented 4 years ago

Of course there should be something like this, I'll be back from vacation next week so I will have a go at it then.

mbedk commented 4 years ago

+1 for this feature. Currently there is no conversion between NOK and DKK.

Also would be nice to define a default currency to include currency loss/gain.

Btw this integration is awesome! Should be the default in HA.

claha commented 4 years ago

@mbedk Perhaps then we would like to be able to chain currency conversions (and possibly invert each one if needed), i.e. NOK->SEK followed by SEK->DKK?

Could you please elaborate on the default currency, I don't really understand what you are looking for. Preferrebly create a new issue for it.

Thanks! 😁 I have started to create a minimal version of this to be merged into HA, hopefully I can get that in soon and then start adding all the features from here.

fabir-git commented 4 years ago

Thank you for your great work, claha! But sadly Home Assistant does not recognise the new currency (for example if i convert the biontech stock from USD to EUR it shows SEK in Home Assistant)

claha commented 4 years ago

Is it only the unit_of_measurement that seems wrong or the value as well?

fabir-git commented 4 years ago

it is only the unit of measurement, the value is right

claha commented 4 years ago

A quick look at the code and it seems I don't change the unit when using the invert flag, I will reopen the issue.

claha commented 4 years ago

The currency retrieved from the api always seems to SEK, need to parse the name of the index instead which always seems to be "FROM/TO" and use that instead.