-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
128 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
default_config: | ||
logger: | ||
default: error | ||
logs: | ||
custom_components.yahoofinance: debug | ||
|
||
|
||
sensor: | ||
platform: yahoofinance | ||
use_trending_icon: True | ||
symbols: | ||
default_config: | ||
logger: | ||
default: error | ||
logs: | ||
custom_components.yahoofinance: debug | ||
|
||
|
||
sensor: | ||
platform: yahoofinance | ||
show_trending_icon: True | ||
symbols: | ||
- ISTNX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
# Summary | ||
A custom component to get stock updates from Yahoo finance. | ||
|
||
# Installation | ||
|
||
This can be installed by copying all the files from `custom_components/yahoofinance/` to `<config directory>/custom_components/yahoofinance/`. | ||
|
||
Next you would define the symbols to be tracked in `configuration.yaml` | ||
|
||
Example: | ||
|
||
```yaml | ||
sensor: | ||
platform: yahoofinance | ||
scan_interval: | ||
hours: 4 | ||
symbols: | ||
- ISTNX | ||
|
||
``` | ||
|
||
The above configuration will generate an entity with the id `yahoofinance.istnx` and current value as the state along with these attributes: | ||
|
||
``` | ||
attribution: Data provided by Yahoo Finance | ||
currencySymbol: $ | ||
symbol: ISTNX | ||
fiftyDayAverage: ... | ||
previousClose: ... | ||
unit_of_measurement: USD | ||
friendly_name: Ivy Science & Technology Fund C | ||
icon: mdi:currency-usd | ||
``` | ||
|
||
`scan_interval` is optional and the default value is 6 hours. | ||
|
||
|
||
# Summary | ||
A custom component to get stock updates from Yahoo finance. | ||
|
||
# Installation | ||
|
||
This can be installed by copying all the files from `custom_components/yahoofinance/` to `<config directory>/custom_components/yahoofinance/`. | ||
|
||
Next you would define the symbols to be tracked in `configuration.yaml` | ||
|
||
Example: | ||
|
||
```yaml | ||
sensor: | ||
platform: yahoofinance | ||
show_trending_icon: true | ||
scan_interval: | ||
hours: 4 | ||
symbols: | ||
- ISTNX | ||
|
||
``` | ||
|
||
The above configuration will generate an entity with the id `yahoofinance.istnx` and current value as the state along with these attributes: | ||
|
||
``` | ||
attribution: Data provided by Yahoo Finance | ||
currencySymbol: $ | ||
symbol: ISTNX | ||
fiftyDayAverage: ... | ||
previousClose: ... | ||
unit_of_measurement: USD | ||
friendly_name: Ivy Science & Technology Fund C | ||
icon: mdi:currency-usd | ||
``` | ||
|
||
`scan_interval` is optional and the default value is 6 hours. Trending icon (up, down or neutral) can be used instead of currency based | ||
icon by specifying `show_trending_icon`. | ||
|
||
The component also exposes the service `yahoofinance.refresh_symbols` which will refresh all the data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
"""Constants for Yahoo Finance sensor.""" | ||
|
||
ATTR_CURRENCY_SYMBOL = "currencySymbol" | ||
ATTR_FIFTY_DAY_AVERAGE = "fiftyDayAverage" | ||
ATTR_FIFTY_DAY_SYMBOL = "symbol" | ||
ATTR_PREVIOUS_CLOSE = "previousClose" | ||
ATTRIBUTION = "Data provided by Yahoo Finance" | ||
BASE = "https://query1.finance.yahoo.com/v7/finance/quote?symbols=" | ||
CONF_SYMBOLS = "symbols" | ||
DEFAULT_CURRENCY = "USD" | ||
DEFAULT_CURRENCY_SYMBOL = "$" | ||
DEFAULT_ICON = "mdi:currency-usd" | ||
DOMAIN = "yahoofinance" | ||
SERVICE_REFRESH = "refresh_symbols" | ||
|
||
CURRENCY_CODES = { | ||
"bdt": "৳", | ||
"brl": "R$", | ||
"btc": "₿", | ||
"cny": "¥", | ||
"eth": "Ξ", | ||
"eur": "€", | ||
"gbp": "£", | ||
"ils": "₪", | ||
"inr": "₹", | ||
"jpy": "¥", | ||
"krw": "₩", | ||
"kzt": "лв", | ||
"ngn": "₦", | ||
"php": "₱", | ||
"rial": "﷼", | ||
"rub": "₽", | ||
"sign": "", | ||
"try": "₺", | ||
"twd": "$", | ||
"usd": "$", | ||
} | ||
"""Constants for Yahoo Finance sensor.""" | ||
|
||
ATTR_CURRENCY_SYMBOL = "currencySymbol" | ||
ATTR_FIFTY_DAY_AVERAGE = "fiftyDayAverage" | ||
ATTR_FIFTY_DAY_SYMBOL = "symbol" | ||
ATTR_PREVIOUS_CLOSE = "previousClose" | ||
ATTRIBUTION = "Data provided by Yahoo Finance" | ||
BASE = "https://query1.finance.yahoo.com/v7/finance/quote?symbols=" | ||
CONF_SHOW_TRENDING_ICON = "show_trending_icon" | ||
CONF_SYMBOLS = "symbols" | ||
DEFAULT_CURRENCY = "USD" | ||
DEFAULT_CURRENCY_SYMBOL = "$" | ||
DEFAULT_ICON = "mdi:currency-usd" | ||
DOMAIN = "yahoofinance" | ||
SERVICE_REFRESH = "refresh_symbols" | ||
|
||
CURRENCY_CODES = { | ||
"bdt": "৳", | ||
"brl": "R$", | ||
"btc": "₿", | ||
"cny": "¥", | ||
"eth": "Ξ", | ||
"eur": "€", | ||
"gbp": "£", | ||
"ils": "₪", | ||
"inr": "₹", | ||
"jpy": "¥", | ||
"krw": "₩", | ||
"kzt": "лв", | ||
"ngn": "₦", | ||
"php": "₱", | ||
"rial": "﷼", | ||
"rub": "₽", | ||
"sign": "", | ||
"try": "₺", | ||
"twd": "$", | ||
"usd": "$", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters