iprak / yahoofinance

Home Assistant component which allows you to get stock updates from Yahoo finance.
MIT License
81 stars 11 forks source link

DJI, SNP, NASDAQ displaying in USD should be integer #110

Closed FS1961 closed 9 months ago

FS1961 commented 10 months ago

How do I set this to give results in sensor only as integer instead of currency?

iprak commented 10 months ago

The values will be decimal, that matches values returned by Yahoo finance.

iprak commented 10 months ago

But you can force rounding using decimal_places (see Readme) for all symbols.

FS1961 commented 10 months ago

Maybe I wasn’t clear. For instance, I have this Index (NASDAQ) which should report as volume not USD. How can I lose the USD and just have it reported as a number?

IMG_1753

iprak commented 10 months ago

The entities have the state_class of measurement which goes along with a unit_of_measurement which is USD in this case. If the symbol represents conversion e.g. USDEUR=X, then the unit will be EUR. There is no option to remove this.

FS1961 commented 10 months ago

Okay. I understand. It’s just that these are not dollar values like a normal stock - they are how many stocks are traded - volume. I will try and format this some how. Thanks! On Jan 25, 2024, at 1:04 PM, Indu Prakash @.***> wrote: The entities have the state_class of measurement which goes along with a unit_of_measurement which is USD in this case. If the symbol represents conversion e.g. USDEUR=X, then the unit will be EUR. There is no option to remove this.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

iprak commented 10 months ago

I did not know that. I will take a look at the data returned.. maybe something can be used to differentiate this or we could just use the fact that the symbol starts with ^.

FS1961 commented 10 months ago

Thank you. On Jan 25, 2024, at 6:02 PM, Indu Prakash @.***> wrote: I did not know that. I will take a look at the data returned.. maybe something can be used to differentiate this or we could just use the fact that the symbol starts with ^.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

iprak commented 10 months ago

So when I look up an Index in YahooFinance, it shows with a currency which makes me think that these are calculated currency values. image

And since indices are based on different currency so currency should be included. image

And the data seems to be the similar for non-index symbols image

FS1961 commented 10 months ago

Yes and no. Since these indices are based on US stock markets, they are “tied” to USD.

Here is a good example of how this works. https://www.investopedia.com/ask/answers/040215/what-does-sp-500-index-measure-and-how-it-calculated.asp

You may be correct that it can’t be removed but it’s not really USD. For example, the Dow Jones closed at 38,049.13 which is an index and not $38,049.13. it’s not a price. While AAPL (Apple) has a share price of $194.17.

If you can’t, I understand. I’ll try and format a variable to put in my dashboard.

Appreciate you taking the time to check this out.

Frank

On Jan 26, 2024, at 3:47 AM, Indu Prakash @.***> wrote:

So when I look up an Index in YahooFinance, it shows with a currency which makes me think that these are calculated currency values. image.png (view on web) https://github.com/iprak/yahoofinance/assets/6459774/b7dd7dbd-e1ec-460f-b47c-3b2ab6f01c35 And since indices are based on different currency so currency should be included. image.png (view on web) https://github.com/iprak/yahoofinance/assets/6459774/d4153ec3-6395-4c0c-a1f4-44f8efa8c5cc And the data seems to be the similar for non-index symbols image.png (view on web) https://github.com/iprak/yahoofinance/assets/6459774/35023385-9fde-46d0-9676-bd6ed0b954c7 — Reply to this email directly, view it on GitHub https://github.com/iprak/yahoofinance/issues/110#issuecomment-1911324539, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXPFZNTEVXRLAMWNQM527OTYQMKNZAVCNFSM6AAAAABCJKPR2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJRGMZDINJTHE. You are receiving this because you authored the thread.

iprak commented 10 months ago

See https://github.com/iprak/yahoofinance/releases/tag/v1.2.4

FS1961 commented 10 months ago

Good morning,

I’ve loaded 1.2.4

Here is my config.yaml portion but I get an error when trying to restart HA:

yahoofinance: symbols:

Can you show me where I need to put the params?

Thanks!

On Jan 27, 2024, at 1:08 AM, Indu Prakash @.***> wrote:

See https://github.com/iprak/yahoofinance/releases/tag/v1.2.4

— Reply to this email directly, view it on GitHub https://github.com/iprak/yahoofinance/issues/110#issuecomment-1912852736, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXPFZNT3OEVZ5LH3YX54A5LYQRAPRAVCNFSM6AAAAABCJKPR2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJSHA2TENZTGY. You are receiving this because you authored the thread.

iprak commented 10 months ago

The setting is on the symbol definition itself, so it would be something like this

symbols:
  - symbol: ^GSPC
    no_unit: true
FS1961 commented 10 months ago

Okay. I’ll give that a try. On Jan 27, 2024, at 2:39 PM, Indu Prakash @.***> wrote: The setting is on the symbol definition itself, so it would be something like this symbols:

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

FS1961 commented 9 months ago

Okay, works beautifully!

Thank you!

On Jan 27, 2024, at 2:39 PM, Indu Prakash @.***> wrote:

The setting is on the symbol definition itself, so it would be something like this

symbols:

FS1961 commented 9 months ago

Works perfectly!.

FS1961 commented 9 months ago

Sorry, how do you set the scan interval to 5 minutes? Your example shows hours. Thanks! On Jan 27, 2024, at 8:37 PM, Frank Spatt @.> wrote:Okay, works beautifully!Thank you!On Jan 27, 2024, at 2:39 PM, Indu Prakash @.> wrote:The setting is on the symbol definition itself, so it would be something like this symbols:

iprak commented 9 months ago

You can just do scan_interval: 300 or

scan_interval:
  minutes: 5

hours, minutes and seconds are the allows values for a period type value.

FS1961 commented 9 months ago

It’s not updating. On Jan 29, 2024, at 6:55 PM, Indu Prakash @.***> wrote: You can just do scan_interval: 300 or scan_interval: minutes: 5

hours, minutes and seconds are the allows values for a period type value.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: @.***>

iprak commented 9 months ago

To help identify what is happening would want to enable debug logging.

This is from Developer Tools: image

Please submit a separate issue.