cmallwitz / Financials-Extension

Extension for LibreOffice Calc to access stock market data
Other
149 stars 20 forks source link

Problem with price / currency conversion #13

Closed cmallwitz closed 3 years ago

cmallwitz commented 3 years ago

Also Im notice the bug, =GETREALTIME("MCX:MOEX";21;"GOOGLE") returns the value 15726, this is result without comma, real value is 157,26 rub.

Originally posted by @ikyquocked in https://github.com/cmallwitz/Financials-Extension/issues/10#issuecomment-770029872

cmallwitz commented 3 years ago

Could you copy&paste output from =GETREALTIME("SUPPORT") ?

Additionally there should be a file in your user/home directory, folder .financials-extension with name "google-MCX:MOEX.html" - Could you attache this as well ?

This maybe a system or LibreCalc language setting issue. When I run the above I get 157.62

ikyquocked commented 3 years ago

=GETREALTIME("SUPPORT")

ctx=pyuno object (com.sun.star.uno.XComponentContext)0xc49d40{, supportedInterfaces={com.sun.star.uno.XComponentContext,com.sun.star.container.XNameContainer,com.sun.star.lang.XTypeProvider,com.sun.star.uno.XWeak,com.sun.star.lang.XComponent}}id(self)=334941896version=2.5.0file=C:\Users\Danila\AppData\Roaming\LibreOffice\4\user\uno_packages\cache\uno_packages\lu121561j767.tmp_\Financials-Extension.oxt\financials.pycwd=C:\Program Files\LibreOffice\programhome=C:\Users\Danilauname=Windows GIGABYTE 7 6.1.7601 AMD64 Intel64 Family 6 Model 94 Stepping 3, GenuineIntelpid=5992sys.executable=C:\Program Files\LibreOffice\program\soffice.binsys.version=3.7.7 (default, Dec 10 2020, 19:56:54) [MSC v.1925 64 bit (AMD64)]locale=(None, None)defaultlocale=('ru_RU', 'cp1251')
--

No such file like "google-MCX:MOEX.html", i see only "google-MCX" and "google-MOEX" and they are 0 bytes size. Ive started to using yahoo, its correct. // VTBBA.ME also returns error "process: 'currency'", but sometimes it works fine, its strange. I looked to js files, ex. string ['regularMarketPrice', [['raw', 1216.76], ['fmt', '1,216.76']]], I guess, maybe problem is in this parsed formatted price with symbols "," and "."? Because the real price in this case is 1216,76 (my region settings). In other cases extension works cool! Thank You!

ikyquocked commented 3 years ago

Sarepta Therapeutics stock makes error Looked in trace.log 2021-02-01 21:42:42.692400 getRealtime args=('srpt', 21.0, 'yahoo') r='Yahoo.getRealtime(srpt, 21) - urlopen: ('https://finance.yahoo.com/quote/srpt?p=srpt', 404)' 3544.451 ms 2021-02-01 21:52:38.439400 getRealtime args=('tbioa.me', 21.0, 'yahoo') r='Yahoo.getRealtime(tbioa.me, 21) - process: 'currency'' 1377.471 ms 2021-02-01 21:53:10.224400 getRealtime *args=('vtbba.me', 21.0, 'yahoo') r='Yahoo.getRealtime(vtbba.me, 21) - process: 'currency'' 1383.725 ms yahoo-srpt.js.txt

ikyquocked commented 3 years ago

Attaching js of tbioa.me with currency bug yahoo-tbioa.me.js.txt string 56 ['fromCurrency', None] string 84 ['currency', None], string 102 ['fromCurrency', None],

yahoo-vtbba.me.js.txt

cmallwitz commented 3 years ago

It is odd: Yahoo is showing USD in text on page but their data JSON block has currency as None. Not helpful! I have tried to mitigate this with a new release 2.5.1 Have a look and let me know how that works for you.

ikyquocked commented 3 years ago

Thank You so much, cmallwitz! Now it works perfect =)