[GNC] Stomped with interface between GNC (v4.18) and F::Q (v1.61_02)
John Ralls
jralls at ceridwen.us
Wed May 8 22:12:48 EDT 2024
Kalpesh,
I think your price has too many digits. Try rounding it to 10E-9.
Regards,
John Ralls
> On May 8, 2024, at 09:05, Kalpesh Patel <kalpesh.patel at usa.net> wrote:
>
> Hi GNC User community -
>
>
>
> I am developing a second F::Q module of my own. The first one works fine but
> second one seems to NOT want to work no matter what. I am in middle of
> debugging it and it has stomped me why not so hoping someone might be able
> to help me zero in where I am falling sort on the flow for it. I am working
> with F::Q v1.61_02 and GNC v4.14 (4.14+(2023-03-25) build) running on
> Windows 11. (Note: I don't believe any interface change has taken place in
> GNC v5.x that would cause this but correct me here if I am wrong.).
>
>
>
> Invoking GNC with debug shows that return value is #f, which means something
> went wrong (run_executor is the "label" for my module and other modules work
> fine from the debug output):
>
>
>
> 11:19:24 DEBUG <gnc.scm> handling-request: (currency INR USD)
>
> * 11:19:24 DEBUG <gnc.scm> results: ((INR (symbol . INR) (gnc:time-no-zone .
> 2024-05-08 11:19:11) (last . 3/250) (currency . USD)))
>
> * 11:20:38 DEBUG <gnc.scm> ALPHAVANTAGE_API_KEY=NOTAREALAPIKEY
>
> * 11:20:39 DEBUG <gnc.scm> handling-request: (tsp C S L2030 I)
>
> * 11:20:43 DEBUG <gnc.scm> results: ((C (symbol . C) (gnc:time-no-zone .
> 2024-05-07 12:00:00) (last . 812423/10000) (currency . USD)) (S (symbol . S)
> (gnc:time-no-zone . 2024-05-07 12:00:00) (last . 4009/50) (currency . USD))
> (L2030 (symbol . L2030) (gnc:time-no-zone . 2024-05-07 12:00:00) (last .
> 237163/5000) (currency . USD)) (I (symbol . I) (gnc:time-no-zone .
> 2024-05-07 12:00:00) (last . 42507/1000) (currency . USD)))
>
> * 11:20:43 DEBUG <gnc.scm> handling-request: (run_executor BK)
>
> * 11:20:43 DEBUG <gnc.scm> results: (#f)
>
> * 11:20:43 DEBUG <gnc.scm> handling-request: (yahoojson ^NYA)
>
> * 11:20:44 DEBUG <gnc.scm> results: ((^NYA (symbol . ^NYA) (gnc:time-no-zone
> . 2024-05-08 12:00:00) (last . 2247813/125) (currency . USD)))
>
>
>
> Following is debug run from command line of gnc-fq-dump (which provides all
> necessary fields for quote to be valid as it does not show '** This stock
> quote cannot be used by GnuCash!' message):
>
>
>
> C:\Users\kalpesh>perl "c:\Program Files (x86)\gnucash\bin\gnc-fq-dump" -v
> run_executor BK
>
> {snip}
>
> ### [Wed May 8 11:34:40 2024] %info : {
>
> ### 'BKISIN' => '-',
>
> ### 'BKcurrency' => 'USD',
>
> ### 'BKdate' => '05/08/2024',
>
> ### 'BKisodate' => '2024-05-08',
>
> ### 'BKmethod' => 'run_executor',
>
> ### 'BKprice' => '57.64500045776367',
>
> ### 'BKsuccess' => '1',
>
> ### 'BKsymbol' => 'BK',
>
> ### 'BKtimezone' => 'EDT'
>
> ### }
>
> Finance::Quote fields Gnucash uses:
>
> symbol: BK <=== required
>
> date: 05/08/2024 <=== recommended
>
> currency: USD <=== required
>
> last: <=\
>
> nav: <=== one of these
>
> price: 57.64500045776367 <=/
>
> timezone: EDT <=== optional
>
>
>
> All fields returned by Finance::Quote for stock BK
>
>
>
> stock field value
>
> ----- ----- -----
>
> BK ISIN: -
>
> BK currency: USD
>
> BK date: 05/08/2024
>
> BK isodate: 2024-05-08
>
> BK method: run_executor
>
> BK price: 57.64500045776367
>
> BK success: 1
>
> BK symbol: BK
>
> BK timezone: EDT
>
>
>
>
>
> C:\Users\kalpesh>
>
>
>
> When running same command via YahooJSON following is the output which works
> fine (I see that it does have more information returned back):
>
>
>
> C:\Users\kalpesh>perl "c:\Program Files (x86)\gnucash\bin\gnc-fq-dump" -v
> yahoojson BK
>
> {snip}
>
> Finance::Quote fields Gnucash uses:
>
> symbol: BK <=== required
>
> date: 05/08/2024 <=== recommended
>
> currency: USD <=== required
>
> last: 57.605 <=\
>
> nav: <=== one of these
>
> price: <=/
>
> timezone: <=== optional
>
>
>
> All fields returned by Finance::Quote for stock BK
>
>
>
> stock field value
>
> ----- ----- -----
>
> BK close: 57.4
>
> BK currency: USD
>
> BK date: 05/08/2024
>
> BK div_yield: 2.8397212
>
> BK eps: 3.99
>
> BK exchange: NYSE
>
> BK high: 57.75
>
> BK isodate: 2024-05-08
>
> BK last: 57.605
>
> BK low: 57.12
>
> BK method: yahoo_json
>
> BK name: BK (The Bank of New York Mellon Cor)
>
> BK open: 57.23
>
> BK pe: 14.437344
>
> BK success: 1
>
> BK symbol: BK
>
> BK type: EQUITY
>
> BK volume: 730814
>
> BK year_range: 39.65 - 58.28
>
>
>
>
>
> C:\Users\kalpesh>
>
>
>
> Given that, why would GNC not accept the pricing? Does it have to be in a
> particular order what is returned back, or is there anything else that GNC
> wants but is not present in the returned quote from my module? Only
> difference I see is that my module returns "price" parameter while YahooJSON
> returns "last" but gnc-fq-dump states that either is acceptable for GNC
> (just for kicks-&-giggles I set my module to return last instead of price
> and removed timezone but it made no difference, ie., GNC still did not take
> it as valid pricing). I prefer to limit number of returned elements to be
> very minimal for speed reasons but still entails valid pricing. Any insight
> will be greatly appreciated.
>
>
>
>
>
>
>
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
More information about the gnucash-user
mailing list