All Projects → custom-components → sensor.avanza_stock

custom-components / sensor.avanza_stock

Licence: MIT license
Custom component to get stock data from Avanza for Home Assistant

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to sensor.avanza stock

Home-Assistant-custom-components-DPC-Alert
Italy Meteo-hydro alert and hydrogeological phenomena Civil Protection (Protezione Civile). In this custom component you can find the vigilance Bulletin and the Bulletin of national hydrogeological and hydraulic criticalities. They allow to check whether in your current location there will be criticalities/warnings related to weather-hydrogeolog…
Stars: ✭ 31 (+3.33%)
Mutual labels:  home-assistant, homeassistant, hacs
hass-pandora-cas
Home Assistant custom component for Pandora Car Alarm System
Stars: ✭ 15 (-50%)
Mutual labels:  home-assistant, homeassistant, hacs
ha-config-ataraxis
My Home Assistant Configs. If you like what you see, please ⭐️my repo. It would encourage me a lot 🤘
Stars: ✭ 146 (+386.67%)
Mutual labels:  home-assistant, homeassistant, hacs
homeassistant-powercalc
Custom component to calculate estimated power consumption of lights and other appliances
Stars: ✭ 261 (+770%)
Mutual labels:  home-assistant, homeassistant, hacs
ha-zoom-automation
Custom Home Assistant component for Zoom. Tracks when you are connected to a Zoom call by default but may allow you to track more.
Stars: ✭ 47 (+56.67%)
Mutual labels:  home-assistant, homeassistant, hacs
hass-hue-icons
Additional vector icons for home assistant to model Philips Hue bulbs and fixtures.
Stars: ✭ 161 (+436.67%)
Mutual labels:  home-assistant, homeassistant, hacs
hass-livebox-component
Livebox Component for Home assistant
Stars: ✭ 24 (-20%)
Mutual labels:  home-assistant, homeassistant, hacs
ad-alexatalkingclock
Alexa (or other Smart Speakers) tell you the time without asking every hour. Please ⭐️if you like my app :)
Stars: ✭ 30 (+0%)
Mutual labels:  home-assistant, homeassistant, hacs
entur-card
Home Assistant Lovelace card card for the Entur public transport component.
Stars: ✭ 38 (+26.67%)
Mutual labels:  home-assistant, homeassistant, hacs
home-assistant-frigidaire
Custom component for the Frigidaire integration
Stars: ✭ 11 (-63.33%)
Mutual labels:  home-assistant, homeassistant, hacs
openrgb ha
OpenRGB integration for Home Assistant
Stars: ✭ 40 (+33.33%)
Mutual labels:  home-assistant, homeassistant, hacs
lovelace-valetudo-map-card
Draws the map available from a Xiaomi Vacuum cleaner flashed with Valetudo in a Home Assistant Lovelace card
Stars: ✭ 149 (+396.67%)
Mutual labels:  home-assistant, homeassistant, hacs
ocpp
Home Assistant integration for electric vehicle chargers that support the Open Charge Point Protocol (OCPP).
Stars: ✭ 82 (+173.33%)
Mutual labels:  home-assistant, homeassistant, hacs
purifier-card
Air Purifier card for Home Assistant Lovelace UI
Stars: ✭ 155 (+416.67%)
Mutual labels:  home-assistant, homeassistant, hacs
hifiberry
This is a custom component to allow control of HifiberryOS devices in Home Assistant using the audiocontrol2 REST API.
Stars: ✭ 26 (-13.33%)
Mutual labels:  home-assistant, hacs
github-custom-component-tutorial
A tutorial for creating a custom component for Home Assistant using GitHub's API.
Stars: ✭ 31 (+3.33%)
Mutual labels:  home-assistant, homeassistant
google fit hass
A Home assistant custom component to get your fitness information using Google Fitness API.
Stars: ✭ 23 (-23.33%)
Mutual labels:  home-assistant, homeassistant
home assistant adax
Integration for Adax heaters
Stars: ✭ 24 (-20%)
Mutual labels:  homeassistant, hacs
uptime-card
Minimalistic uptime card for Home Assistant Lovelace UI
Stars: ✭ 152 (+406.67%)
Mutual labels:  home-assistant, hacs
Home-Assistant-Config
🏠 My huizebruin Home Assistant configuration, Be sure to 🌟 this repository for updates! huizebruin
Stars: ✭ 29 (-3.33%)
Mutual labels:  home-assistant, homeassistant

sensor.avanza_stock

GitHub Release GitHub Activity License

hacs Project Maintenance BuyMeCoffee

Custom component to get stock data from Avanza for Home Assistant.

Installation

  • The easiest way is to install it with HACS. First install HACS if you don't have it yet. After installation you can find this custom component in the HACS store under integrations.

  • Alternatively, you can install it manually. Just copy paste the content of the sensor.avanza_stock/custom_components folder in your config/custom_components directory. As example, you will get the sensor.py file in the following path: /config/custom_components/avanza_stock/sensor.py.

