diff --git a/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade b/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade index 554c155a7f..b4b0b41688 100644 --- a/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade +++ b/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade @@ -1125,6 +1125,7 @@ many months before the current month: True + False start <b>General</b> True @@ -1613,6 +1614,7 @@ many months before the current month: True + False start 12 Time to _wait for answer: @@ -2520,6 +2522,7 @@ many months before the current month: True + False start 12 Number of _characters for auto complete: @@ -3253,6 +3256,52 @@ many months before the current month: False + + + True + False + 6 + 6 + 6 + + + True + False + Alpha Vantage API key + + + 0 + 0 + + + + + True + True + To retrieve online quotes from Alphavantage, this key needs to be set. A key can be retrieved from the Alpha Vantage website. + + + 1 + 0 + + + + + 9 + + + + + True + False + start + Online Quotes + + + 9 + False + + True diff --git a/gnucash/gnome/gschemas/CMakeLists.txt b/gnucash/gnome/gschemas/CMakeLists.txt index 3bf24489f7..03a5a8760f 100644 --- a/gnucash/gnome/gschemas/CMakeLists.txt +++ b/gnucash/gnome/gschemas/CMakeLists.txt @@ -8,6 +8,7 @@ SET(gnome_GSCHEMA org.gnucash.dialogs.sxs.gschema.xml org.gnucash.dialogs.totd.gschema.xml org.gnucash.gschema.xml + org.gnucash.general.finance-quote.gschema.xml org.gnucash.window.pages.account.tree.gschema.xml org.gnucash.window.pages.gschema.xml ) diff --git a/gnucash/gnome/gschemas/org.gnucash.general.finance-quote.gschema.xml.in.in b/gnucash/gnome/gschemas/org.gnucash.general.finance-quote.gschema.xml.in.in new file mode 100644 index 0000000000..1a69fae6ae --- /dev/null +++ b/gnucash/gnome/gschemas/org.gnucash.general.finance-quote.gschema.xml.in.in @@ -0,0 +1,9 @@ + + + + '' + Alpha Vantage API key + To retrieve online quotes from Alphavantage, this key needs to be set. A key can be retrieved from the Alpha Vantage website. + + + diff --git a/libgnucash/core-utils/core-utils.scm b/libgnucash/core-utils/core-utils.scm index d02dce1f43..794ab22132 100644 --- a/libgnucash/core-utils/core-utils.scm +++ b/libgnucash/core-utils/core-utils.scm @@ -56,5 +56,6 @@ (re-export gnc-prefs-set-float) (re-export gnc-prefs-set-string) (re-export gnc-prefs-set-coords) +(re-export gnc-prefs-get-string) (define-public gnc:version (gnc-version)) diff --git a/libgnucash/scm/price-quotes.scm b/libgnucash/scm/price-quotes.scm index 1b8c0cbef4..8a154b4fbc 100644 --- a/libgnucash/scm/price-quotes.scm +++ b/libgnucash/scm/price-quotes.scm @@ -419,9 +419,9 @@ (string-append currency-str ":" (gnc-commodity-get-mnemonic commodity)) (begin - (set! saved-price (gnc-pricedb-lookup-day64 pricedb - commodity currency - gnc-time)) + (set! saved-price (gnc-pricedb-lookup-day-t64 pricedb + commodity currency + gnc-time)) (if (not (null? saved-price)) (begin (if (gnc-commodity-equiv (gnc-price-get-currency saved-price) @@ -465,6 +465,13 @@ #f))) prices))) + ;; Add the alphavantage api key to the environment. This value is taken from + ;; the Online Quotes preference tab + (let* ((alphavantage-api-key (gnc-prefs-get-string "general.finance-quote" "alphavantage-api-key"))) + (gnc:debug (string-concatenate (list "ALPHAVANTAGE_API_KEY=" alphavantage-api-key))) + (if (not (string-null? alphavantage-api-key)) + (setenv "ALPHAVANTAGE_API_KEY" alphavantage-api-key))) + ;; FIXME: uses of gnc:warn in here need to be cleaned up. Right ;; now, they'll result in funny formatting. diff --git a/po/POTFILES.in b/po/POTFILES.in index bedea12c58..d48e93b26c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -91,6 +91,7 @@ gnucash/gnome/gnc-split-reg.c [type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.reconcile.gschema.xml.in.in [type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in [type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.dialogs.totd.gschema.xml.in.in +[type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.general.finance-quote.gschema.xml.in.in [type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.gschema.xml.in.in [type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in.in [type: gettext/gsettings]gnucash/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in diff --git a/src/gnome/gschemas/org.gnucash.general.finance-quote.gschema.xml.in.in b/src/gnome/gschemas/org.gnucash.general.finance-quote.gschema.xml.in.in new file mode 100644 index 0000000000..1a69fae6ae --- /dev/null +++ b/src/gnome/gschemas/org.gnucash.general.finance-quote.gschema.xml.in.in @@ -0,0 +1,9 @@ + + + + '' + Alpha Vantage API key + To retrieve online quotes from Alphavantage, this key needs to be set. A key can be retrieved from the Alpha Vantage website. + + +