1GNC-FQ-HELPER(1) User Contributed Perl Documentation GNC-FQ-HELPER(1)
2
3
4
6 gnc-fq-helper - allows gnucash to communicate with Finance::Quote
7 over pipes from guile. The requests and responses
8 are scheme forms.
9
11 gnc-fq-helper
12
14 Input: (on standard input - one entry per line and one line per entry,
15 and double quotes must only be delimiters, not string content --
16 remember, we don't have a real scheme parser on the perl side :>).
17
18 (<method-name> symbol symbol symbol ...)
19
20 where <method-name> indicates the desired Finance::Quote method. One
21 can list the many methods by running gnc-fq-check.
22
23 For currency quotes, the symbols alternate between the 'from' and 'to'
24 currencies.
25
26 For example:
27
28 (alphavantage "IBM" "LNUX") (fidelity_direct "FBIOX" "FSELX") (currency
29 "USD" "AUD")
30
31 Output (on standard output, one output form per input line):
32
33 Schemified version of gnc-fq's output, basically an alist of alists, as
34 in the example below. Right now, only the fields that this script
35 knows about (and knows how to convert to scheme) are returned, so the
36 conversion function will have to be updated whenever Finance::Quote
37 changes. Currently you'll get symbol, gnc:time-no-zone, and currency,
38 and either last, nav, or price. Fields with gnc: prefixes are
39 non-Finance::Quote fields. gnc:time-no-zone is returned as a string of
40 the form "YYYY-MM-DD HH:MM:SS", basically the unmolested (and
41 underspecified) output of the quote source. It's up to you to know
42 what it's proper timezone really is. i.e. if you know the time was in
43 America/Chicago, you'll need to convert it to that.
44
45 For example:
46
47 $ echo '(alphavantage "CSCO" "JDSU" "^IXIC")' | ./gnc-fq-helper
48 (("CSCO" (symbol . "CSCO")
49 (gnc:time-no-zone . "2001-03-13 19:27:00")
50 (last . 20.375)
51 (currency . "USD"))
52 ("JDSU" (symbol . "JDSU")
53 (gnc:time-no-zone . "2001-03-13 19:27:00")
54 (last . 23.5625)
55 (currency . "USD"))
56 ("^IXIC" (symbol . ^IXIC)
57 (gnc:time-no-zone . 2002-12-04 17:16:00)
58 (last . 1430.35)
59 (currency . failed-conversion)))
60
61 On error, the overall result may be #f, or on individual errors, the
62 list sub-item for a given symbol may be #f, like this:
63
64 $ echo '(alphavantage "CSCO" "JDSU")' | ./gnc-fq-helper
65 (#f
66 ("JDSU" (symbol . "JDSU")
67 (gnc:time-no-zone . "2001-03-13 19:27:00")
68 (last . 23.5625)
69 (currency . "USD")))
70
71 further, errors may be stored with each quote as indicated in
72 Finance::Quote, and whenever the conversion to scheme data fails, the
73 field will have the value 'failed-conversion, and accordingly this
74 symbol will never be a legitimate conversion.
75
76 Exit status
77
78 0 - success non-zero - failure
79
80
81
82perl v5.34.1 2022-06-27 GNC-FQ-HELPER(1)