Configuration

key type description
platform (Required) string avanza_stock
stock (Required) number / list Stock id or list of stocks, see here and here.
name (Optional) string Name of the sensor. Default avanza_stock_{stock}. Redundant if stock is defined as a list.
shares (Optional) number Number of shar, can be fractional. Redundant if stock is defined as a list.
purchase_date (Optional) string Date when stock was purchased. Redundant if stock is defined as a list. Does not get processed further.
purchase_price (Optional) number Price paid when stock was purchased (per share). Redundant if stock is defined as a list.
conversion_currency (Optional) number Index id used for currency conversion, see here.
monitored_conditions (Optional) list Attributes to monitor, see here.
invert_conversion_currency (Optional) boolean Wether or not to invert the conversion currency, default false.
currency (Optional) string Overwrite currency given by the api.

Stock configuration

key type description
id (Required) number Stock id, see here.
name (Optional) string Name of the sensor. Default avanza_stock_{stock}.
shares (Optional) number Number of shares, can be fractional.
purchase_date (Optional) string Date when stock was purchased. Does not get processed further.
purchase_price (Optional) number Price paid when stock was purchased (per share).
conversion_currency (Optional) number Index id used for currency conversion, see here.
invert_conversion_currency (Optional) boolean Wether or not to invert the conversion currency, default false.
currency (Optional) string Overwrite currency given by the api.

Monitored conditions

If no monitored_conditions is defined, change, changePercent and name will be tracked. Full list of available attributes, see here

Finding stock or conversion currency

Got to Avanza and search for the stock you want to track. In the resulting url there is a number, this is the stock id needed for the configuration. Even though it is a Swedish bank it is possible to find stocks from the following countries: Sweden, USA, Denmark, Norway, Finland, Canada, Belgium, France, Italy, Netherlands, Portugal and Germany. To find conversion currencies search for example "USD/SEK" and look for the id in the resulting url. If you can not find your conversion try and search the reverse (NOK/SEK instead of SEK/NOK) and use the invert_conversion_currency to get your preffered currency.

Example

Configuration with default settings:

sensor:
  - platform: avanza_stock
    stock: 5361

Configuration with custom settings:

sensor:
  - platform: avanza_stock
    name: Avanza Bank Holding
    stock: 5361
    monitored_conditions:
      - totalVolumeTraded
      - totalValueTraded

Configuration with multiple stocks:

sensor:
  - platform: avanza_stock
    stock:
      - id: 5361
        name: Avanza Bank Holding
      - id: 8123
        name: Home Assistant
    monitored_conditions:
      - totalVolumeTraded
      - totalValueTraded

Configuration with conversion currency:

sensor:
  - platform: avanza_stock
    stock:
      - id: 238449
        name: TESLA USD
        shares: 1
        purchase_price: 600
      - id: 238449
        name: TESLA SEK
        shares: 1
        conversion_currency: 19000
        purchase_price: 7000
      - id: 5361
        name: Avanza Bank Holding (NOK)
        conversion_currency: 53293
        invert_conversion_currency: true

Usage

Automation to send summary at 18:00 using telegram:

# Telegram Stock Summary
- alias: 'Telegram Stock Summary'
  initial_state: true

  trigger:
    - platform: time
      at: '18:00:00'

  action:
    - service: notify.telegram
      data:
        message: '
<b>Stock Summary </b>
<code>
{{ states.sensor.avanza_stock_5361.attributes.name }} : {{ states.sensor.avanza_stock_5361.attributes.changePercent }}
</code>
'

Changelog

  • 1.0.12 - Add unique id
  • 1.0.11 - Rename device state attributes
  • 1.0.10 - Safely remove divident attributes
  • 1.0.9 - Add purchase date attribute (string manually set by user)
  • 1.0.8 - Correct profit/loss when using conversion currency
  • 1.0.7 - Overwrite currency given by the api
  • 1.0.6 - Correct unit when using conversion currency
  • 1.0.5 - Add option to invert conversion currency
  • 1.0.4 - Configure conversion currency and define purchase price
  • 1.0.3 - Allow to define multiple stocks
  • 1.0.2 - Async update
  • 1.0.1 - Allow fractional shares, add more change attributes
  • 1.0.0 - Add number of shares as optional configuration
  • 0.0.10 - Clean up monitored conditions
  • 0.0.9 - Compare payment date with today's date, ignore time
  • 0.0.8 - Ignore dividend if amount is zero, add resources.json and manfiest.json
  • 0.0.7 - Changed to async setup
  • 0.0.6 - Make sure dividend payment date has not passed
  • 0.0.5 - Add dividends information
  • 0.0.4 - Add companny information (description, marketCapital, sector, totalNumberOfShares)
  • 0.0.3 - Add key ratios (directYield, priceEarningsRatio, volatility)
  • 0.0.2 - Configure monitored conditions
  • 0.0.1 - Initial version
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].