I copied the previously-posted excerpt to a file and ran it to see if it
worked.  That showed me I left out one line from the original file.  Here's
the code that works:

1970-01-01 open Assets:Certs:AAPL
1970-01-01 open Assets:MYBroker:AAPL
1970-01-01 open Assets:Cash:Basis

1983-01-05 * "A Note"
    Assets:Certs:AAPL        20 AAPL {34.31 USD, 1983-01-05}
    Assets:Cash:Basis

1983-04-05 * "A Note"
    Assets:Certs:AAPL        18 AAPL {47.57 USD, 1983-04-05}
    Assets:Cash:Basis

1983-05-10 * "stock move"
    Assets:MYBroker:AAPL           20 AAPL
    Assets:MYBroker:AAPL           18 AAPL
    Assets:Certs:AAPL          -20 AAPL
    Assets:Certs:AAPL          -18 AAPL

; zero local shares now
1983-05-11 balance Assets:Certs:AAPL 0 AAPL

What seems to be key is dropping the date specifier on the MYBroker
shares.

Is it safe to assume that the bought date (and the basis) comes along with
the stock move?  I didn't think it did, and I haven't found a report that
shows that yet.

Bill

On Tue, Aug 28, 2018 at 7:04 AM <[email protected]> wrote:

> I'm a long-time Ledger user but new to beancount.  I moved, because I
> think I see functionality I can use right now (so thanks!).
>
> I'm starting by trying to handle some investments, and I'm stuck on a
> seemingly simple transaction that gets the above error.
>
> The goal:
>
>
>    - Open a few accounts for a stock.  In this case, I have an account of
>    certificated shares and an account of book-entry shares at a broker.
>    - Acquire shares as certificates, and then move them to book entry.
>
> The code (excerpted and cleaned*)
>
> 1970-01-01 open Assets:Certs:AAPL
> 1970-01-01 open Assets:MYBroker:AAPL
>
> 1983-01-05 * "A Note"
>     Assets:Certs:AAPL        20 AAPL {34.31 USD, 1983-01-05}
>     Assets:Cash:Basis
>
> 1983-04-05 * "A Note"
>     Assets:Certs:AAPL        18 AAPL {47.57 USD, 1983-04-05}
>     Assets:Cash:Basis
>
> 1983-05-10 * "stock move"
>     Assets:MYBroker:AAPL           20 AAPL {1983-01-05}
>     Assets:MYBroker:AAPL           18 AAPL {1983-04-05}
>     Assets:Certs:AAPL          -20 AAPL {1983-01-05}
>     Assets:Certs:AAPL          -18 AAPL {1983-04-05}
>
> ; zero local shares now
> 1983-05-11 balance Assets:Certs:AAPL 0 AAPL
>
>
>
> If I run bean-report filename print on that (real) file, i get
> "beancount:84:      Failed to categorize posting 1", where 84 points to the
> first leg of the "stock move" transaction.  I also get the same error on
> line 85, the second leg.  If I swap the first two legs with the second two,
> the error follows the "MBroker" legs.
>
> The subsequent balance assertion obviously fails.
>
> Any tips?  It's probably obvious, but I can't see it.
>
>
> Thanks,
>
> Bill
>
> * Has anyone ever made a routine to "clean"--remove PII--from a beancount
> file?  I don't really want to share my financial information, but I know
> it's often useful to share actual data files.  It would be nice to have a
> script that could take entries such as Assets:Certificate:AAPL and turn
> turn it into something like Assets:LevelA1:LevelB1 or the like.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Beancount" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/beancount/-8YsnPkuLLc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/9c9dcc5f-72bf-44b2-aaf9-4e0c07cbff77%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/9c9dcc5f-72bf-44b2-aaf9-4e0c07cbff77%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Bill Harris
http://makingsense.facilitatedsystems.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAOBquGqaearjAvRWor%3DeXXnz2US31o5_okTiz8srBo_Yv3N93Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to