Neue Module 95_Shares.pm und 95_ShareMaster.pm

Begonnen von Prof. Dr. Peter Henning, 08 April 2022, 15:08:46

Vorheriges Thema - Nächstes Thema

Biker57

Hallo Zusammen,
ich bin gerade über die Module Shares und ShareMaster gestolpert. Bei der Definition habe ich mich an das Beispiel aus dem Wiki gehalten. Allerdings bekomme ich keine Werte geliefert. Alles 0€.
Nun zu meiner Frage: Funktioniert die Abfrage der Werte über yahoo_json noch?
Wenn ja, sind da noch die Veränderungen an den Modulen notwendig?
Gruß,
Helmut

Prof. Dr. Peter Henning

ZitatFunktioniert die Abfrage der Werte über yahoo_json noch?
Ja. Ich war zwischendurch auf Xetra gewechselt, weil Yahoo Probleme mit Open-Source-Zugriffen machte.Inzwischen ist aber alles geklärt.
ZitatWenn ja, sind da noch die Veränderungen an den Modulen notwendig?
Nein. Möglicherweise ist das zugrundeliegende Perl-Modul nicht mehr aktuell, einfach updaten.

LG

pah

Biker57

Vielen Dank für die Info.

Allerdings bin ich jetzt etwas ratlos, denn bei mir kommen nur Nullen als Ergebnis heraus. Ich habe mich an das Beispiel im Wiki gehalten. Hier meine Konfiguration:

list depot3
Internals:
   FUUID      65da0209-f33f-73de-03b4-05c7e36ff49c04aa
   NAME       Depot3
   NR         727
   STATE      0.00 EUR ( 0 % = 0.00 EUR)  2024-03-24 15:00:33
   TYPE       Shares
   eventCount 2
   .attraggr:
   .attreocr:
     depot_value
   .attrminint:
   DATA:
     categories:
   Helper:
     DBLOG:
       depot_value:
         myDbLog:
           TIME       1711288833.62758
           VALUE      0.00
       state:
         myDbLog:
           TIME       1711288832.87779
           VALUE      update
   OLDREADINGS:
   READINGS:
     2024-03-24 15:00:33   depot_change    0
     2024-03-24 15:00:33   depot_change_day 0
     2024-03-24 15:00:33   depot_diff      0.00
     2024-03-24 15:00:33   depot_diff_day  0.00
     2024-03-24 15:00:33   depot_value     0.00
     2024-03-24 15:00:33   depot_value_entry 0.00
     2024-03-24 15:00:33   exchangerate    1 EUR/EUR
     2024-03-24 15:00:33   state           0.00 EUR ( 0 % = 0.00 EUR)  2024-03-24 15:00:33
   helper:
Attributes:
   comment    Depot zum Ausprobieren
   defaultSource yahoo_json
   depotCurrency EUR:€
   event-on-change-reading depot_value
   pollInterval 1800
   queryTimeout 120
   room       Aktien
   shareCurrency EUR:€
   shareFurtherReadings change_day
   sourcesLinks yahoo_json:de.finance.yahoo.com/quote/$SYMBOL
   stocks     AI.PA:1:133.4:h2,
FRA.DE:6:258.47:mobility,
BAS.DE:3:154:chemistry,
LIN.DE:1:212:chemistry,
TKA.DE:10:72:tech,
   verbose    5

und

