jbms / beancount-import

Web UI for semi-automatically importing external data into beancount
GNU General Public License v2.0
393 stars 103 forks source link

Price fetch reads yesterday's price #6

Open hnws opened 6 years ago

hnws commented 6 years ago

This is what I got in the prices_output_map file: 2018-10-31 price FAS 56.4500000 USD And (pyenv) [xxxx@av beancount]$ bean-price -e USD:yahoo/FAS I got output of 2018-10-31 price FAS 58.5499999999999971578290569595992565155029296875 USD According to image 58.55 is 10-31's close price and 56.45 is 10-30's close.

I spent some time trying to fix this, however I cannot find any obvious place this price is fetched. Would you please take a look? Or please let me know which code should I look at so I can attempt a fix?

jbms commented 6 years ago

Price entries get added in ofx.py here: https://github.com/jbms/beancount-import/blob/ec40120c751c83e21407407a172138c778ad6490/beancount_import/source/ofx.py#L1108

They are derived from INVPOS entries in the OFX file, which are parsed here: https://github.com/jbms/beancount-import/blob/ec40120c751c83e21407407a172138c778ad6490/beancount_import/source/ofx.py#L659

You might want to check what is in your ofx files. It is possible the issue is related to time zones --- dates and times are bit tricky to deal with --- so I'm guessing there is room for improvement. Alternatively there could be an option to just not import the prices at all.