In my experience, unless you're dealing with a very common instrument (e.g.
US stock or ETF prices), there's no practical way to ensure that data for a
symbol you fetched from a data source will be correct. In fact, you may get
"some data" for that symbol, but the price may be representing something
else. Think of prices for mutual funds, stocks on exchanges in other
countries, and currency exchange rates. You have to somehow be explicit
about where to get the data from, for which exchange, etc.  and validate
that you're indeed getting correct prices.

Writing an external (Python) script is also what I do. I instantiate "price
fetcher" objects for each of the currencies that appear in my input file,
and each of these are configured with both the commodity name from my file
(e.g. RBF1005), the commodity name of its price (e.g. CAD) and the ticker
specific to the data source (e.g. MUTF_:RBF1005 or something like that) or
the specific exchange to get the symbol from, to disambiguate.

It's a bit underdocumented at the moment, but here are the codes I'm using,
you can cook up a script using these:
https://bitbucket.org/blais/ledgerhub/src/ed32bc7c55872825154403682f3c75af16766223/lib/python/ledgerhub/prices/google_finance.py?at=default
https://bitbucket.org/blais/ledgerhub/src/ed32bc7c55872825154403682f3c75af16766223/lib/python/ledgerhub/scripts/fetch_prices.py?at=default








On Thu, Jul 31, 2014 at 3:52 PM, Dave Wells <[email protected]> wrote:

> Yeah I was afraid of that. The nice thing about Ledger doing it is that if
> a new symbol shows up, it deals with it, whereas an external script needs
> to be told what symbols are desired. Thanks for the tip, I've got some
> other ideas.
>
> Dave
>
>
> On Thursday, July 31, 2014 6:00:57 AM UTC-7, Craig Earls wrote:
>
>> The stock price update function in ledger has been severely neglected
>> for a long time.  I recommend against using it.  Use an outside shell
>> script to grab prices.  I use a python script to update my price
>> database daily then use ledger for the number crunching.
>>
>> On Thu, Jul 31, 2014 at 4:27 AM, Jostein Berntsen <[email protected]>
>> wrote:
>> > On 30.07.14,22:22, Dave Wells wrote:
>> >> Some more detail: I use the command
>> >>
>> >> $ ledger bal assets:investments:stocks -VQ
>> >>
>> >> and the following is appended to my price database:
>> >>
>> >> P 2014/07/30 22:16:43 AAPL $98.150
>> >> P 2014/07/30 22:16:43 F $17.460
>> >> P 2014/07/30 22:16:43 VALE $14.380
>> >> P 2014/07/30 22:16:44 F $17.460
>> >> P 2014/07/30 22:16:45 AAPL $98.150
>> >> P 2014/07/30 22:16:45 F $17.460
>> >> P 2014/07/30 22:16:46 VALE $14.380
>> >> P 2014/07/30 22:16:46 F $17.460
>> >>
>> >> My Assets:Investments:Stocks account has not sub-accounts. If I run
>> the
>> >> balance command on something higher up in the hierarchy, like Assets,
>> then
>> >> I get a lot more duplicates (17 entries for three stocks and a mutual
>> >> fund.) Any tips?
>> >>
>> >
>> > Have you checked what happens if you just use it like this?
>> >
>> > ledger bal assets:investments:stocks --download
>> >
>> > Jostein
>> >
>> >
>> > --
>> >
>> > ---
>> > You received this message because you are subscribed to the Google
>> Groups "Ledger" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to [email protected].
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Craig, Corona De Tucson, AZ
>> enderw88.wordpress.com
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to