sensor.avanza_stock icon indicating copy to clipboard operation
sensor.avanza_stock copied to clipboard

How do I use id 0?

Open mrjcohen opened this issue 6 months ago • 2 comments

I have about 15 stocks but 3 of them were not available on Avanza so I used id=0 for them. Is there any way to update the stock price using a different entity? I was able to add the stock price to a Yahoo Finance Integration entity but that integration doesn't track number of shares and purchase price so it doesn't do all the cool calculations like you integration does.

mrjcohen avatar Jun 28 '25 23:06 mrjcohen

You use it like this

    - id: 0
      name: off market stock
      shares: 100
      purchase_price: 100
      currency: SEK

So the purchase price is also the current price. Currently that is expectee to be just a number but it is definetly doable to have it reference another entity. I just update the purchase price every year when there is a new evaluation, this was my usecase for implementing the feature.

What stock is it that you cant find on avanza?

claha avatar Jun 29 '25 10:06 claha

Hi, thanks for messaging back! The three stocks I can't find are EQL, DHS, & BRCHF.

I was able to add entities for those stocks using the Yahoo Finance HACS Integration so I was hoping there was a way to override the stock price with that entity.

For example if the stock price entity for EQL from the Yahoo Finance Integration is sensor.yahoofinance_eql then

    - id: 0
      name: EQL
      shares: 100
      purchase_price: 100
      stock_price: sensor.yahoofinance_eql

I'm not a developer so I'm not sure if that's possible. The reason why I wanted to do this is because your integration does all the fancy work of calculating total value based on purchase price and quantity of shares. The Yahoo Finance Integration seems to just get stock prices.

mrjcohen avatar Jul 01 '25 00:07 mrjcohen