Closed edwintorok closed 4 years ago
@edwintorok I know it has been a while since you posted this, but I have finally implemented something (released in v 0.13.1) that can deal with prices.
In the off chance that you still find this useful, please have a look: https://github.com/apauley/hledger-flow/#price-files
Is your feature request related to a problem? Please describe.
I want to import historic currency exchange rates and stock prices into hledger-flow. Unfortunately using a
construct
script doesn't work because hledger-flow filters out and only retains transactions, not prices, see https://github.com/apauley/hledger-flow/blob/14e0150e8c162727a077cac9e7ff02b8c90b4d56/src/Hledger/Flow/CSVImport.hs#L112Version and Runtime Information
Is this the latest version?
No
Our Example Statements Repository
FYI, we have a repo with some example transactions which you can use to run
hledger-flow
on: https://github.com/apauley/hledger-flow-exampleCan you give examples of what you would like by running
hledger-flow
on these files?No, they do not contain prices.
Describe the solution you'd like It should be possible to import prices, not just transactions. First step would be to have an equivalent of the
construct
script that can output only prices in a format that hledger understands. A second step would be to have support for csv import rules that can deal with the various date formats and convert to hledger format.Describe alternatives you've considered
I wrote a script that generates .journal files and puts them into a
_manual_
folder. This is a bit of a hack, because it is not part of the usualhledger-flow import
, I have to run it separetely. What I ended up having is this:Additional context
Obtaining the prices themselves is another matter, but that is independent of hledger-flow. What I did was just copy/paste the tables from here, but this could easily be automated by something that fetches the webpage and parses it.
For example investment stock prices can be fetched from (using a random example), you can view 1 year ranges: https://markets.ft.com/data/funds/tearsheet/historical?s=GB0033053710:GBX
Currencies can be found in a similar place, see: https://github.com/barrucadu/hledger-scripts/blob/master/market-prices/market-prices.py
Stock prices can be found here (again using a random example) https://uk.finance.yahoo.com/quote/GOOG/history/?guccounter=1
I haven't done anything interesting with the prices yet, other than being able to see how much I own were I to convert everything into GBP right now, so having daily price granularity is probably an overkill, but it was the easiest way to obtain the data.