list Masterdepot
Internals:
   DEF        Depot3
   DepotType  master
   FUUID      65da7496-f33f-73de-0afd-11088b03b8c2cfa2
   NAME       Masterdepot
   NR         728
   STATE      Initialized
   TYPE       ShareMaster
   eventCount 15
   .attraggr:
   .attrminint:
   DATA:
     categories:
   Helper:
     DBLOG:
       depot_cat_summary:
         myDbLog:
           TIME       1711289257.67876
           VALUE     
       depot_change:
         myDbLog:
           TIME       1711289257.67876
           VALUE      0.00
       depot_change_day:
         myDbLog:
           TIME       1711289257.67876
           VALUE      0.00
       depot_diff:
         myDbLog:
           TIME       1711289257.67876
           VALUE      0.00
       depot_diff_day:
         myDbLog:
           TIME       1711289257.67876
           VALUE      0.00
       depot_summary:
         myDbLog:
           TIME       1711289257.67876
           VALUE      0.00 0.00 0.00
       depot_value:
         myDbLog:
           TIME       1711289257.67876
           VALUE      0.00
       depot_value_entry:
         myDbLog:
           TIME       1711289257.67876
           VALUE      0.00
   READINGS:
     2024-03-24 15:07:37   depot_cat_summary
     2024-03-24 15:07:37   depot_change    0.00
     2024-03-24 15:07:37   depot_change_day 0.00
     2024-03-24 15:07:37   depot_diff      0.00
     2024-03-24 15:07:37   depot_diff_day  0.00
     2024-03-24 15:07:37   depot_summary   0.00 0.00 0.00
     2024-03-24 15:07:37   depot_value     0.00
     2024-03-24 15:07:37   depot_value_entry 0.00
     2024-03-24 14:52:23   state           Initialized
   depots:
     Depot3
     Depot_Petra
     Depot_Helmut
     Depot_Beobachtung
     Depot_Test
   helper:
Attributes:
   categories Automotive,Bio,Chemistry,Commodity,Energy,Finance,H2,Health,Pharma,RealEstate,Sales,Software,Tech
   depotCurrency EUR
   pollInterval 60
   room       Aktien
   verbose    5

Ein Auszug aus der log-Datei:
2024.03.24 14:34:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:35:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:36:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:37:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:38:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:39:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:40:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:41:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:42:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:43:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:44:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:45:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:46:28 4: [ShareMaster_QueueTimer] 60 seconds
2024.03.24 14:47:14 4: [Shares_QueryQuotes] start blocking query
2024.03.24 14:47:14 4: [Shares_QueryQuotesBlocking]
2024.03.24 14:47:14 4: [Shares_QueryQuotesBlocking] query share: AI.PA from source yahoo_json
2024.03.24 14:47:14 4: [Shares_QueryQuotesBlocking] query share: FRA.DE from source yahoo_json
2024.03.24 14:47:14 4: [Shares_QueryQuotesBlocking] query share: LIN.DE from source yahoo_json
2024.03.24 14:47:14 4: [Shares_QueryQuotesBlocking] query share: TKA.DE from source yahoo_json
2024.03.24 14:47:14 4: [Shares_QueryQuotesBlocking] query share: BAS.DE from source yahoo_json
2024.03.24 14:47:14 4: [Shares_QueryQuotesBlocking] fetching from source: yahoo_json
2024.03.24 14:47:15 4: [Shares_QueryQuotesBlocking] return value: Depot3
2024.03.24 14:47:15 4: [Shares_QueryQuotesFinished]
2024.03.24 14:47:15 4: [Shares_UpdateCurrency] exchangerate = 1 for EUR/EUR in depot Depot3
2024.03.24 14:47:15 4: [Shares_QueueTimer] 1800 seconds

Sieht für mich so aus, als wenn die Abfrage abgeblockt wird. Was kann ich das verhindern?

Gruß,
Helmut

Prof. Dr. Peter Henning

Nö. Das "Blocking" bezieht sich auf die Ausführung der Anfrage in FHEM.

Bitte mal auf Betriebssystemebene ausführen

cpan Finance::Quote

LG

pah

Biker57

ok habe ich gemacht, allerdings war die Version 1.59 schon installiert gewesen:

cpan Finance::Quote
Reading '/root/.cpan/Metadata'
  Database was generated on Sat, 24 Feb 2024 21:17:02 GMT

Starting with version 2.29 of the cpan shell, a new download mechanism
is the default which exclusively uses cpan.org as the host to download
from. The configuration variable pushy_https can be used to (de)select
the new mechanism. Please read more about it and make your choice
between the old and the new mechanism by running

    o conf init pushy_https

