Nice work on this guys! Really great idea, and a end of day notification is awesome!
Here is what I thought I would contribute…entering the data is very tedious…here is how to make it easy (ier):
Create an excel spreadsheet. Columns:
A: Ticker
B: #OfShares
C: Purchased Price
D: StockID (as per instructions)
E: Sensor: Formula starting E2 is =" - id: " &D2 & CHAR(10) &" name: " & A2 & CHAR(10) & " shares: " & B2 & CHAR(10) & " purchase_price: " & C2
F: StockGainToday: Formula is =“states.sensor.”& LOWER(A2)& ".attributes.totalChange +"
G: StockGainTotal: Formula is =“states.sensor.”& LOWER(A2)& ".attributes.totalProfitLoss +"
H: Lovelace Card: Formula is =" - entity: sensor." & LOWER(A2)
Once you have all you stock entered (columns A B C D):
Column E can be selected whole, copied, pasted in notepad++, all double quotes replaced by nothing, and it’s ready to be pasted in sensors.yaml.
I created template sensors to add up the “totalChange” (StockGainToday), and “totalProfitLoss” (StockGainTotal), which is what columns F and G are about. Whole columns can be copied straight from Excel to yaml. This is what I use for daily notifications.
Finally, the last column H is for the table custom card. The whole columns can be copied and pasted to the card config.
It also make it easier to maintain once more stocks are bought (or sold!).
I would love to use this card, however im still a Home Assistant beginner so I dont understand how to install this? Usually there is a HACS link or a file download but in https://github.com/gwendo/entities-table-card I cant find it.
profitLoss is the current price minus purchasePrice. totalChange is todays change mulitplied with shares. profitLossPercentage is how much the price has changed compared to purchasePrice totalProfitLoss is profitLoss multiplied by shares.
In your example totalValue is the current price multiplied by shares
Sorry I missed your question about the date. It is just a string, not used for anything so you can remove it. It was requested by someone to have, not sure what they use it for.
I find this HACS very interesting but while setting my configuration.yaml, I cannot pass the verification. It keeps running and I can’t get the Configuration Valid! confirmation.
sensor:
- platform: avanza_stock
stock:
- id: 789695
name: Nouveau Monde Graphite
shares: XXX
purchase_price: 19.17
- id: 691678
name: Euro Sun Mining
share: XXX
purchase_price: 2.12
monitored_conditions:
- totalVolumeTraded
- totalValueTraded
- change
- changePercent
- lastPrice