After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 698769 - Support for querying the price of Bitcoin via Finance::Quote
Support for querying the price of Bitcoin via Finance::Quote
Status: RESOLVED WONTFIX
Product: GnuCash
Classification: Other
Component: Currency and Commodity
2.4.x
Other All
: Normal enhancement
: ---
Assigned To: Frank H. Ellenberger
Depends on:
Blocks:
 
 
Reported: 2013-04-24 16:48 UTC by Sam Morris
Modified: 2018-06-29 23:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fq-bitcoin.patch (3.88 KB, patch)
2013-04-24 16:48 UTC, Sam Morris
needs-work Details | Review

Description Sam Morris 2013-04-24 16:48:30 UTC
Created attachment 242344 [details] [review]
fq-bitcoin.patch

This patch adds support for querying the price of Bitcoin/Litecoin/Namecoin, etc. based on the code recently merged to Finance::Quote.
Comment 1 Geert Janssens 2013-05-18 14:01:44 UTC
Comment on attachment 242344 [details] [review]
fq-bitcoin.patch

Committed to trunk as r22988 and to 2.4 as r22990.

Thank you for your contribution!
Comment 2 Frank H. Ellenberger 2013-05-20 09:37:01 UTC
Sorry for the delay, but I had a problem with my computer.

I am not happy with this patch. Until now we had _one_ source for over hundred real currencies. Why should we add about a dozen sources for one virtual currency?
Comment 3 Frank H. Ellenberger 2013-05-20 09:39:30 UTC
Sam, can you point me to the RT entry of the F::Q change?
Comment 4 Sam Morris 2013-05-20 13:43:04 UTC
Sure, no worries. Here's the RT entry: <https://rt.cpan.org/Public/Bug/Display.html?id=84790>

I don't like the massive list of currencies either. The problem is that the market where BTC is sold for USD is separate from the market where it's sold for EUR, and so on. I believe that calling set_currency is not sufficient, because that would fetch the price in one market and then convert it to another currency, as opposed to fetching the price for the market for that other currency in the first place.

I considered using a suffix to the symbol to determine the market, but didn't do so because then the security symbol used in the Gnucash UI would be rather ugly: "BTC.USD" for instance.

So the current F::Q code ends up with a rather large list of methods being added--one for each virtual currency/real currency pair that an exchange supports. Not a problem for code calling in to F::Q, but obviously the UI for choosing which method is used is no longer ideal.

I could try making the quote source menu hierachical--there would then only be a single "Bitcoin" entry in the menu, that leads to a submenu with an entry for each currency.

Alternatively, and after thinking about it for a bit, I suppose the ugliness of the suffix method isn't really all that bad, and it does have precedence (e.g., for symbols quoted on the London Stock Exchange I already have to create a security such as "ISF.L").

Anyway, let me know what you think.
Comment 5 Frank H. Ellenberger 2013-05-20 23:46:55 UTC
Thanks for your quick answer!

The traditional currencies are fetched from yahoo and IIRC the symbol has the form aaaXbbb, where aaa and bbb are the ISO codes of the currencies.
E.g. run 
 gnc-fq-dump -v currency USD EUR
You can find examples in the comments in src/scm/price-quotes.scm

For other commodities one market only offers one base currency, so they have only the commodity symbol as criteria. E.g. Siemens at NYSE is noted in USD, in Frankfurt in EUR. So the base currency can often be derived from the place but .L returns GBP or GBp (=1/100 GBP)

I would prefer, if MtGox would expect 2 symbols as the currency module does.
Later in the price DB you would see a section BitCoin with lines of the form
Currency: GBP; Security: BitCoin; Date:...;Source:Finance::Quote; Type: Last; Price: x.yz 

Also adding the market as suffix would be fine, if you could exchange e.g. GBP against Bitcoin at different places with probably different rates. So in the current situation this is IMHO overkill. 

So as far as I  understand your module, its name is mtgox, the market is Mt.Gox
so the entry should look like 
    { FALSE, 0, 0, "Mt.Gox Bitcoin/Litecoin exchange, JP", "mtgox", "mtgox" },
and probably one or two fallback entries
    { FALSE, 0, 0, "Bitcoin (MtGox, ...)", "bitcoin", "bitcoin" },
    { FALSE, 0, 0, "Litecoin (MtGox, ...)", "litecoin", "litecoin" },

and the rest could be part of the symbol like in the currencies.

So I assume the F::Q modules currency and that in the yahoo directory could give you a clue.


Later an update of gnucash-docs/help/C/tips-appendix.xml would be fine too.

Just for completeness: https://en.bitcoin.it/wiki/MtGox/API is linked by mtgox.com
Comment 6 Geert Janssens 2013-06-11 17:15:13 UTC
What should happen here ? Should I revert the commits while we wait for an improved patch or will the improvements be made on top of the current patches ?
Comment 7 Christian Stimming 2013-07-14 18:41:29 UTC
What should happen here ? Should I revert the commits while we wait for an
improved patch or will the improvements be made on top of the current patches ?
Comment 8 Sam Morris 2013-07-15 00:50:21 UTC
Feel free to revert for the time being.
Comment 9 John Ralls 2013-08-02 18:22:38 UTC
Comment on attachment 242344 [details] [review]
fq-bitcoin.patch

Per comment 1.
Comment 10 John Ralls 2013-08-02 18:34:17 UTC
Comment on attachment 242344 [details] [review]
fq-bitcoin.patch

Change r22988 reverted in r23119 per comment 8.
Comment 11 John Ralls 2013-09-09 21:58:57 UTC
I've reverted the changes and I'm closing this bug. OP, when you've worked out a new patch, please file a new bug.
Comment 12 John Ralls 2017-09-24 22:42:08 UTC
Reassign version to 2.4.x so that individual 2.4 versions can be retired.
Comment 13 John Ralls 2018-06-29 23:15:10 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=698769. Please update any external references or bookmarks.