Once you have done that and stored the config variable this dialog
will disappear.
Fetching with HTTP::Tiny:
https://cpan.org/authors/01mailrc.txt.gz
Reading '/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE

Starting with version 2.29 of the cpan shell, a new download mechanism
is the default which exclusively uses cpan.org as the host to download
from. The configuration variable pushy_https can be used to (de)select
the new mechanism. Please read more about it and make your choice
between the old and the new mechanism by running

    o conf init pushy_https

Once you have done that and stored the config variable this dialog
will disappear.
Fetching with HTTP::Tiny:
https://cpan.org/modules/02packages.details.txt.gz
Reading '/root/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Sun, 24 Mar 2024 14:41:02 GMT
............................................................................DONE

Starting with version 2.29 of the cpan shell, a new download mechanism
is the default which exclusively uses cpan.org as the host to download
from. The configuration variable pushy_https can be used to (de)select
the new mechanism. Please read more about it and make your choice
between the old and the new mechanism by running

    o conf init pushy_https

Once you have done that and stored the config variable this dialog
will disappear.
Fetching with HTTP::Tiny:
https://cpan.org/modules/03modlist.data.gz
Reading '/root/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /root/.cpan/Metadata
Finance::Quote is up to date (1.59).


Ich finde das sehr merkwürdig.

Prof. Dr. Peter Henning

#125
Ich finde das nicht merkwürdig, es ist mit hoher Wahrscheinlichkeit ein Konfigurationsfehler.
Bitte im Attribut "stocks" mal das allerletzte Komma löschen - das sollte aber den Fehler nicht verursachen.

Edit. So, ich habe das mal testweise definiert
defmod Depot3 Shares
attr Depot3 defaultSource yahoo_json
attr Depot3 depotCurrency EUR:€
attr Depot3 pollInterval 1800
attr Depot3 queryTimeout 120
attr Depot3 shareCurrency EUR:€
attr Depot3 shareFurtherReadings change_day
attr Depot3 sourcesLinks yahoo_json:de.finance.yahoo.com/quote/$SYMBOL
attr Depot3 stocks AI.PA:1:133.4:h2,\
FRA.DE:6:258.47:mobility,\
BAS.DE:3:154:chemistry,\
LIN.DE:1:212:chemistry,\
TKA.DE:10:72:tech

Und nach einem "set Depot3 update" bekomme ich als Zusammenfassung wunderbar
ZitatDepot3 1121.89 EUR ( 35.19 % = 292.02 EUR) 2024-03-25 08:19:36
und selbstverständlich nach einem Seitenreload alle Readings, siehe Bild.

Mehr kann ich dazu leider nicht sagen...

LG

pah

Biker57

Vielen Dank für die Info.

Kann schon sein, dass es bei mir ein Konfigurationsfehler ist. Leider habe ich ihn noch nicht gefunden.

Wenn ich diese Konfiguration nehme, dann bekomme ich auch entsprechende Werte:


defmod Depot_Test Shares
attr Depot_Test defaultSource bourso
attr Depot_Test depotCurrency EUR:€
attr Depot_Test pollInterval 1800
attr Depot_Test queryTimeout 120
attr Depot_Test room Aktiendepot
attr Depot_Test shareCurrency EUR:€
attr Depot_Test stocks FR0000120073:1:133.4:h2,\
DE000BASF111:3:154:chemistry,\
IE000S9YS762:1:212:chemistry,\
DE0007500001:10:72:tech,


wobei das letzte Komma keine Auswirkungen hat.


Also funktioniert bei mir die Abfrage mit yahoo_json nicht.

Prof. Dr. Peter Henning

Anleitung hier: http://finance-quote.sourceforge.net/tpj/finance-quote.txt

Und Tipp: Einfach mal die untenstehende raw-Definition für "Depot3" benutzen. Natürlich mit anderem Namen, sagen wir Depot3a...

LG

pah