Import prices API

Derek Atkins warlord at MIT.EDU
Sat Apr 7 10:52:05 EDT 2007


Hi,

Quoting nospamforas <nospamforas at gmx.net>:

> Am Samstag, 7. April 2007 15:35 schrieben Sie:
>> GnuCash calls the gnc-fq-helper application to get quotes.
>
> Do I only need to deal with gnc-fq-helper? There are other programs gnc-fq-*.
> I know that gnucash checks whether Finance::Quote is installed. Well it isn't
> and it won't be (see below).
>
> It would help to know, from where gnu-fq-helper is called.

Nah, that's unimportant.  But "find | xargs grep" is your friend
if you really think you need to no that.

There are two programs of consequence:  gnc-fq-check and gnc-fq-helper.
The former is used to detect whether F::Q is installed; the latter is
used to actually get quotes.  You'd have to replace both programs to hook
into the existing gnucash interface.

Try reading those programs (they are just PERL scripts).  They are
fairly well documented.

>> You could
>> replace that program with any other program you want to return quotes
>> back to Gnucash.  Run the program by hand if you want to see the
>> format of the returned data.
>>
>
> Since Finance::Quote isn't installed, I can't do this -- unfortunately. Even
> if it were installed, it would be of no use (see below). To know, how it is
> called would help (see above).

Maybe you could try, um, LOOKING at the file?  It's quite well documented.

>> I dont know if it expects to get one quote at a time or gets all quotes
>> in one run.
>>
>> There's also the scheme API (and I API) you could use if you wanted to
>> write code to install quotes.
>
> Could you tell me a little bit more? Are you talking about price-quotes.scm?

Not particularly.  I'm talking about the schemified GNCPrice* interface.

>> Also, F::Q itself has an API; it's a plugin architecture so you could plug
>> in your own module.
>>
>> But I have to ask:   why would you want to NOT use F::Q?
>>
>
> It is of no use to me, for the following reasons:
>
> (a) All modules do not fit. I would have to write my own one. I checked that
> thoroughly and repeatedly.

It's highly unlikely you're the only person in the world that's
using your uncommon price source.

> (b) I don't know perl, and I don't want to dig into it. Time is one issue.

Eh, PERL's pretty easy.. But you could always pay someone else to
do it for you.  Or maybe convince someone to do it for free..  Who
knows?

> (c) I already wrote my own module a couple of years ago. It was 
> enough then to
> copy an existing module and change it a little bit. It only took one or two
> days.

Did you send it in to get it installed into F::Q's sources?

> (d) Now I would have to write another module. This time it is much more
> complicated and I estimate that I would have to spend a lot of time to learn
> enough of perl to do it. -- Too much time.

More time than you're spending doing something else?

> (e) These modules have to be maintained once in a while. It would be 
> even more
> inefficient for me to always relearn perl just for that matter.

Why would you have to relearn it?  Do you have memory problems?

> Well, I could write a module to read quotes from a file and write my own
> program to get those quotes beforehand and write them to a file to be picked
> up by the module. But I don't like this approach. I would have to install not
> only Finance::Quote but also the modules it needs just to be able to read
> quotes from a file. The whole stuff would just need to be present....

That seems like more work than just writing a gnc-fq-helper replacement
or a real F::Q module.

> It will be much more elegant to directly plug in my own program. And if the
> gnucash community would define and freeze an interface, I guess it would help
> other people as well. But don't get me wrong: you don't need to do this just
> for me.

MAYBE...  But that's arguable.

> Thanks for any help.
>
> - AS

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list