On Mon, Mar 8, 2021 at 9:32 AM 'David E' via Beancount <
[email protected]> wrote:
> Hello, I am very new to Beancount as I want to keep track of my trading
> activities and generate reports with FIFO settings. I love the tool so far
> and the community around it.
>
> 1)
> To get started, I want to better understand how Lots are handled and
> therefore want to report active Lots. In the docs (how inventories work >
> cost basis) there is a very good example of what I am looking for
>
> ```units ccy cost cost-ccy lot-date label
> 25 HOOL {23.00 USD, 2015-04-01, "first-lot"} 35 HOOL {27.00 USD,
> 2015-05-01, None}```
>
> I tried `bean-report books.beancount holdings` but only get a total of the
> account, not the active Lots within. what else could I try?
>
This this script, which runs the booking code by hand over your
transactions and stores the matches ("trades"):
https://github.com/beancount/beanlabs/blob/master/beanlabs/trades/match_trades.py
In v3, it will be built-in and the result of booking will leave traces in
the postings in order to rebuild the trades without having to rebook
everything.
See "Trade Matching and Reporting" section of this doc:
https://docs.google.com/document/d/1qPdNXaz5zuDQ8M9uoZFyyFis7hA0G55BEfhWhrVBsfc/edit#heading=h.1on91pqrb473
In the meantime the script I shared should do the job, and will work on
current v2 branch.
>
> 2)
> As a bonus, I would like to ask how it could be possible to track my
> trades so that I can analyse the outcome. I am thinking of categories like
> timeframe or setup. The query for example could be: show me the outcome of
> all trades based on the 1H chart (this way I could see where my profits
> come from, interesting to know). problem I see is that I would have to book
> it in order to have it available to query, but I would make an entry for
> PnL instead, right?
>
You should build your own using the results of the above.
I've done a bunch of custom scripts and many of these aren't shared - not
polished enough - although last year I took some time to structure my
returns calculation based on cash flows and shared it here:
doc: http://furius.ca/beancount/doc/returns
repo: https://github.com/beancount/beangrow
For options and futures, I have a separate set of scripts, but those aren't
neat enough to share yet, as they remain with some amount of dependence on
my particular style of trading, strategies and they're made more
complicated by options on futures and pairs trades. I'm in a position to
have to generalize it across multiple brokers now so I may end up putting
that out there eventually.
N.B. If you're on TD, this will come in handy:
https://github.com/blais/ameritrade/blob/master/examples/ameritrade2beancount.py
I also share an IBKR importer:
https://github.com/beancount/beanlabs/blob/master/beanlabs/importers/ibkr/ibkr_flex_reports_csv.py
and have a pretty basic Tastyworks one I could share if anyone cares.
Hope this helps,
> looking forward to what you have in mind about it.
> thanks
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/b028cb55-2900-40e7-a473-c1330c5ce2dbn%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/b028cb55-2900-40e7-a473-c1330c5ce2dbn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/CAK21%2BhPvdAp2SStfH5UEe2A8aH_PFzVV8VFkVC%2BU-hmuib%3DtWA%40mail.gmail.com.