Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
claha committed Aug 31, 2020
1 parent 92169dc commit 2caaf97
Showing 1 changed file with 47 additions and 93 deletions.
140 changes: 47 additions & 93 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# sensor.avanza_stock

[![GitHub Release][releases-shield]][releases]
[![GitHub Activity][commits-shield]][commits]
[![License][license-shield]](LICENSE)
Expand All @@ -11,6 +12,7 @@ _Custom component to get stock data from [Avanza](https://www.avanza.se) for
[Home Assistant](https://www.home-assistant.io/)._

## Installation

- The easiest way is to install it with [HACS](https://hacs.xyz/). First install
[HACS](https://hacs.xyz/) if you don't have it yet. After installation you can
find this custom component in the HACS store under integrations.
Expand All @@ -21,102 +23,49 @@ 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 of stocks | The stock id or list of stocks, see below how to define the list. Also see below how to find the id.
**name (Optional)** | string | Custom name for the sensor. Default `avanza_stock_{stock}`. Redundant if stock is defined as a list.
**shares (Optional)** | number | The number of shares you own of this stock, can be fractional. Redundant if stock is defined as a list.
**purchase_price (Optional)** | number | The price paid when stock was purchased.
**conversion_currency (Optional)** | number | The index id used for currency conversion. Also see below how to find the id.
**monitored_conditions (Optional)** | list | Defines the attributes of the sensor, see below.
**platform (Required)** | string | `avanza_stock`
**stock (Required)** | number / list | Stock id or list of stocks, see [here](#stock-configuration) and [here](#finding-stock-or-conversion-currency).
**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_price (Optional)** | number | Price paid when stock was purchased. Redundant if stock is defined as a list.
**conversion_currency (Optional)** | number | Index id used for currency conversion, see [here](#finding-stock-or-conversion-currency).
**monitored_conditions (Optional)** | list | Attributes to monitor, see [here](#monitored-conditions).
**invert_connversion_currency (Optional)** | boolean | Wether or not to invert the conversion currency, default false.

### Stock configuration

key | type | description
:--- | :--- | :---
**id (Required)** | number | The stock id, see below how to find it.
**name (Optional)** |string | Custom name for the sensor. Default `avanza_stock_{stock}`.
**shares (Optional)** | number | The number of shares you own of this stock, can be fractional.
**purchase_price (Optional)** | number | The price paid when stock was purchased.
**conversion_currency (Optional)** | number | The index id used for currency conversion, see below how to find it.
**id (Required)** | number | Stock id, see [here](#finding-stock-or-conversion-currency).
**name (Optional)** | string | Name of the sensor. Default `avanza_stock_{stock}`.
**shares (Optional)** | number | Number of shares, can be fractional.
**purchase_price (Optional)** | number | Price paid when stock was purchased.
**conversion_currency (Optional)** | number | Index id used for currency conversion, see [here](#finding-stock-or-conversion-currency).
**invert_connversion_currency (Optional)** | boolean | Wether or not to invert the conversion currency, default false.

### Monitored conditions
The following attributes are tracked if `monitored_conditions` is not defined.
* change
* changePercent
* name

Full list of available attributes.
* change
* changePercent
* country
* currency
* description
* directYield
* dividends
* flagCode
* hasInvestmentFees
* highestPrice
* id
* isin
* lastPrice
* lastPriceUpdated
* loanFactor
* lowestPrice
* marketCapital
* marketList
* marketMakerExpected
* marketPlace
* marketTrades
* morningStarFactSheetUrl
* name
* numberOfOwners
* orderDepthReceivedTime
* priceAtStartOfYear
* priceEarningsRatio
* priceFiveYearsAgo
* priceOneMonthAgo
* priceOneWeekAgo
* priceOneYearAgo
* priceSixMonthsAgo
* priceThreeMonthsAgo
* priceThreeYearsAgo
* pushPermitted
* quoteUpdated
* sector
* shortSellable
* superLoan
* tickerSymbol
* totalNumberOfShares
* totalValueTraded
* totalVolumeTraded
* tradable
* volatility

### Finding stock or index id
Got to [Avanza](https://www.avanza.se) 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
* Germany

If no `monitored_conditions` is defined, change, changePercent and name will be tracked. Full list of available attributes, see [here](custom_components/avanza_stock/const.py#L12)

### Finding stock or conversion currency

Got to [Avanza](https://www.avanza.se) 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.

## Example

**Configuration with default settings:**

```yaml
sensor:
- platform: avanza_stock
stock: 5361
```
**Configuration with custom settings:**
```yaml
sensor:
- platform: avanza_stock
Expand All @@ -128,6 +77,7 @@ sensor:
```
**Configuration with multiple stocks:**
```yaml
sensor:
- platform: avanza_stock
Expand All @@ -142,7 +92,9 @@ sensor:
```
## Usage
**Automation to send summary at 18:00 using telegram:**
```yaml
# Telegram Stock Summary
- alias: 'Telegram Stock Summary'
Expand All @@ -164,21 +116,23 @@ sensor:
```
## Changelog
* 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
- 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
[buymecoffee]: https://www.buymeacoffee.com/claha
[buymecoffeebadge]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?style=for-the-badge
Expand Down

0 comments on commit 2caaf97

Please sign in to comment.