Re: Introducing Beanpost: A PostgreSQL-Based Experiment for Beancount Users

2024-04-28 Thread Martin Blais
It's not pedantic, it's totally needed at some point
It would be nice to be able to generate accurate statements from both sides
of these transactions.


On Sat, Apr 27, 2024 at 4:59 AM Brian Lalor  wrote:

> Yes, that’s the one! I might be a bit overly pedantic about setting the
> effective date, but it helps reconciling transactions with my bank.
> --
> Brian Lalor (he/him)
> bla...@bravo5.org
>
> On Apr 26, 2024, at 10:58 PM, b...@gerdemann.org wrote:
>
> 
>
> On Apr 26, 2024, at 1:53 PM, Brian Lalor  wrote:
>
>
> There’s a plugin that adds processing for an effective_date field. Maybe
> part of Reds’ suite? I use this extensively. Maybe worth exploring and
> adding explicit support for?
>
>
>
> Hi Brian,
>
> Thanks for sharing this! I wasn't aware of this plugin. Are you referring
> to this one (
> https://github.com/redstreet/beancount_reds_plugins/tree/main/beancount_reds_plugins/effective_date#readme)?
> Beanpost already supports importing and exporting metadata, so it wouldn’t
> be hard to implement this syntax.
>
> However, unlike Beancount, Beanpost doesn't require transactions to occur
> at a specific point in time. This can lead to a situation where money
> "disappears" from your assets while "in transit" between accounts. While
> this is somewhat closer to reality, it might not always be what you want.
> In this case, you could create manual holding transactions, like in the
> example.
>
> Beanpost doesn't have "plugins” yet to do things like this automatically,
> but it's something to consider for the future.
>
> To be honest, I didn't think much about allowing postings to have their
> own dates when I implemented it. This change could be undone if it causes
> more confusion or problems than it solves, but I have seen this feature
> requested for Beancount a few times.
>
> Best regards,
> Ben
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/5BAF897D-5F22-40FE-B58D-E15D9D404BD5%40gerdemann.org
> .
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/3A1E6703-508D-4051-87F9-1A51A44AF438%40bravo5.org
> 
> .
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMSJ1x8wXwKUJkgMq%2B_ZmcLL_qAbSFL8ep9-ZUthn1Ctg%40mail.gmail.com.


Re: Introducing Beanpost: A PostgreSQL-Based Experiment for Beancount Users

2024-04-24 Thread Martin Blais
Oh wow, that's crazy cool. I didn't know postgresql supported that!
Will have a more detailed look, sorry for not digging in deeper

On Mon, Apr 22, 2024, 14:46 Ben Gerdemann  wrote:

> Hi Everyone,
>
> I hope this email finds you well. I've been using Beancount for many
> years. It's been an amazing tool, and I'm grateful to this community and
> especially to Martin Blais for maintaining such a fantastic project.
>
> I'm sharing a project I've been working on called Beanpost, which you can
> find on GitHub at https://github.com/gerdemb/beanpost. This started as an
> experiment to see if I could recreate plain text accounting functionality
> using a PostgreSQL database, and it turned out more successful than I
> expected. I thought the Beancount community might find it useful and
> interesting.
>
> Beanpost consists of a PostgreSQL schema and import/export commands that
> let you transfer data between a beancount file and a PostgreSQL database.
> Much of Beancount's functionality is implemented using custom PostgreSQL
> functions, allowing for complex queries and data manipulation. This setup
> provides a flexible backend that can integrate with other tools like web
> apps or reporting systems.
>
> One of the reasons I created Beanpost was to build a mobile-friendly
> custom front-end. Fava is a fantastic tool, but it's not very
> mobile-friendly, isn't intuitive for beginners, and is hard to customize.
> With Beanpost, you have more flexibility to create a custom front-end that
> suits your needs.
>
> The included functionality is as follows:
>
>- Functions to calculate account balances or changes over a specific
>period.
>- Support for calculations on individual accounts or account
>hierarchies (e.g., "Assets").
>- Check balance assertions.
>- Verify that transactions balance.
>- Support for explicit precisions for each currency to use for balance
>tolerances.
>- Display the running balance of an account by posting.
>- Convert between currencies, including converting baskets of
>currencies.
>- Store documents as byte-data in the database.
>
> I'm curious to hear your thoughts on this approach. Would love to hear any
> feedback. I think I've implemented the majority of the required features,
> but maybe I'm missing a few things?
>
> Maybe we could call this "database-based accounting" instead of "plain
> text accounting." 
>
> Thank you for your time, and I look forward to hearing from you.
>
> Best regards,
>
> Ben
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/143e6263-3db3-4532-ae0e-eac6d7e6ffebn%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/143e6263-3db3-4532-ae0e-eac6d7e6ffebn%40googlegroups.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPwsZmzukX5vfxodBXBhoQ9U8vU_nArs%2Bed5SYDoOWz2A%40mail.gmail.com.


Re: Introducing Beanpost: A PostgreSQL-Based Experiment for Beancount Users

2024-04-22 Thread Martin Blais
Thanks for sharing, Ben,
Broadly speaking this approach will work if you don't have to match cost
basis and if you have only a single currency.
Note that export to SQL has existed for a while, but I think to be able to
most generally replace the functionality from Beancount one would need a
custom aggregator implementation (to accumulate positions with a variety of
commodities and track individual lots, i.e., the Inventory class).





On Mon, Apr 22, 2024 at 2:46 PM Ben Gerdemann  wrote:

> Hi Everyone,
>
> I hope this email finds you well. I've been using Beancount for many
> years. It's been an amazing tool, and I'm grateful to this community and
> especially to Martin Blais for maintaining such a fantastic project.
>
> I'm sharing a project I've been working on called Beanpost, which you can
> find on GitHub at https://github.com/gerdemb/beanpost. This started as an
> experiment to see if I could recreate plain text accounting functionality
> using a PostgreSQL database, and it turned out more successful than I
> expected. I thought the Beancount community might find it useful and
> interesting.
>
> Beanpost consists of a PostgreSQL schema and import/export commands that
> let you transfer data between a beancount file and a PostgreSQL database.
> Much of Beancount's functionality is implemented using custom PostgreSQL
> functions, allowing for complex queries and data manipulation. This setup
> provides a flexible backend that can integrate with other tools like web
> apps or reporting systems.
>
> One of the reasons I created Beanpost was to build a mobile-friendly
> custom front-end. Fava is a fantastic tool, but it's not very
> mobile-friendly, isn't intuitive for beginners, and is hard to customize.
> With Beanpost, you have more flexibility to create a custom front-end that
> suits your needs.
>
> The included functionality is as follows:
>
>- Functions to calculate account balances or changes over a specific
>period.
>- Support for calculations on individual accounts or account
>hierarchies (e.g., "Assets").
>- Check balance assertions.
>- Verify that transactions balance.
>- Support for explicit precisions for each currency to use for balance
>tolerances.
>- Display the running balance of an account by posting.
>- Convert between currencies, including converting baskets of
>currencies.
>- Store documents as byte-data in the database.
>
> I'm curious to hear your thoughts on this approach. Would love to hear any
> feedback. I think I've implemented the majority of the required features,
> but maybe I'm missing a few things?
>
> Maybe we could call this "database-based accounting" instead of "plain
> text accounting." 
>
> Thank you for your time, and I look forward to hearing from you.
>
> Best regards,
>
> Ben
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/143e6263-3db3-4532-ae0e-eac6d7e6ffebn%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/143e6263-3db3-4532-ae0e-eac6d7e6ffebn%40googlegroups.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhO1JLNPorhm3qweWGcHX%2BdyAJ-kjxLMbT10rh96oKgzag%40mail.gmail.com.


Re: account_unrealized_gains, account_current_conversions'

2024-04-19 Thread Martin Blais
On Mon, Apr 15, 2024 at 3:20 PM Chary Chary  wrote:

> Martin,
>
> thanks.
>
>
>- Is my understanding correct, that you   you are planning to expand
>the current 5 accounts (Assets, Liabilities, Income, Expenses, Equity) also
>with Earnings and Conversions?
>
> I'm planning nothing at this point, I'm so busy I can't even get to my
email during the week


>
>- Also, when you capture this information in options
>('account_current_conversions', 'account_unrealized_gains'), who are the
>intended consumers of this information? At the moment beanquery seems to be
>the only consumer of the *load_entries (*as reports are being phased
>out in v3)
>
> So, does beanquery do something useful with these options? Will these
> options influence any queries?
>

I just grepped the source, indeed since I deleted a bunch of code in v3
these options aren't used, they need to be deleted





>
> On Sunday, April 14, 2024 at 5:30:14 PM UTC+2 bl...@furius.ca wrote:
>
> These were defined to absorb amounts produced by summarizations described
> in
>
> https://docs.google.com/document/d/100tGcA4blh6KSXPRGCZpUlyxaRUwFHEvnz_k9DyZFn4/
>
>
> On Sun, Apr 14, 2024 at 6:38 AM Chary Chary  wrote:
>
> Martin,
>
> sorry, did you manage to have a loot at my question?
>
> On Monday, April 8, 2024 at 10:39:27 PM UTC+2 Chary Chary wrote:
>
> Martin,
>
> I am working on unrealized gains analysis in beancount  (probably somehow
> similar to what you have in v2, but the one which works also in the
> situation, where nothing is booked at cost). In fact I only tested this so
> far for the situations of booking without the cost
>
> The goal is that you can exactly see by using beanquery P query
> where the change in your net worth between 2 different periods comes from
> (even in case you move your assets between different currencies, whilst
> currency prices change).
>
> I have it working for my purposes now, but I will try to bring it to the
> state, where it can be made publicly available.
>
> I noticed, that in v3 you have the following options in beancount:
>
> 'account_current_earnings': 'Earnings:Current', 'account_current_conversions':
> 'Conversions:Current', 'account_unrealized_gains': 'Earnings:Unrealized',
>
>
> So, my questions are:
>
>
>- what are these accounts?
>
>
>- Are you planning to expand the current 5 accounts (Assets,
>Liabilities, Income, Expenses, Equity) also with Earnings and
>Conversions?
>
>
>- If yes, What is the thinking behind this?
>
>
>- What is the thinking behind booking unrealized gains to 
> 'Earnings:Unrealized',
>rather than Income: Unrealized
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> 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 beancount+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/c7865897-63a2-4cca-9ad0-f0838696fd59n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/8ee702fa-4060-4a8d-ac6e-d58443e3820en%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPJ3ShLxC2nupkuZQ3ApV1iSoYMv_c4noA1-c_MFLYu%3Dw%40mail.gmail.com.


Re: account_unrealized_gains, account_current_conversions'

2024-04-14 Thread Martin Blais
These were defined to absorb amounts produced by summarizations described
in
https://docs.google.com/document/d/100tGcA4blh6KSXPRGCZpUlyxaRUwFHEvnz_k9DyZFn4/


On Sun, Apr 14, 2024 at 6:38 AM Chary Chary  wrote:

> Martin,
>
> sorry, did you manage to have a loot at my question?
>
> On Monday, April 8, 2024 at 10:39:27 PM UTC+2 Chary Chary wrote:
>
>> Martin,
>>
>> I am working on unrealized gains analysis in beancount  (probably somehow
>> similar to what you have in v2, but the one which works also in the
>> situation, where nothing is booked at cost). In fact I only tested this so
>> far for the situations of booking without the cost
>>
>> The goal is that you can exactly see by using beanquery P query
>> where the change in your net worth between 2 different periods comes from
>> (even in case you move your assets between different currencies, whilst
>> currency prices change).
>>
>> I have it working for my purposes now, but I will try to bring it to the
>> state, where it can be made publicly available.
>>
>> I noticed, that in v3 you have the following options in beancount:
>>
>> 'account_current_earnings': 'Earnings:Current', 
>> 'account_current_conversions':
>> 'Conversions:Current', 'account_unrealized_gains': 'Earnings:Unrealized',
>>
>>
>> So, my questions are:
>>
>>
>>- what are these accounts?
>>
>>
>>- Are you planning to expand the current 5 accounts (Assets,
>>Liabilities, Income, Expenses, Equity) also with Earnings and
>>Conversions?
>>
>>
>>- If yes, What is the thinking behind this?
>>
>>
>>- What is the thinking behind booking unrealized gains to 
>> 'Earnings:Unrealized',
>>rather than Income: Unrealized
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/c7865897-63a2-4cca-9ad0-f0838696fd59n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhM65XXf4fCYvXAFXPZfkKJoS6mw%2BrBwo8K4203gF9J91w%40mail.gmail.com.


Re: Changes to support cost transfers

2024-04-13 Thread Martin Blais
- There's no dev list, this is it, not enough traffic to justify a separate
list.
- Your feature touches a very sensitive part of the booking process - one
I've struggled to get sort of right in the past, has a lot of weird
corner cases, it's been a bit of a whack-a-mole situation - I'd have to
really immerse myself back into this to give it proper review, and I don't
have time for a while.
- I would suggest adding unit tests for the specific changes it improves
would be very useful to that effect.
- In the meantime I'm happy to create for you a permanent branch in the
beancount repo itself to track this, or perhaps even better, to install a
conditional in the master branch with an option that dispatches between the
two implementations.
- The cheap (time-boxed) and easy thing I could do could be to ensure
before/after results match.
LMK what you'd like to do,



On Thu, Apr 11, 2024 at 12:10 PM Eric Altendorf 
wrote:

> I have revisited the work I did earlier to tweak Beancount to propagate
> cost basis with asset transfers.  (As has been discussed, this is a bit of
> a corner case in general, but is actually very common and important for
> capital gains calculations for cryptocurrency assets, since they are
> frequently transferred between accounts.)
>
> Digging through my git repo, it looks like what I did was this:
>
> https://github.com/beancount/beancount/compare/master...ericaltendorf:beancount:cost-transfer?expand=1
>
> I would appreciate some feedback on whether this generally looks like the
> right approach, as well as any shortcomings that would need to be addressed
> before I can send a PR to merge it into Beancount proper.
>
> Thanks,
> Eric
>
> (Is there a "beancount-dev" list that would be better to send this to? :)
>
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0u1vHW-5C32d_LvpgWXTd_quhsk-UGP8U%2BO8VU9syj3xw%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMuNzXX61TJqRawP3Cq-jK8U1Weokra9rmd19PCMbYBkw%40mail.gmail.com.


Re: Cost basis adjustment for average cost booking

2024-04-04 Thread Martin Blais
On Thu, Apr 4, 2024 at 3:45 PM Chary Chary  wrote:

> On Thursday, April 4, 2024 at 3:34:23 AM UTC+2 bl...@furius.ca wrote:
>
> are there any serious consequences of just ignoring such tiny values
> balance errors?
>
> No.
> The worse that could happen is that a larger balance gets accidentally
> absorbed by this posting (when used without an amount).
> This could be asserted by a plugin.
>
>
> Martin,
>
> can you please elaborate more on this?
>
> I was reading your answer again and again,  but I just don't get it
>

If you just put a posting with no amount it'll automatically get filled by
the remaining amount, no matter how large.
Ideally you'd want to have some sort of warning in case that's larger than
whatever is small enough to be considered a rounding amount.
There is none at the moment.




>
> How can something larger can be   gets accidentally absorbed by something
> tiny?
>
> How can posting be without an amount (I understand, it can be without
> price or cost, but how without amount?)
>
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/18d5480c-0fcc-4b95-a176-dd92bf8e10a9n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNCCkHQK3nLZE8QLhJ6-jcdWJAcK-_utC2PygGkpb9xnQ%40mail.gmail.com.


Re: Cost basis adjustment for average cost booking

2024-04-03 Thread Martin Blais
On Wed, Apr 3, 2024 at 4:04 AM Chary Chary  wrote:

>
>
> On Sunday, February 11, 2024 at 6:46:47 PM UTC+1 bl...@furius.ca wrote:
> 
>
> Practical solution: just add a little Equity:RoundingError posting to
> absorb the fraction of a cent and move on.
>
>
> Martin,
>
> are there any serious consequences of just ignoring such tiny values
> balance errors?
>
No.
The worse that could happen is that a larger balance gets accidentally
absorbed by this posting (when used without an amount).
This could be asserted by a plugin.




>
> Under consequence I would mean, that beanquery would for instance
> completely ignore such a transaction.
>
>
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/99f12786-bde1-48d3-a4e9-9849d7611631n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOpP%3DAZNPLOusqky0HOmQsM1douNhkCiZSGDXVB%3D8gv8A%40mail.gmail.com.


Re: Balance report and other common reports in v3?

2024-03-26 Thread Martin Blais
FWIW, I feel like I've implemented less than a third of the ideas I've had
for reporting, just ran out of time and energy.
It's an area where there could be a lot of fun new outputs.

About an API, I've started to sketch a simplified API in the master branch,
so that all the symbols hang off of a "beancount as bn" imprt.
https://github.com/beancount/beancount/blob/master/beancount/api.py
It's not much of a change, but ultimately the goal would be to make script
writing more prominent and more commonly used.


On Tue, Mar 26, 2024 at 6:53 PM Red S  wrote:

> Especially with things like PTA, I always wonder what someone's workflow
> looks like. Personally, I write my own scripts to spit out the 3 or 4
> reports I most frequently use exactly the way I want it. This is trivial to
> do with Beancount *since it is (also) a library *for processing your
> journal.
>
> Investor  for example, has a
> few reports that I use to various degrees. See the bottom of the README
> here
> 
>  for
> an asset allocation example, which for me is the base report I use, on top
> of which I have a bit of scripting to figure out net worth, change in net
> worth across time, what the market did across time, etc.
>
> In addition, I also use Fava's web frontend to both give me a quick
> balances overview, see net worth over time graphically (although as Chary
> pointed out, there's no indication of why net worth changed), and chase
> down answers to quick, one-time questions and such.
>
> Hope that helps.
>
> On Monday, March 25, 2024 at 3:51:22 PM UTC-7 j...@pobox.com wrote:
>
>> I'm new to beancount (but not to PTA, though rusty). I should have read
>> the docs for v3 first, but I was surprised to see there's no bean-report in
>> v3.
>>
>> What do people use to get e.g. a balance report? Same question for
>> whatever other reports people regularly find useful?
>>
>> I see there's beanquery split out into a separate repo. Do people really
>> use that just to get a balance report? (I don't mean to suggest that's bad
>> if that's the way people do it, I just suspect I'm missing something)
>>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/f159d55f-cf30-4d20-a8ea-d9cd2e7f0c66n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhM3%2B_WNa7WEQBVy1y%3D6NjV2tfj_UAzAgzJyrpptuaY99Q%40mail.gmail.com.


Re: Balance report and other common reports in v3?

2024-03-25 Thread Martin Blais
On Mon, Mar 25, 2024 at 6:58 PM fin  wrote:

> John Lee wrote:
>
> > I'm new to beancount (but not to PTA, though rusty).  I should have read
> the docs for v3 first, but I was surprised to see there's no bean-report in
> v3.
> >
> > What do people use to get e.g. a balance report?  Same question for
> whatever other reports people regularly find useful?
>

bean-query




> >
> > I see there's beanquery split out into a separate repo.  Do people
> really use that just to get a balance report?  (I don't mean to suggest
> that's bad if that's the way people do it, I just suspect I'm missing
> something)
>

yes
bean-query has moved to its own repository.
You can also build scripts against the API



>   a good question and one that will be followed by me.  :)
>
>   the two reports i use constantly right now are balance (bal)
> and networth (netw).  i haven't had time to worry about writing
> either of those using the query language because i'd like to
> finish my conversion efforts before the spring planting season
> gets here (i'm not sure i'll get all of it done, but i am
> making progress :) ).
>
>   that said, perhaps someone else has already written them?
>

balance you can do with a "select account, sum(position) ... group by
account".
net worth requires a custom script, especially depending on what you

here's something I wrote a long while ago:
https://github.com/beancount/beanlabs/blob/master/beanlabs/compensation/net-worth-over-time.py




>
>
>   fin
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/d4c9dk-06o.ln1%40anthive.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPZkrWbCTAH2HX3xckL_ogN9i9FxCsg7wjJy3S2wMEj9w%40mail.gmail.com.


Re: Seeking beta-testers/devs for crypto tax tools

2024-03-16 Thread Martin Blais
+1 to that.
I don't do package management much.
I just git clone, build locally and mangle my PYTHONPATH.


On Sat, Mar 16, 2024 at 6:51 PM Eric Altendorf 
wrote:

> On Wed, Feb 28, 2024 at 10:19 AM CD  wrote:
>
>> Thank you.  I think I have the CoinbaseImporter set up properly but it is
>> saying it can't import beangulp.
>>
>
> python package management is, IMHO, a complete disaster.  also IMHO
> beancount has lingering out of date documentation files, as well as
> multiple simultaneous versions, that make it a bit challenging to get a
> working setup.
>
> that said, magicbeans is probably even more finicky and harder to get
> running :-D
>
> if you feel like trying it out, I have a draft of some install and
> configuration instructions here:
>
> https://github.com/ericaltendorf/magicbeans/pull/1/commits/b81deb54f66d39ddd3f1b975ae0b08241c30e413
>
>
>
>>
>>
>> On Sunday, February 25, 2024 at 1:04:42 PM UTC-5 erical...@gmail.com
>> wrote:
>>
>>> If you're new to both Beancount and Python, it could be ambitious to get
>>> deep into this experimental package :)  But no harm in giving it a try!
>>>
>>> I will write some installation/getting-started docs on github and then
>>> get back to you.  Thanks for the interest!
>>>
>>> On Sat, Feb 24, 2024 at 11:28 AM CDT  wrote:
>>>
 I'm relatively new to Python scripting and have been hand entering
 things while I'm learning, but this looks very interesting considering the
 volume of transactions that can occur with cryptos when the bull market
 heats up.

 How do I install this?  (I'm using Windows 11 but I can use pip on
 command line)

 On Saturday, February 17, 2024 at 6:23:37 PM UTC-5 erical...@gmail.com
 wrote:

> It's 2024, so, time to dust off Magicbeans and prepare 2023 taxes --
> hope folks don't mind me bumping this thread.  If anyone else is 
> interested
> in using Beancount to track crypto transactions, take a look below and if
> you're willing to beta-test and help develop, feel free to reach out to 
> me.
>
> best,
> eric
>
> On Wed, Nov 1, 2023 at 3:49 AM Chary Chary  wrote:
>
>> Ok,
>>
>> thanks for clarification
>>
>> On Tuesday, October 31, 2023 at 5:30:39 PM UTC+1 erical...@gmail.com
>> wrote:
>>
>>> No worries.  I suspect that a lot of crypto traders/investors fall
>>> into these categories:
>>>
>>> - Casual users who make minimal trades on one or two exchanges.
>>> These are probably adequately served by existing commercial offerings 
>>> like
>>> cointracker.io etc.
>>> - Professional traders who already have some other professional
>>> commercial trade recording/reporting software.
>>>
>>> For people in between, who are doing something more complex
>>> (multiple exchanges, offline wallets, mining income, large numbers of
>>> transactions or lots) but are not professional traders, I suspect that
>>> probably most tax returns are full of errors that neither the filers nor
>>> the IRS are readily able to untangle.  If the amounts are low, then it's
>>> not worth either of their time.  If the amounts are large, I am not 
>>> sure.
>>> I talked to a tax preparer, asking how one would verify the numbers, 
>>> and he
>>> said that probably you'd have to engage a mid-to-large accounting firm 
>>> and
>>> hand them your raw data -- not sure how they would analyze it.  He also
>>> said that with the IRS it would probably be a bit hit and miss how an
>>> auditor would handle or analyze it -- they probably wouldn't be reading
>>> one's Python code, no :)
>>>
>>> My goal with Magicbeans was to generate PDF reports which lay out
>>> the lots in both inventories and transactions such that one could 
>>> actually
>>> manually match everything up, even if it would be tedious.  The goal 
>>> was to
>>> be able to walk into an IRS office with that report and be able to 
>>> justify
>>> the cap gains/losses of any sale someone questions.
>>>
>>> On Thu, Oct 26, 2023 at 1:11 PM Chary Chary 
>>> wrote:
>>>
 I know this is an offtopic, but I am just wondering: if it takes
 that much efforts plus python programming skills to file a tax return, 
 then:


- How do other people (mortals) do it?
- How on the earth someone is able to verify it? One can't
imagine a tax officer debugging a Python code?


 On Thursday, October 26, 2023 at 8:57:27 PM UTC+2
 erical...@gmail.com wrote:

> I recently filed my 2022 tax return using Magicbeans
>  to do detailed lot
> tracking and capital gains/losses reporting for my crypto assets.
> Magicbeans is a set of tools (importers and report generation tools) 
> built

Re: Modify postings in transactions and update the input beancount file

2024-03-15 Thread Martin Blais
There's a far fetched idea for the next version to augment the parser such
that it is possible to completely reverse the process and regenerate the
input file with modifications, but it's just a fanciful idea at this point.


On Fri, Mar 15, 2024 at 6:47 PM Saglara S  wrote:

> I want to add and modify postings in transactions based on a lookup table
> (search string : account). The script here does the job and will print out
> the modified transactions.
>
> But how on earth to modify / update the transactions in the input file
> accordingly?
>
> import json
> import re
> from beancount import loader
> from beancount.core import data
> from beancount.parser import printer
>
> # Define the filename and load the Beancount file
> filename = "comdirect-mitko.beancount"
> entries, errors, options = loader.load_file(filename)
>
> # Define the JSON lookup table
> lookup_table = {
> "AGIP": "Assets:Test",
> "PayPal Europe": "Assets:Transfer:Paypal",
> # Add more entries as needed
> }
>
> # Loop over each key-value pair in the lookup table
> for search_string, posting_account in lookup_table.items():
> for entry in entries:
> if isinstance(entry, data.Transaction):
> if re.search(search_string, (entry.payee or entry.narration)):
> posting = data.Posting(
> posting_account,
> None,
> None,
> None,
> None,
> None,
> )
> if len(entry.postings) == 1:
> entry.postings.append(posting)
> elif len(entry.postings) == 2:
> entry.postings[1] = posting
> printer.print_entry(entry)  # Print the modified entry
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/11a9fd9a-f6b4-42d6-9851-8c9ef21c71acn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhN_bfEsBK4VnVhgG9cNLk_pJfeU3cTETnEpAV-gB3U8uw%40mail.gmail.com.


Re: thank you beancounters! :)

2024-03-03 Thread Martin Blais
Sounds great! Congrats.


On Sun, Mar 3, 2024 at 5:34 PM fin  wrote:

>   as of today i've finally gotten one of my longest
> running accounts imported, balanced, working, it's
> beautiful!
>
>   only a few transactions missing from the era of
> hand written passbooks.
>
>   i'm tempted to ask someone if they still have
> those records around and to see if i can find those
> to fill them in.
>
>   what this journey has taught me is that if you
> want a good and useful history you may need to
> include more notes with the transactions.
>
>   this one account history is useful, but it won't
> be nearly as useful as it could have been had i put
> a little effort into better notes for transactions.
>
>   now i can move on to the next longest other history
> i have which does have more notes and more details
> but it is not complete either - yet it is better than
> nothing for my purposes.
>
>   it is very satisfying to me to reach the end of a
> process and watching the stubs and shims get removed
> as things balance out and hook together.  since my
> background is computers, programming, etc. it does
> all fit with that sort of analysis and breaking
> projects into parts and then testing the isolated
> parts and then filling in the gaps and putting things
> back together.
>
>   i'm not surprised that it works, but satisfied all
> the same.  :)
>
>
>   fin
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/hfafbk-fvd.ln1%40anthive.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPrD6mZdgVknVREwnsi-cORFSxmBuBP03uSHjGT91Z%3DMQ%40mail.gmail.com.


Re: Balance for each account for each month

2024-03-02 Thread Martin Blais
I think the query you issued should work.
Can you be more specific about "it mixes together the balances"?
Maybe isolate just a few transactions and run on that, to isolate what you
believe is the problem and reply here.




On Sat, Mar 2, 2024 at 9:58 AM Andrea Vidali  wrote:

> Hi everyone, first of all thank you for this amazing piece of software
> that is Beancount.
>
> The issue: I need to extract the balance of multiple accounts *separately*
> on the last day of each month, over a period (suppose a year + the latest
> day of the previous year).
>
> I researched this in this group and in the docs, but I couldn't find an
> answer. The simplest solution I found is to use the following query
> multiple times, one for each account:
>
> SELECT month, year, units(last(balance))FROM OPEN ON 2023-01-01 CLOSE ON
> 2024-01-01WHERE account ~ 'Assets:Bank:Checking'
>
> This outputs something like:
>
> month | year | units_last_balance
> 12 | 2022 | 400.00 EUR
> 1 | 2023 | 800.00 EUR
> 2 | 2023 | 100.00 EUR
> 3 | 2023 | 30.00 EUR
> 4 | 2023 | 200.00 EUR
> 5 | 2023 | 600.00 EUR
> 6 | 2023 | 100.00 EUR
> 7 | 2023 | 40.00 EUR
> 8 | 2023 | 400.00 EUR
> 9 | 2023 | 700.00 EUR
> 10 | 2023 | 800.00 EUR
> 11 | 2023 | 900.00 EUR
> 12 | 2023 | 1300.00 EUR
>
> But I would prefer instead to do a query like this:
>
> SELECT month, year, account, units(last(balance)) AS blcFROM OPEN ON
> 2023-01-01 CLOSE ON 2024-01-01WHERE account ~
> 'Assets:Bank:Checking|Assets:Broker:AAPL'GROUP BY year, month, account
> ORDER BY year, month, account
>
> To output something like:
>
> month | year | account | units_last_balance
> 12 | 2022 | Assets:Bank:Checking | 400.00 EUR
> 12 | 2022 | Assets:Broker:AAPL | 5 AAPL
> 1 | 2023 | Assets:Bank:Checking | 800.00 EUR
> 1 | 2023 | Assets:Broker:AAPL | 7 AAPL
> 2 | 2023 | Assets:Bank:Checking | 100.00 EUR
> 2 | 2023 | Assets:Broker:AAPL | 7 AAPL
> 3 | 2023 | Assets:Bank:Checking | 30.00 EUR
> 3 | 2023 | Assets:Broker:AAPL | 7 AAPL
> 4 | 2023 | Assets:Bank:Checking | 200.00 EUR
> 4 | 2023 | Assets:Broker:AAPL | 15 AAPL
> 5 | 2023 | Assets:Bank:Checking | 600.00 EUR
> 5 | 2023 | Assets:Broker:AAPL | 15 AAPL
> 6 | 2023 | Assets:Bank:Checking | 100.00 EUR
> 6 | 2023 | Assets:Broker:AAPL | 15 AAPL
> 7 | 2023 | Assets:Bank:Checking | 40.00 EUR
> 7 | 2023 | Assets:Broker:AAPL | 15 AAPL
> 8 | 2023 | Assets:Bank:Checking | 400.00 EUR
> 8 | 2023 | Assets:Broker:AAPL | 15 AAPL
> 9 | 2023 | Assets:Bank:Checking | 700.00 EUR
> 9 | 2023 | Assets:Broker:AAPL | 20 AAPL
> 10 | 2023 | Assets:Bank:Checking | 800.00 EUR
> 10 | 2023 | Assets:Broker:AAPL | 20 AAPL
> 11 | 2023 | Assets:Bank:Checking | 900.00 EUR
> 11 | 2023 | Assets:Broker:AAPL | 20 AAPL
> 12 | 2023 | Assets:Bank:Checking | 1300.00 EUR
> 12 | 2023 | Assets:Broker:AAPL | 20 AAPL
>
> Which doesn't yeld this result at all, instead it mixes together the
> balances, and I am unable to understand what's going on. The numbers in
> these examples are made up, the point is that each number should be the
> balance for that account at the end of the last day of the month.
>
> Is there a way to use a single query to output what I need?
>
> Thank you in advance!
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/71cb61cc-f027-4e6f-ace9-7d4c8b134669n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNeftC%2BDYgFqVcLXGuzT_WS%2Bg03J1J05qLS6Aeu7TWo3w%40mail.gmail.com.


Re: Bazel build failing on fedora-toolbox (how to properly set up python env?)

2024-02-26 Thread Martin Blais
You can still use the same build process (Makefiles + C) in the master
branch. The C++ code is not enabled by default.


On Mon, Feb 26, 2024 at 5:25 PM Chary Chary  wrote:

>
>
> On Wednesday, January 31, 2024 at 8:11:39 PM UTC+1 dan...@grinta.net
> wrote:
>
>
> If you just want to use Beancount v3 (and not hack on the C++ code) just
> install it as a regular Python package. The v3 branch uses meson-python
> to build the extension modules and pack them up in a Python wheel.
>
>
> What if I want to install Beancount v3 for hacking, but not in C++, but in
> a python code with the goal to create a pull request later on.
> Is there a "simplified" way to do this, without this Bazel?
> P.S. I am using Windows
>
>
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/4bb5c6cc-2dcf-4b80-b7b8-28fd770811a2n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhN-O%3Djww%3D2zopa67LXKs76MR%3DvMW2zYvnjz3rSkStRYFw%40mail.gmail.com.


Re: Purpose of a filename metadata in posting object

2024-02-25 Thread Martin Blais
I think it was just added by default. Also, the "filename" field really is
a source identifier saying "where does this bit of data originate from?"
and for postings created by plugins that could be the plugin name. It
should probably be renamed to "source" in the new version.


On Sun, Feb 25, 2024 at 12:02 PM Chary Chary  wrote:

> Hello everybody.
>
> I am just wondering what is the purpose to store a filename metadata in
> posting object, this is in addition to the filename metadata in the
> transaction object.
>
> Can there be a situation, when transaction and belonging to it posting
> would come from different files?
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/10dbe563-fcbb-4063-8ead-f54b6a761120n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMDi%2B32DR3U67r-7-z%2Bp1FSM3KoHYE_bcCL%3D_RynW_vVA%40mail.gmail.com.


Re: Totals for a specific commodity

2024-02-25 Thread Martin Blais
(No need to apologize, there are no dumb questions here - but maybe just
not much time for detailed answers.)
Use beanquery:
https://github.com/beancount/beanquery
https://docs.google.com/document/d/1s0GOZMcrKKCLlP29MD7kHO4L88evrwWdIO0p4EwRBE0/


On Sun, Feb 25, 2024 at 12:18 PM CDT  wrote:

> I'm new to Python, coding and Beancount, so I don't mean to sound like a
> dunce when I ask - where do I use "SELECT sum(position) WHERE currency =
> 'BTC'?
>
> Is that to be put in a script I create or is that used in Bean-Query or
> Bean-Report or something else?
>
> On Saturday, February 24, 2024 at 3:25:34 PM UTC-5 bl...@furius.ca wrote:
>
>> Just SELECT sum(position) WHERE currency = 'BTC'?
>>
>> On Sat, Feb 24, 2024 at 2:46 PM CDT  wrote:
>>
>>> I have some commodities (lets just use BTC as an example) spread out
>>> over many different accounts.
>>>
>>> Is there a command to get a grand total on a specific commodity (like
>>> BTC) regardless of the account hierarchy?
>>>
>>> I couldn't find anything on this.
>>>
>>> --
>>> 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 beancount+...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/9b8133d0-e942-44cd-bc80-db773878aa9en%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/3b6fada2-18e8-45e1-9318-5f665424840bn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhP39UrfQ45SjFRm_AwrWL6ntr3oxEHdv88Jmd%2B%2BtySx%3DQ%40mail.gmail.com.


Re: Totals for a specific commodity

2024-02-24 Thread Martin Blais
Just SELECT sum(position) WHERE currency = 'BTC'?

On Sat, Feb 24, 2024 at 2:46 PM CDT  wrote:

> I have some commodities (lets just use BTC as an example) spread out over
> many different accounts.
>
> Is there a command to get a grand total on a specific commodity (like BTC)
> regardless of the account hierarchy?
>
> I couldn't find anything on this.
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/9b8133d0-e942-44cd-bc80-db773878aa9en%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhP3i9tNzyKpdqMRwtCaxSReBsYXQvUFs-718ZcHizmGGg%40mail.gmail.com.


Re: How to transfer commodities between currencies?

2024-02-19 Thread Martin Blais
It helps to think of it as all the steps that would be taken by your broker.
Say on a transfer you realize the gains:

plugin "beancount.plugins.auto"

2024-01-01 * "Add cash"
  Income:Misc
  Assets:CA:Brokerage:USAccount:Cash   1000.00 USD

2024-01-01 * "Buy BMO in US"
  Assets:CA:Brokerage:USAccount:BMO   2 BMO {90.00 USD}
  Assets:CA:Brokerage:USAccount:Cash


2024-02-18 * "Sell BMO, realized gain"
  Assets:CA:Brokerage:USAccount:BMO  -2 BMO {90.00 USD} @ 94.19 USD
  Assets:CA:Brokerage:USAccount:Cash   2*94.19 USD
  Income:CA:Brokerage:USAccount:PnL

2024-02-18 * "Transfer cash equivalent"
  Assets:CA:Brokerage:USAccount:Cash -2*94.19 USD
  Assets:CA:Brokerage:CanadianAccount:Cash   2*127.03 CAD @ USD

2024-02-18 * "Sell BMO, realized gain"
  Assets:CA:Brokerage:CanadianAccount:Cash  -2*127.03 CAD
  Assets:CA:Brokerage:CanadianAccount:BMO   +2 BMO {127.03 CAD}


It's not super convenient, but you can compress those last three
transactions to

2024-02-18 * "Sell BMO, realized gain"
  Assets:CA:Brokerage:USAccount:BMO  -2 BMO {90.00 USD} @ 94.19 USD
  Income:CA:Brokerage:USAccount:PnL   -8.38 USD
  Assets:CA:Brokerage:CanadianAccount:BMO   +2 BMO {127.03 CAD}
  Assets:CA:Brokerage:CanadianAccount:Cash   2*127.03 CAD @ USD
  Assets:CA:Brokerage:CanadianAccount:Cash  -2*127.03 CAD

If you prefer to provide the exchange rate instead it can fill in the P/L:

2024-02-18 * "Sell BMO, realized gain"
  Assets:CA:Brokerage:USAccount:BMO  -2 BMO {90.00 USD} @ 94.19 USD
  Income:CA:Brokerage:USAccount:PnL
  Assets:CA:Brokerage:CanadianAccount:BMO   +2 BMO {127.03 CAD}
  Assets:CA:Brokerage:CanadianAccount:Cash   2*127.03 CAD @ 0.74147 USD
  Assets:CA:Brokerage:CanadianAccount:Cash  -2*127.03 CAD

Granted it could be better, but it's possible.
Thankfully you probably don't have a ton of these...
(You could automate the generation of these with a plugin if you do.)



On Mon, Feb 19, 2024 at 9:08 AM Martin Blais  wrote:

> (But to the straightforward question is: yes, it can.)
>
> On Mon, Feb 19, 2024 at 9:08 AM Martin Blais  wrote:
>
>> It depends.
>> What happens to your unrealized gain?
>> Does this trigger a realization and stepping up of cost-basis? Or do you
>> carry the unrealized gain to CAD?
>>
>>
>> On Sun, Feb 18, 2024 at 10:11 PM Matt McCormick 
>> wrote:
>>
>>> Some commodities trade on multiple stock exchanges and can be
>>> exchanged.  How can this transaction be properly recorded?  For example:
>>>
>>> 2024-02-18 * "Transfer BMO"
>>> Assets:CA:Brokerage:CanadianAccount:BMO 1 BMO {127.03 CAD}
>>> Assets:CA:Brokerage:USAccount:BMO -1 BMO {} @ 94.19 USD
>>>
>>> This results in a "Transaction does not balance" error due to the
>>> different currencies.
>>> Is there a way this can be properly recorded?
>>>
>>> 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 beancount+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/d6516c06-94ff-4066-862f-a8762f1a8b4fn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/beancount/d6516c06-94ff-4066-862f-a8762f1a8b4fn%40googlegroups.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhP0fSAzCyhZQqDLhMnuxZrq31Sa7PiYFMmv6B5FfwgsJw%40mail.gmail.com.


Re: How to transfer commodities between currencies?

2024-02-19 Thread Martin Blais
(But to the straightforward question is: yes, it can.)

On Mon, Feb 19, 2024 at 9:08 AM Martin Blais  wrote:

> It depends.
> What happens to your unrealized gain?
> Does this trigger a realization and stepping up of cost-basis? Or do you
> carry the unrealized gain to CAD?
>
>
> On Sun, Feb 18, 2024 at 10:11 PM Matt McCormick 
> wrote:
>
>> Some commodities trade on multiple stock exchanges and can be exchanged.
>> How can this transaction be properly recorded?  For example:
>>
>> 2024-02-18 * "Transfer BMO"
>> Assets:CA:Brokerage:CanadianAccount:BMO 1 BMO {127.03 CAD}
>> Assets:CA:Brokerage:USAccount:BMO -1 BMO {} @ 94.19 USD
>>
>> This results in a "Transaction does not balance" error due to the
>> different currencies.
>> Is there a way this can be properly recorded?
>>
>> 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 beancount+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/d6516c06-94ff-4066-862f-a8762f1a8b4fn%40googlegroups.com
>> <https://groups.google.com/d/msgid/beancount/d6516c06-94ff-4066-862f-a8762f1a8b4fn%40googlegroups.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMwKnAs%2BvprXwaucKLNAPt7EoUqFYn%2BmpZxJfnjwituBg%40mail.gmail.com.


Re: How to transfer commodities between currencies?

2024-02-19 Thread Martin Blais
It depends.
What happens to your unrealized gain?
Does this trigger a realization and stepping up of cost-basis? Or do you
carry the unrealized gain to CAD?


On Sun, Feb 18, 2024 at 10:11 PM Matt McCormick  wrote:

> Some commodities trade on multiple stock exchanges and can be exchanged.
> How can this transaction be properly recorded?  For example:
>
> 2024-02-18 * "Transfer BMO"
> Assets:CA:Brokerage:CanadianAccount:BMO 1 BMO {127.03 CAD}
> Assets:CA:Brokerage:USAccount:BMO -1 BMO {} @ 94.19 USD
>
> This results in a "Transaction does not balance" error due to the
> different currencies.
> Is there a way this can be properly recorded?
>
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/d6516c06-94ff-4066-862f-a8762f1a8b4fn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhN4Ec8hEMn8zdGAmDgNYUuyRAVjV0WULYPkbQbNpFrpLQ%40mail.gmail.com.


Re: T-bills through Treasury Direct - How to Record?

2024-02-19 Thread Martin Blais
I have a bunch of these now too, I haven't converted to Beancount yet, but
I think it'll be straightforward.
I think there is a choice to make about whether you want to
- just account for the cash flows (which should be really easy, book as a
new commodity with a price that begins at what you paid and ends at the
face value, with transactions for coupons in between)  or
- if you also want to be precise and account for the accrued interest and
discounted value portions separately on acquisition.
Anyhow, I'll try to post one of these here or to a doc as an example once I
do mine.



On Mon, Feb 19, 2024 at 8:12 AM CDT  wrote:

> What is the best way to post entries for t-bills?
>
> When you purchase a 30 day t-bill on Treasury Direct, you purchase at a
> discount, so if it's $1100 face value bill, and the interest rate is 5.4%,
> you get a 5.4% ($4.53) discount and only pay $1,095.47.
>
> In 30 days the face value is $1100.
>
> So how is the interest counted 30 days later?  Is there a way to do that?
>
> Also, you can let each month roll over into a new bond, so in cases like
> that the $1100 would come due but you would get a refund for the new bond
> that is discounted.
>
> I'm just confused how these things would be registered in Beancount.
>
> From the treasury direct website...
>
> A refund payment from a Treasury bill is the difference between the face
> value and the price paid when purchased at original issue. Treasury bills
> are sold at a discount or at par (face value). When the bill matures, the
> buyer is paid its face value.
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/a74715d8-96ec-41fa-8ee2-9312fe917ed6n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNcrAtykwjgg-AdMkKne_Nf9GnU2z8XoNhZnLrrtsgJoA%40mail.gmail.com.


Re: Setting up first Beancount file - should I separate LLC partnership and personal finances

2024-02-17 Thread Martin Blais
On Fri, Feb 16, 2024, 08:51 CDT  wrote:

> Hello,
>
> I'm setting up my first Beancount file and will start with 2024.
>
> Currently I have all of my ledgers in Gnucash but I will probably not
> export the existing items (yet).
>
> My wife and I have an LLC partnership for a property we rent and we have
> always kept that in our general Gnucash file that has all our personal
> items, but we are able to pull an income statement pretty easily from that
> file for accounting and tax purposes.
>
> My questions are:
>
> 1. Should I create two text files - one for the LLC and one for personal
> items?
>

Yes

2. If I don't create separate files and keep everything in one file, will I
> be able to easily pull out an income statement for just the LLC items like
> I can on Gnucash?
>

Use appropriate account names you can filter on and it should be fine



> Thanks in advance.
>
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/70085993-bdc6-4960-9c63-8d5bf6aad7c2n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNOnciyMswNEYPy7A1M0LJHVLTmHPG_pdD1j4H7Ty5kMg%40mail.gmail.com.


Re: install from github missing bean-report

2024-02-15 Thread Martin Blais
Use the v2 branch, this has been deleted in the master branch (deprecated,
use beanquery)

On Thu, Feb 15, 2024, 00:30 fin  wrote:

>   If you install beancount from a local directory on your
> computer after downloading it from the github current site
> there is no bean-report command available.
>
>   If you use pip install from PyPI there is a bean-report
> command.
>
>
>   fin
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/l4k0ak-l53.ln1%40anthive.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPM-z_OWeVFcdrtiCYP%3D64YUkz%2Ba0KU2u0JE9C7N5hAwQ%40mail.gmail.com.


Re: Copy-pasting multiline (multiple lines) query into bean-query

2024-02-14 Thread Martin Blais
I don't know. If it's supported in
https://docs.python.org/3/library/cmd.html it should be possible to improve
it.


On Tue, Feb 13, 2024 at 5:55 AM Dan Andersson 
wrote:

> Motivation: Give people (including Windows users) copy-pasteable commands
> they can simply use as-is (regardless of platform).
>
> On Tuesday, February 13, 2024 at 10:51:12 AM UTC Dan Andersson wrote:
>
>> Hi, I'm aware that backslashes can be used for Bash.
>> I was referring to the *interactive* session (after doing only
>> "bean-query foo.beancount"). I guess I was hoping it wouldn't "complete" a
>> command until it sees a semicolon, but currently it seems to complete a
>> command after every newline.
>>
>> On Saturday, February 10, 2024 at 3:01:39 PM UTC bl...@furius.ca wrote:
>>
>>> This is a bash question. Look at how multiple lines are handled in bash
>>> (should be lots of info online).
>>>
>>> On Sat, Feb 10, 2024 at 9:24 AM Dan Andersson 
>>> wrote:
>>>
 Hi,

 After doing bean-query foo.beancount to enter the interactive session,
 can I somehow copy-paste multiple lines in there?

 It seems like multi-line queries (e.g. the examples in the
 documentation), when pasted in there, always get split into one command per
 line, resulting in errors.

 Do I always have to combine those lines first, before pasting them?

 Thanks,
 DA

 --
 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 beancount+...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/beancount/50b1d037-b464-4838-ae46-58ffc250e8b8n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/782b5ed0-a61e-487f-9f60-5d5757aaccd1n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMORvD7wboc2asGKH_-g2pGoO9-miE3ciR-K-NQXLfGQg%40mail.gmail.com.


Re: Cost basis adjustment for average cost booking

2024-02-14 Thread Martin Blais
I agree it's totally possible to rewrite a plain-text accounting system on
your own in a short amount of time and there are many such projects on
github but going all the way to handling a bunch of the corner cases,
dealing with user issues continuously for a while, and making it extensible
via plugins and other things are what gives it value IMHO. It's not hard,
it's just a lot of perseverance. I spent a *lot* of weekends on this
somehow, I really wanted to have this working well. It's far from done and
perfect, all I see are the pain points...  it's annoying me a lot but I
have no cycles.


On Wed, Feb 14, 2024 at 6:59 AM Ceri Storey  wrote:

> > (Maybe I can use Beancount v3 as an easy and familiar project to learn
> Rust with.)
>
> I've considered building a beancount clone myself (usually this lasts
> until I remember just how much work the current implementation represents).
> One option I've considered is porting v2 a module at a time using PyO3
>  or similar. But to be fair, a big part of that is that
> I wrote some C++ twenty years ago and it's terrified me ever since.
>
> On Wednesday 14 February 2024 at 04:16:40 UTC bl...@furius.ca wrote:
>
>> On Mon, Feb 12, 2024 at 11:15 AM Chary Chary  wrote:
>>
>>> On Sunday, February 11, 2024 at 6:46:47 PM UTC+1 bl...@furius.ca wrote:
>>>
>>> One day, when I retire, I'll spend months writing v3 and offer you all a
>>> new and improved Beancount or maybe someone with more free time and
>>> enthusiasm will beat me to it, go Crustaceans, go!).
>>>
>>>
>>> Martin, but you will not leave us completely alone until after your
>>> retirement, will you?
>>>
>>
>> Not completely, but as you've seen in the last couple of years, there
>> isn't much time anymore.
>> (Maybe I can use Beancount v3 as an easy and familiar project to learn
>> Rust with.)
>>
>> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/2f421a9f-627c-4a67-9d2f-be1bb44a129fn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPvLSxXr_YCzi93iPTsd5uFQPLYBRRHhO0CWJQvd3Yoqw%40mail.gmail.com.


Re: Cost basis adjustment for average cost booking

2024-02-13 Thread Martin Blais
On Mon, Feb 12, 2024 at 11:15 AM Chary Chary  wrote:

> On Sunday, February 11, 2024 at 6:46:47 PM UTC+1 bl...@furius.ca wrote:
>
> One day, when I retire, I'll spend months writing v3 and offer you all a
> new and improved Beancount or maybe someone with more free time and
> enthusiasm will beat me to it, go Crustaceans, go!).
>
>
> Martin, but you will not leave us completely alone until after your
> retirement, will you?
>

Not completely, but as you've seen in the last couple of years, there isn't
much time anymore.
(Maybe I can use Beancount v3 as an easy and familiar project to learn Rust
with.)

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNjdEDZFNDj%2BfJv6iwyjhoqB%3D1xzi%3Dn%2Be6QKFXd8M0wLQ%40mail.gmail.com.


Re: Cost basis adjustment for average cost booking

2024-02-11 Thread Martin Blais
What it should be: precision has to be rewritten (the v3 proposal includes
ideas for doing this)
Practical solution: just add a little Equity:RoundingError posting to
absorb the fraction of a cent and move on.

One day, when I retire, I'll spend months writing v3 and offer you all a
new and improved Beancount or maybe someone with more free time and
enthusiasm will beat me to it, go Crustaceans, go!).




On Sun, Feb 11, 2024 at 11:15 AM Ceri Storey  wrote:

> Hi folks,
>
> I'm in the UK, so we get to deal with the inconvenience that is average
> cost booking when it comes to figuring out capital gains taxes. I'm
> currently using the average cost plugin, which works fine, but that
> approach it means that the inventory never gets reduced, so you end up with
> holdings never really going away.
>
> So I was planning on using a cost-basis adjustment approach (
> https://beancount.github.io/docs/trading_with_beancount.html#cost-basis-adjustment-and-return-of-capital)
> to "re-base" the assets to have a single average cost basis. In this case,
> the asset is purchasable on a fractional basis.
>
> So I've tried something like this:
>
> 2020-12-07 open Assets:Fnord:Foo
>  FOO
> 2020-12-07 open Assets:Fnord:Cash
>   GBP
>
> 2020-12-07 * "Buy Asset"
> Assets:Fnord:Cash
> -6.86 GBP
> Assets:Fnord:Foo
> 5. FOO  {1.2345 GBP}
>
> 2021-04-07 * "Buy more asset"
> Assets:Fnord:Cash
>  -30.80 GBP
> Assets:Fnord:Foo
>  13.1313 FOO  {2.3456 GBP}
>
> 2021-04-11 * "Average cost re-base"
> ; Re-base to current average cost basis
> Assets:Fnord:Foo
>  -5. FOO  {1.2345 GBP}
> Assets:Fnord:Foo
> -13.1313 FOO  {2.3456 GBP}
> ; Actual average is 2.015275062075903846565490079, according to
> python's decimal module.
> Assets:Fnord:Foo
> 5. FOO  {2.0152 GBP}
> Assets:Fnord:Foo
>  13.1313 FOO  {2.0152 GBP}
>
> No matter how much precision I specify for the average, it always seems to
> be off by some small amount:
>
> /Users/cez/Documents/beancount/ledger/cost-basis-simple.beancount:12:
>  Transaction does not balance: (-0.00140267 GBP)
>
> If I use an average of 2.015, -0.0051. Even with the 20 decimal places of
> precision for the average price, the transaction is off by
> -0.00102592 GBP.
>
> So I'm clearly missing something about the precision, and/or how to handle
> these cost basis adjustments. Can anyone offer any suggesiton as to what I
> might be missing? Is this one of those cases where I should post an
> adjustment to a hack account of some kind?
>
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/db6e8cec-1ed5-49e9-b587-4719d1a90f54n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPi53e%3DLFGHwbGV5_cSttouRwFQhY2vd8U1X-5-he5_wQ%40mail.gmail.com.


Re: Branching transaction import logic (i.e. partially automating imports)

2024-02-10 Thread Martin Blais
Here's how I do it (from my import script):



def process_entry(entry):
... do something...
return entry


def process_extracted_entries(extracted_entries_list, ledger_entries):
"""Filter the extracted entries to save on time."""
return [(filename, [process_entry(entry) for entry in entries],
account, importer)
for filename, entries, account, importer in
extracted_entries_list]


if __name__ == '__main__':
main = Ingest(importers, hooks = [process_extracted_entries])
main()



On Fri, Feb 9, 2024 at 3:46 PM Danny  wrote:

> *Background*
>
> I've been using beancount for a few years now. I just have a couple
> credits cards and a bank account, nothing especially complex, but I feel
> secure knowing I have a registry of where all my money has gone. Also the
> process of getting transactions into beancount is my check on spending,
> letting me notice anything suspicious.
>
> However, its just way too labor intensive. I already use beancount-import,
> but still get bogged down in hundreds of $2.90 subway payments, the grocery
> store, and sandwiches from the same handful of places.
>
> *What I'm Looking For*
>
> I need a less time-consuming workflow. I discovered Red's five minute
> ledger, and agree completely with the philosophy. However I think I need a
> way to separate transactions from any given account into two separate
> streams.
>
> To better illustrate, this is my ideal pipeline:
>
>1. Download transactions manually or automatically where possible (csv
>and ofx)
>2. Run code that has a set of predefined expense category rules (e.g.
>amazon automatically to a zero-sum category, grocery store below certain
>dollar value)
>3. Separate the categorized transactions and pass the remaining ones
>to beancount-import
>4. Write everything to the ledger like normal
>
> I haven't found any examples of branching the transaction pipeline like
> this, so my question is whether its even plausible within the framework of
> beancount importers. My back up plan is to write a more or less hardcoded
> script that will do it all, but I'm hoping for a more flexible approach!
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/1d463106-57c7-447c-b374-087ab60943ddn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOgxJu8-83Nb%3DfNSQp-7VfC0gsdX8d-%2BxL%3D6jJBOz%2B_1Q%40mail.gmail.com.


Re: Copy-pasting multiline (multiple lines) query into bean-query

2024-02-10 Thread Martin Blais
This is a bash question. Look at how multiple lines are handled in bash
(should be lots of info online).

On Sat, Feb 10, 2024 at 9:24 AM Dan Andersson 
wrote:

> Hi,
>
> After doing bean-query foo.beancount to enter the interactive session, can
> I somehow copy-paste multiple lines in there?
>
> It seems like multi-line queries (e.g. the examples in the documentation),
> when pasted in there, always get split into one command per line, resulting
> in errors.
>
> Do I always have to combine those lines first, before pasting them?
>
> Thanks,
> DA
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/50b1d037-b464-4838-ae46-58ffc250e8b8n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPv6nMsT1ES8Td4U1BJv2hqi%3DQd3bMaKO-e2Hj605kscQ%40mail.gmail.com.


Re: I created a way to do BeanCount bookkeeping using typescript.

2024-02-08 Thread Martin Blais
Maybe if Beancount gets rewritten in Rust we can compile it to Rust-WASM
and run it in the browser, haha!


On Thu, Feb 8, 2024 at 10:14 AM base hamster 
wrote:

> The biggest benefit is that it makes beancount Turing-complete, so you can
> use typescript to write recurring bills.
>
>
> import { EAccountType, Ledger, utils } from "../index.js";
>
> const { USD, CNY } = utils.createCurrencies({ defaultDate: "1970-10-01" },
> [
>   "USD",
>   "CNY",
> ] as const);
>
> const Assets = utils.buildAccountHierarchy(USD, EAccountType.Assets, {
>   CN: {
> Cash: utils.createAccountNodeConfig({ open: "1970-01-01", currency:
> CNY }),
>   },
>   Cash: utils.createAccountNodeConfig({ open: "1970-01-01" }),
>   UTrade: {
> Account: {
>   AAPL: utils.createAccountNodeConfig({ open: "1970-01-01" }),
>   EWJ: utils.createAccountNodeConfig({ open: "1970-01-01" }),
> },
>   },
> });
>
> const Expenses = utils.buildAccountHierarchy(USD, EAccountType.Expenses, {
>   Food: {
> Groceries: utils.createAccountNodeConfig({ open: "1970-01-01" }),
> Alcool: utils.createAccountNodeConfig({ open: "1970-01-01" }),
>   },
> });
>
> const ledger = new Ledger(
>   [
> ...utils.flattenAccountHierarchy(Assets),
> ...utils.flattenAccountHierarchy(Expenses),
>   ],
>   [USD, CNY]
> );
>
> const { tr } = utils.transactionBuilder(ledger);
>
> tr(
>   "1970-01-01",
>   "Distribution of cash expenses",
>   Assets.Cash.posting(-300),
>   Expenses.Food.Alcool.posting(300)
> );
>
> console.log(utils.beanCount.serializationLedger(ledger));
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/a52e830a-de80-484e-8ad3-c6fe4f09n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPbmg2az7r0CX%2BUkgsB0TMDPbykqAeoX%3DGJHcxpRdnG0Q%40mail.gmail.com.


Re: Bazel build failing on fedora-toolbox (how to properly set up python env?)

2024-02-03 Thread Martin Blais
On Sat, Feb 3, 2024 at 7:24 AM Daniele Nicolodi  wrote:

> On 31/01/24 22:23, Chary Chary wrote:
> > Dan,
> >
> > I thought that the main idea of beancount v3 was migrating some
> > functionality to C++ to make the thing be faster.
> >
> > If this is not being done in beancount v3, are there any  other
> > improvements which make it worth using as an opposite to v2 at the
> moment?
>
> The C++ rewrite has seen significant progress but it has never landed in
> a form where it can be used from a beancount application.
>

That's correct. It stalled on two things:
- not much free time to play with open source anymore (sad)
- a decent kludge I had to make passing protobufs between Python and C++
got taken away in a change in protobuf itself
I've pretty much decided to explore Rust as an alternative (not much
progress, again, no time to play)



> The major change in the v3 branch is that beancount.ingest has been
> split of and significantly restructured into the beangulp project, that
> beancount.query has been split of into the beanquery project and
> significantly improved, that the deprecated bean-report and bean-web
> functionality have been removed, and several other cleanups. A detailed
> list of changes has not been compiled.
>
> Cheers,
> Dan
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/8e4ad0b7-e480-4cfd-866a-8f995dd424dd%40grinta.net
> .
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhN2sLNvGVojq8HkGt%3Dz-GhQgPGbBVqF7Lq9Avw%2B8OjpjQ%40mail.gmail.com.


Re: Commodity 24 character limit

2024-01-03 Thread Martin Blais
Why would you encode that in the commodity name? You can add an account
name for each broker, and als for subaccounts, or use met a-data.


On Tue, Jan 2, 2024 at 2:40 AM Dan Andersson 
wrote:

> Hi,
>
> Can someone please add a plugin/setting to customize this limit (get this
> added to the v2 branch and released)? If you want payment for this work,
> you could PM me.
>
> I need a higher limit (around 100 chars) to keep the commodity name unique
> (using prefixes) across not just brokers, but also subaccounts within same
> broker. Not to mention some actual parts of the commodity name can be quite
> long already (e.g. "230915P00177500" for options).
>
> Thanks,
> Dan
>
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/f36f6e60-37fb-4f81-ba27-67c7c30949e7n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPYRXwbxG9gB6iq9VaY%3DwbMoR-huKZVsmbsQeDT%3D-a9-w%40mail.gmail.com.


Re: Transitive commodity values / Pegging

2023-12-30 Thread Martin Blais
Beancount doesn't automatically compute implied prices based on transitive
prices.
All it does is impute the inverse price, and project the prices forward
(the last valid price--in time--is the one that's used).
You'll have to just update all of them.


On Sat, Dec 30, 2023 at 9:50 AM Lover O'Bean  wrote:

> I have defined three currencies which should all be equal to the current
> IRS Standard Business mileage rate[1], call them IRSB.T, IRSB.R, IRSB.F
> (tax-deductible, reimbursable, and "fixed" for when I borrow a vehicle from
> a friend or relative).  I would like to "peg" IRSB.R and IRSB.F to the
> official rate so that I only update[2] one.  What is the best practice?
>
> 1) Always update everything:
> 2023-01-01 price IRSB.T 0.655 USD
> 2023-01-01 price IRSB.R 0.655 USD
> 2023-01-01 price IRSB.F 0.655 USD
> ;
> 2024-01-01 price IRSB.T 0.67 USD
> 2024-01-01 price IRSB.R 0.67 USD
> 2024-01-01 price IRSB.F 0.67 USD
>
>
> 2) Update one and set the others equal every time
> 2023-01-01 price IRSB.T 0.655 USD
> 2023-01-01 price IRSB.R 1 IRSB.T
> 2023-01-01 price IRSB.F 1 IRSB.T
> ;
> 2024-01-01 price IRSB.T 0.67 USD
> 2024-01-01 price IRSB.R 1 IRSB.T
> 2024-01-01 price IRSB.F 1 IRSB.T
>
> 3) Set the "peg" initially and then only update one
> 2023-01-01 price IRSB.T 0.655 USD
> 2023-01-01 price IRSB.R 1 IRSB.T
> 2023-01-01 price IRSB.F 1 IRSB.T
>
> 2024-01-01 price IRSB.T 0.67 USD
>
> I assume that 3) will not work and that IRS.R and IRS.F would remain
> stuck at the old rate?
>
> I apologize that I don't have enough transactions yet to test this
> thoroughly.
>
> [1] The Beancount documentation talks about opening currencies when they
> were first created.  To spare others the agony, the 1964 1040 instructions
> seem to be the first to clearly reference a standard mileage rate: there
> was a major tax reform in 1964, but I didn't exactly see a reference to a
> standard mileage rate as part of that bill.
>
>
> [2] It seems that rate changes are usually announced through "IRS
> NEWSWIRE" service; email alerts for this service can be obtained through
> subscribing here:
> https://service.govdelivery.com/service/multi_subscribe.html?code=USIRS
>
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CABV0qx58Gyr6JiXnSOeBPjeORv5Ted9HLNwGKu1Br%3DOh8Db0zw%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNTUJ3tLg9x_m0%2BvLVdPuV%3D9RnyxmNpr89qbQv8ynwU%3DA%40mail.gmail.com.


Re: Optionally make commodity directive mandatory?

2023-12-28 Thread Martin Blais
You're welcome!

On Thu, Dec 28, 2023, 20:11 Lover O'Bean  wrote:

> Yes; while it doesn't address timing, it should be good enough for now:
>
> https://beancount.github.io/docs/api_reference/beancount.plugins.html#beancount.plugins.check_commodity.validate_commodity_directives
>
> (Also, while I was "in the neighborhood", I noticed another plugin that
> addresses another concern that I had.)
>
> Thanks Martin!
>
>
> On Thursday, December 28, 2023 at 6:08:17 PM UTC-5 t...@cyrius.com wrote:
>
>> There's a plugin for this: validate_commodity_directives
>>
>> A plugin that verifies that all seen commodities have a Commodity
>> directive.
>>
>> * Lover O'Bean  [2023-12-28 17:16]:
>> > I am new to beancount, but would like the option of requiring that each
>> > commodity / currency be created with a commodity directive before being
>> > used, in the same way that accounts require an open directive before
>> being
>> > used.
>> >
>> > For example, if I declare AIRMILES.WN (IATA code) today but two years
>> from
>> > now enter a transaction which accrues AIRMILES.SW (vernacular), I would
>> > like to get an error, just like if I referred to a nonexistent account.
>> >
>> > Is this a good idea, or am I off-base?
>> >
>> > --
>> > 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 beancount+...@googlegroups.com.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/CABV0qx7m7iR8vYK%2BsgXjGx7UvV0uEsh1WaGE3hpL8eGc8Qiiqw%40mail.gmail.com.
>>
>>
>> --
>> Martin Michlmayr
>> https://www.cyrius.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/aaf37c31-dbeb-433a-9257-ca1de809dedfn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPo8Z%2B0cFDfQ5j6kbFb1J0BFJg3dqky33KdK_q1Ci5YMg%40mail.gmail.com.


Re: Total match sale and balance error

2023-12-23 Thread Martin Blais
On Tue, Dec 19, 2023 at 12:30 PM Damien R.  wrote:

> Le mardi 19 décembre 2023 à 09:02:46 UTC-5, bl...@furius.ca a écrit :
>
> On Tue, Dec 19, 2023 at 8:54 AM Damien R.  wrote:
>
> Le lundi 18 décembre 2023 à 22:03:43 UTC-5, bl...@furius.ca a écrit :
>
> On Mon, Dec 18, 2023 at 9:25 PM Damien R.  wrote:
>
> Thank you! It seems pretty obvious now... sorry for the dumb question!
>
>
> There are no dumb questions. Nothing to feel sorry about.
>
>
>
> If they had decided to sell only 50% of the commodity, what would have
> been the best way to handle it in my ledger? Use a total match to sell
> everything and buy back 50% of that commodity?
>
>
> No.
> You would have declared selling -3151.6173/2 units of COMMA @ 9.361 CAD,
> the cash would be correspondingly half, and the inferred P/L would be half
> as well.
>
>
> I did a few tries and when selling only part of the commodity, I get
> "ambiguous matches". I get that if I don't specify the cost basis beancount
> is not able to match the lot I want to sale, so I really don't know how I
> would write "sell 1000 COMMA, get 9361 in cash" in the context of a mutual
> fund.
>
>
> Can you run "bean-doctor context" around that transaction?  It's possible
> I put a heuristic on the total amount to be matched.
>
>
> Here goes. I've shortened the list of balances before and after
> transaction, lists were essentially the sames.
>

Yeah, that makes sense. Which ones do you want to sell? It doesn't know.
You'd have to select the particular postings you want to sell (the
"specific lot identification method").
That, or give that account a booking method, like FIFO or LIFO, and then
it'll do it for you.




>
> bean-doctor context accounts/broker/broker.beancount 2108
> ** Transaction Id 
>
> Hash:d9b1a802839532df6ff5a7fa90f3d538
> Location: accounts/broker/broker.beancount:2108
>
>
> ** Balances before transaction 
>
>   Assets:CA:Broker:COMMA  5.3522 COMMA {9.342 CAD, 2018-03-15}
>   Assets:CA:Broker:COMMA  1.1888 COMMA {9.337 CAD, 2018-03-28}
>   [...]
>   Assets:CA:Broker:COMMA 16.0548 COMMA {9.343 CAD, 2023-05-16}
>   Assets:CA:Broker:COMMA  9.5853 COMMA {9.333 CAD, 2023-05-30}
>
>   Assets:CA:Broker:Cash-1.00
> CAD
>
>   Income:CA:Broker:PnL
>
>
> ** Unbooked Transaction 
>
> 2023-06-21 * "Selling COMMA"
>   Assets:CA:Broker:COMMA  -1000. COMMA {} @ 9.361 CAD  ;
>   Assets:CA:Broker:Cash 9361.00 CAD; 9361 CAD
>   Income:CA:Broker:PnL ;
>
>
> ** Transaction 
>
> 2023-06-21 * "Selling COMMA"
>
>
> ** Residual and Tolerances 
>
>
>
> ** Balances after transaction 
>
>   Assets:CA:Broker:COMMA  5.3522 COMMA {9.342 CAD, 2018-03-15}
>   Assets:CA:Broker:COMMA  1.1888 COMMA {9.337 CAD, 2018-03-28}
>   [...]
>   Assets:CA:Broker:COMMA 16.0548 COMMA {9.343 CAD, 2023-05-16}
>   Assets:CA:Broker:COMMA  9.5853 COMMA {9.333 CAD, 2023-05-30}
>
>   Assets:CA:Broker:Cash-1.00
> CAD
>
>   Income:CA:Broker:PnL
>
>
>
>
> Le lundi 18 décembre 2023 à 20:59:53 UTC-5, bl...@furius.ca a écrit :
>
> When you sell something you need to account for P/L.
> You're missing an account posting for that P/L, the amount of which can be
> left to be automatically calculated by Beancount, for that $124.46
>
> On Mon, Dec 18, 2023 at 8:57 PM Damien R.  wrote:
>
> Hi,
>
> I have an investment in a mutual fund that has been converted from one
> commodity to another. I'm trying to represent that in my ledger with a sale
> of the first commodity (it's a total match sale as everything is sold) and
> then a buy of the second one (that's how it appears on the statement):
>
> 2023-06-21 * "Selling Commodity A"
>Assets:CA:Broker:COMMA  -3151.6173 COMMA {} @ 9.361 CAD
>Assets:CA:Broker:Cash   29502.29 CAD
>
> Bean-check gives the following error:
>
> Transaction does not balance: (124.4641276 CAD)
>
> I tried changing the tolerance for that commodity to 0.0001 but no luck
> with that. Any idea what is going on and what I should to to address it?
>
> As I'm dealing with mutual fund issues right now, I'll piggy back on my
> first question and ask what's the state of the average booking method? From
> my understanding it's still not supported and from the documentation I
> couldn't find how I should deal with partial sales, if I want to sale 50%
> of one commodity for instance.
>
>
> Thanks,
> Damien
>
> --
> 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 beancount+...@googlegroups.com.
> To view this discussion on the web 

Re: Moving assets between accounts and preserve cost basis?

2023-12-21 Thread Martin Blais
I *think*[1] that if 60 HOOL is all you have in that account it should
match the total number of units in account1, and it would automatically
fill in the cost basis in account2.

[1] It's been a while, adding a unit test specifically for this case in the
matching code might make sense to validate in an isolated way.

On Thu, Dec 21, 2023 at 8:29 PM Artur Matos  wrote:

> Hi everyone,
>
> I've changed one of my taxable accounts providers and need to transfer the
> assets from one beancount account to the other. Transfer happens "in
> specie" and I need to preserve the cost basis and lots as part of the
> transfer. If I understood the docs correctly , transferring like this won't
> work and will remove the lots from the new account:
>
> 2015-05-15 * "Transfer" Assets:InvestAccount1 -60 HOOL {} 
> Assets:InvestAccount2
> 60 HOOL {}
>
> Is there a shorthand way to transfer the assets while preserving lot
> information? I've had the original account for rather long and doing it lot
> by lot will be very tedious.
>
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/48984991-9622-49cf-9c54-b98f70ac1518n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMa9QL9yYES-vcZ6m9FYQgxXfJg-4x34Jw9of1jbmc1Ww%40mail.gmail.com.


Re: Total match sale and balance error

2023-12-19 Thread Martin Blais
On Tue, Dec 19, 2023 at 8:54 AM Damien R.  wrote:

> Le lundi 18 décembre 2023 à 22:03:43 UTC-5, bl...@furius.ca a écrit :
>
> On Mon, Dec 18, 2023 at 9:25 PM Damien R.  wrote:
>
> Thank you! It seems pretty obvious now... sorry for the dumb question!
>
>
> There are no dumb questions. Nothing to feel sorry about.
>
>
>
> If they had decided to sell only 50% of the commodity, what would have
> been the best way to handle it in my ledger? Use a total match to sell
> everything and buy back 50% of that commodity?
>
>
> No.
> You would have declared selling -3151.6173/2 units of COMMA @ 9.361 CAD,
> the cash would be correspondingly half, and the inferred P/L would be half
> as well.
>
>
> I did a few tries and when selling only part of the commodity, I get
> "ambiguous matches". I get that if I don't specify the cost basis beancount
> is not able to match the lot I want to sale, so I really don't know how I
> would write "sell 1000 COMMA, get 9361 in cash" in the context of a mutual
> fund.
>

Can you run "bean-doctor context" around that transaction?  It's possible I
put a heuristic on the total amount to be matched.




>
>
> Le lundi 18 décembre 2023 à 20:59:53 UTC-5, bl...@furius.ca a écrit :
>
> When you sell something you need to account for P/L.
> You're missing an account posting for that P/L, the amount of which can be
> left to be automatically calculated by Beancount, for that $124.46
>
> On Mon, Dec 18, 2023 at 8:57 PM Damien R.  wrote:
>
> Hi,
>
> I have an investment in a mutual fund that has been converted from one
> commodity to another. I'm trying to represent that in my ledger with a sale
> of the first commodity (it's a total match sale as everything is sold) and
> then a buy of the second one (that's how it appears on the statement):
>
> 2023-06-21 * "Selling Commodity A"
>Assets:CA:Broker:COMMA  -3151.6173 COMMA {} @ 9.361 CAD
>Assets:CA:Broker:Cash   29502.29 CAD
>
> Bean-check gives the following error:
>
> Transaction does not balance: (124.4641276 CAD)
>
> I tried changing the tolerance for that commodity to 0.0001 but no luck
> with that. Any idea what is going on and what I should to to address it?
>
> As I'm dealing with mutual fund issues right now, I'll piggy back on my
> first question and ask what's the state of the average booking method? From
> my understanding it's still not supported and from the documentation I
> couldn't find how I should deal with partial sales, if I want to sale 50%
> of one commodity for instance.
>
>
> Thanks,
> Damien
>
> --
> 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 beancount+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/88cc74be-3d56-4ab5-964a-53689d988663n%40googlegroups.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 beancount+...@googlegroups.com.
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/ffcaac38-5c91-4c9f-a1b7-ddc695bf5886n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/5e1ea8e6-01b5-4fed-8e8c-59c227fe6732n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhN3nHdwQ4MzM32u2ozdg%3D6K35zb_bF%3DT_ts65JfOdZvdQ%40mail.gmail.com.


Re: Total match sale and balance error

2023-12-18 Thread Martin Blais
On Mon, Dec 18, 2023 at 9:25 PM Damien R.  wrote:

> Thank you! It seems pretty obvious now... sorry for the dumb question!
>

There are no dumb questions. Nothing to feel sorry about.



> If they had decided to sell only 50% of the commodity, what would have
> been the best way to handle it in my ledger? Use a total match to sell
> everything and buy back 50% of that commodity?
>

No.
You would have declared selling -3151.6173/2 units of COMMA @ 9.361 CAD,
the cash would be correspondingly half, and the inferred P/L would be half
as well.




> Le lundi 18 décembre 2023 à 20:59:53 UTC-5, bl...@furius.ca a écrit :
>
>> When you sell something you need to account for P/L.
>> You're missing an account posting for that P/L, the amount of which can
>> be left to be automatically calculated by Beancount, for that $124.46
>>
>> On Mon, Dec 18, 2023 at 8:57 PM Damien R.  wrote:
>>
>>> Hi,
>>>
>>> I have an investment in a mutual fund that has been converted from one
>>> commodity to another. I'm trying to represent that in my ledger with a sale
>>> of the first commodity (it's a total match sale as everything is sold) and
>>> then a buy of the second one (that's how it appears on the statement):
>>>
>>> 2023-06-21 * "Selling Commodity A"
>>>Assets:CA:Broker:COMMA  -3151.6173 COMMA {} @ 9.361 CAD
>>>Assets:CA:Broker:Cash   29502.29 CAD
>>>
>>> Bean-check gives the following error:
>>>
>>> Transaction does not balance: (124.4641276 CAD)
>>>
>>> I tried changing the tolerance for that commodity to 0.0001 but no luck
>>> with that. Any idea what is going on and what I should to to address it?
>>>
>>> As I'm dealing with mutual fund issues right now, I'll piggy back on my
>>> first question and ask what's the state of the average booking method? From
>>> my understanding it's still not supported and from the documentation I
>>> couldn't find how I should deal with partial sales, if I want to sale 50%
>>> of one commodity for instance.
>>>
>>>
>>> Thanks,
>>> Damien
>>>
>>> --
>>> 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 beancount+...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/88cc74be-3d56-4ab5-964a-53689d988663n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/ffcaac38-5c91-4c9f-a1b7-ddc695bf5886n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOHBL-OHLSo7UrXfdkp-GyNvhbrhi25b7aHz62PoXrhkQ%40mail.gmail.com.


Re: Total match sale and balance error

2023-12-18 Thread Martin Blais
When you sell something you need to account for P/L.
You're missing an account posting for that P/L, the amount of which can be
left to be automatically calculated by Beancount, for that $124.46

On Mon, Dec 18, 2023 at 8:57 PM Damien R.  wrote:

> Hi,
>
> I have an investment in a mutual fund that has been converted from one
> commodity to another. I'm trying to represent that in my ledger with a sale
> of the first commodity (it's a total match sale as everything is sold) and
> then a buy of the second one (that's how it appears on the statement):
>
> 2023-06-21 * "Selling Commodity A"
>Assets:CA:Broker:COMMA  -3151.6173 COMMA {} @ 9.361 CAD
>Assets:CA:Broker:Cash   29502.29 CAD
>
> Bean-check gives the following error:
>
> Transaction does not balance: (124.4641276 CAD)
>
> I tried changing the tolerance for that commodity to 0.0001 but no luck
> with that. Any idea what is going on and what I should to to address it?
>
> As I'm dealing with mutual fund issues right now, I'll piggy back on my
> first question and ask what's the state of the average booking method? From
> my understanding it's still not supported and from the documentation I
> couldn't find how I should deal with partial sales, if I want to sale 50%
> of one commodity for instance.
>
>
> Thanks,
> Damien
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/88cc74be-3d56-4ab5-964a-53689d988663n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMj8qoPwbrmju%2BzbBSHAkGExTH%2Be_sxHXqtpEovTnWapQ%40mail.gmail.com.


Re: Calculating Portfolio Returns

2023-12-17 Thread Martin Blais
[image: image.png]

On Sun, Dec 17, 2023 at 12:06 PM Chary Chary  wrote:

> Martin,
>
> I was reading through the *Beancount - Calculating Portfolio Returns
> *
> document
>
> Very thorough (as always)!
>
> May be this is a naïve question, but what is your definition of the
> portfolio return in general, without diving in beancount?
>
> E.g.
>
> if on 1 January I invested 100 USD which grew by 1 February to 150 USD and
> then I withdrew all of this
>
> and then on 1 June I unvested 1000 USD, which by 1 December grew to 1010
> USD, which I withdrew
>
> Then how would you calculate the portfolio return?
>
> On Saturday, September 12, 2020 at 9:25:51 PM UTC+2 bl...@furius.ca wrote:
>
>> I took a few weeks off, COVID-style (at home, cooking and coding). So I
>> made some good progress on calculating returns from a Beancount ledger. I'm
>> really excited to share this actually, because it worked so well!
>>
>> The source code is located here:
>> https://github.com/beancount/beancount/tree/v2/experiments/returns
>> and I think it's general enough that you can use it on your own ledger.
>>
>> I'll need to cover it with unit tests and apply it to the example
>> Beancount file before taking it out of "experiments/" but this should work
>> now.
>>
>> I've documented the process here:
>> http://furius.ca/beancount/doc/returns
>>
>> https://docs.google.com/document/d/1nPsMIunLnDvdsg6TSsd0PZb7jngojNpFlqnaX36WRp8/
>>
>> I'm looking forward to feedback, and especially comments from people who
>> manage to make it run on their own ledger and produce useful results.
>> (The doc is open for comments in suggestion mode.)
>>
>> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/87548033-01bd-463c-b096-aceafc15fc7fn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOfP2NXTTPE7y4NrmMMAjUFEggtGrzW7q7nQuwF8nC4kQ%40mail.gmail.com.


Re: Order of padding and plugins

2023-12-11 Thread Martin Blais
Thank you for reporting it Soham.



On Mon, Dec 11, 2023, 06:01 Soham Shanbhag  wrote:

> I see that there is an open issue on github related to this too, see
> https://github.com/beancount/beancount/issues/742.
>
> The present behaviour does not satisfy the definition of the pad directive
> in the language syntax, i.e. it does not 'insert a transaction that will
> make the subsequent balance assertion succeed, if it is needed'. To ensure
> this, in my opinion, ops.pad needs to be in PLUGINS_POST. I'm willing to
> file a PR on github(it's a two line change) but wanted to confirm that this
> doesn't break any other functionality.
>
>
> On Tuesday, December 5, 2023 at 5:12:13 AM UTC+9 Soham Shanbhag wrote:
>
>> Hi,
>> I've been using padding to account for errors in my accounts and bank,
>> for example for transactions which I may have forgotten but are small
>> enough that I don't want to hunt for them. Usually, this goes along the
>> lines of:
>>
>> 2023-12-04 pad Assets:Checking Equity:Adjustments
>> 2023-12-05 balance Assets:Checking 1000 USD
>>
>> whenever I want to check an account in beancount with my bank. I'm also
>> using plugins which manipulate the transactions. However, beancount loads
>> the padding plugin (ops.pad) before my custom plugins in PLUGINS_PRE(see
>> beancount/loader.py), which leads to padding the accounts with values
>> before manipulation by my plugin. Since the balance directive is in
>> PLUGINS_POST, this leads to an error. For an example, see the following
>> beancount file and plugin file:
>>
>> ; file: temp.beancount
>> option "operating_currency" "USD"
>> option "insert_pythonpath" "True"
>> plugin "plugin_temp"
>>
>> 2020-01-01 open Equity:Adjustments
>> 2020-01-01 open Assets:Checking  USD
>> 2020-01-01 open Expenses:Groceries
>>
>> 2023-01-01 pad Assets:Checking Equity:Adjustments
>> 2023-01-02 balance Assets:Checking 1000 USD
>>
>> 2023-02-01 * "Eggs"
>> Expenses:Groceries  100 USD
>> Assets:Checking
>>
>> 2023-03-01 pad Assets:Checking Equity:Adjustments
>> 2023-03-02 balance Assets:Checking 700 USD
>>
>> ; file: plugin_temp.py in the same directory
>>
>> from beancount.core import data
>>
>> __plugins__ = ('plugin_temp',)
>>
>> def plugin_temp(entries, unused_options_map):
>> new_entries = list(e for e in data.filter_txns(entries) if e.flag ==
>> '*')
>> return new_entries + entries, []
>>
>>
>> With bean-check, this gives the error
>> Balance failed for 'Assets:Checking': expected 700 USD != accumulated 600
>> USD (100 too little)
>>
>>2023-03-02 balance Assets:Checking 700
>> USD
>>
>> Is there a particular reason ops.pad is in PLUGINS_PRE and not in
>> PLUGINS_POST? Putting ops.pad in PLUGINS_POST seems to solve this issue.
>>
>>
>> Also, it seems that issue
>> https://groups.google.com/g/beancount/c/bMo9A6lM9Z4/m/egj3rGBMBAAJ is
>> still unsolved. This also affects my above workflow, but I'm presently
>> easily sidestepping it by not using padding on an account where I do
>> balance checks.
>>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/02d0ae5f-599a-4c4b-94d9-a3f58ead8615n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNFsU2GGvmmAZ6VkUGpGebZHqhwSe06N8KDXZG1LwJXpQ%40mail.gmail.com.


Re: Dealing with futures

2023-12-08 Thread Martin Blais
Sorry for the late reply, I've been busy.

Yeah, maybe I shouldn't have called it "margin," it's inaccurate.
In particular, this method doesn't actually track the margin usage (which
seems unnecessary).
Maybe it should be some Equity account.

There's some other discussion about futures contracts here:
https://docs.google.com/document/d/1H0UDD1cKenraIMe40PbdMgnqJdeqI6yKv0og51mXk-0/edit

The other problem is inferring the multiplier. That's not done.
https://docs.google.com/document/d/1qPdNXaz5zuDQ8M9uoZFyyFis7hA0G55BEfhWhrVBsfc/edit#heading=h.b30u633jlv5x
I'm thinking the instrument names maybe should have a multiplier in them,
or we should have some global option to register a prefix-to-multiplier
mapping.




On Fri, Dec 8, 2023 at 3:24 PM Dan Andersson 
wrote:

> I just found another approach:
> https://groups.google.com/g/beancount/c/OIjyBo-Ehu0/m/b3ujN_oMAQAJ
>
> If I understand correctly, he simply has a phantom account that offsets
> the initial notional value and track only PnL afterwards. This phantom
> account offers a nice hack to deal with futures. However, for some reason
> he calls this "margin" (not sure why, maybe this is special Ameritrade
> terminology).
>
> On Friday, December 8, 2023 at 6:06:57 PM UTC Dan Andersson wrote:
>
>> I think I can get a fully customizable experience by using "NONE" and
>> zero cost basis. Please critique this:
>>
>> ;--
>> 2014-05-20 open Assets:Futures:GOLD-DEC-24 GOLD-DEC-24 "NONE"
>> 2014-05-20 open Assets:Citibank:Cash USD
>> 2014-05-20 open Income:CapitalGains USD
>> 2014-05-20 open Expenses:CapitalLosses USD
>>
>> 2014-05-20 * "Buy GOLD-DEC-24 @1000.0"
>>   Assets:Futures:GOLD-DEC-24  2 GOLD-DEC-24  { 0 USD }
>>
>> 2014-05-21 * "Sell GOLD-DEC-24 @1010.0"
>>   Assets:Futures:GOLD-DEC-24  -1 GOLD-DEC-24  { 0 USD }
>>   Assets:Citibank:Cash 10 USD
>>   Income:CapitalGains -10 USD
>>
>> 2014-05-22 * "Sell GOLD-DEC-24 @990.0"
>>   Assets:Futures:GOLD-DEC-24  -1 GOLD-DEC-24  { 0 USD }
>>   Assets:Citibank:Cash -10 USD
>>   Expenses:CapitalLosses 10 USD
>> ;--
>>
>> Advantage: Full control.
>>
>> Drawbacks:
>>
>>1. The cost basis is just a dummy value (only to "enable a custom
>>experience").
>>2. I lose Beancount's automatic mismatch checks on futures quantity
>>vs. cash.
>>3. I also lose Beancount's automatic matching; have to do matching
>>and PnL calculations myself.
>>4. Beancount reporting doesn't automatically reflect unrealized gains.
>>
>> Is this on the right track? (Point 4 is very unfortunate but I could
>> alleviate that by e.g. annual (December 31) entry to record unrealized
>> gains.)
>>
>> Thanks,
>> Dan
>>
>> On Tuesday, December 5, 2023 at 10:10:03 PM UTC Dan Andersson wrote:
>>
>>> Hi,
>>>
>>> For stocks (and even options), you pay for a thing (or short sell a
>>> thing) and cash leaves (or comes into) your cash account. Very clear. The
>>> cash is price * quantity * multiplier.
>>>
>>> Futures are different. No cash leaves/arrives in the beginning.
>>> Basically the value starts at zero. Only price differences over time matter
>>> and only when closing position does realized PnL bring cash in/out of cash
>>> account.
>>>
>>> How to deal with this in Beancount? Should I set the Beancount price to
>>> zero at first (and e.g. for informational purposes put the actual market
>>> price into the comment)?
>>>
>>> (I realize there is margin but that's just a virtual allocation of sorts
>>> (cash is still in the cash account), cannot really be determined from the
>>> price, plus it varies from time to time depending on volatility etc.)
>>>
>>> Thanks,
>>> Dan
>>>
>> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/2aabf18c-ce90-4475-9b07-0c4023e0f657n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhM9GqmNvx1_-XOBvGaGaBk_h%2BzzL%3DOb9xsEi7J2UPMiKA%40mail.gmail.com.


Re: How to account for expenses withdrawable from an HSA

2023-11-29 Thread Martin Blais
I think the second transaction does not reflect the actual cash transfers.
I would do it either this way:

2023-11-29 * "Dr. Hu" "pain killers"
receipt: "http://example.com/2023-11-29_Dr.Hu_meds.pdf;
Assets:Cash   -100.00 USD
Expenses:Health100.00 USD

2035-06-22 * "HSA withdrawal using eligible expenses"
Assets:HSA-100.00 USD
Assets:Cash100.00 USD

But that doesn't track the amount you can withdraw.
Another option is to use the tracking accounts; I would do it like this:

2023-11-29 * "Dr. Hu" "pain killers"
receipt: "http://example.com/2023-11-29_Dr.Hu_meds.pdf;
Assets:Cash   -100.00 USD
Expenses:Health100.00 USD
Income:HSA-Eligible   -100.00 USD
Assets:HSA-Eligible100.00 USD

2035-06-22 * "HSA withdrawal using eligible expenses"
Assets:HSA-100.00 USD
Assets:Cash100.00 USD
Assets:HSA-Eligible   -100.00 USD
Expenses:HSA-Eligible  100.00 USD

Note that it's not super obvious that you can deduct the amounts you pay.

I have an example out-of-network case whereby the amounts I pay get
reimbursed by insurance and it's only the portion that isn't reimbursed
that I end up able to claim from the HSA. Here, I turned it into a doc for
you:
https://docs.google.com/document/d/1NyATal9CRrBDsII6sLdwCNNv0qcJmcPxYpNrlnjCjp8/edit



On Wed, Nov 29, 2023 at 2:24 PM Matt Carter 
wrote:

> I've been managing my finances with spreadsheets for a few decades.  A
> couple weeks ago, a coworker introduced me to Beancount and double entry
> accounting and I've been pleased with how well it handles my accounts.
>
> One type of accounting that I haven't yet figured out how to do with
> Beancount (or double entry accounting in general) is tracking expenses that
> are eligible for withdrawal from a special purpose account like a Health
> Savings Account (HSA) or a 529 account.  (These are USA tax advantaged
> accounts which allow funds to be invested and withdrawals can only be made
> tax- and penalty-free for a specific purpose, like health or higher
> education.  Since funds are invested free of capital gains tax, withdrawals
> are often postponed till long after the eligible expense is incurred.)
>
> I can track my HSA in Beancount as an Assets:HSA account.  As I incur
> HSA-eligible expenses, what's the best way to track those so that I know I
> can later withdraw them from the HSA?  Suppose I pay $100 to a doctor for
> an office visit.  In Beancount, I'd add a transaction that decreases my
> Assets:Cash account and increases my Expenses:Health account, each by
> $100.  But what that fails to capture is that $100 became eligible for
> withdrawal from my Assets:HSA account.
>
> I suppose I could make it work by introducing 2 new accounts:
>
> 2023-11-29 * "Dr. Hu" "pain killers"
> receipt: "http://example.com/2023-11-29_Dr.Hu_meds.pdf;
> Assets:Cash   -100.00 USD
> Expenses:Health100.00 USD
> Liabilities:HSA-Eligible  -100.00 USD
> Expenses:HSA-Eligible  100.00 USD
>
> Then, later, I could withdraw it from the HSA:
>
> 2035-06-22 * "HSA withdrawal using eligible expenses"
> Liabilities:HSA-Eligible   100.00 USD
> Assets:HSA-100.00 USD
>
> But the duplicate Expenses account makes me feel like the model doesn't
> fit reality well.
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/cc24b99b-905d-476a-8a14-7c58cade7489n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOconWWPCqpFJMKW8G4qtss83Lz-O6xYQjb76OP5bhbiQ%40mail.gmail.com.


Re: Lot matching necessary?

2023-11-21 Thread Martin Blais
On Tue, Nov 21, 2023 at 11:36 AM Dan Andersson 
wrote:

> Hi,
>
> My goal is to convert Interactive Brokers statements (their XML flex
> statements) to Beancount.
>
> Normally I wouldn't have to think about lots and prices, because each
>  already tells me cash in/out (and realized FIFO pnl).
>

If they're booked FIFO you should be able to find the matching lots.
You can also use Beancounts' automatic FIFO booking by specifying it on the
account, hopefully it should match those.



>
> So I already know exactly the amount that leaves/enters the cash account
> and exactly the quantity that enters/leaves the financial instrument
> account.
>
> From what I currently understand, it's only because of Beancount
> peculiarity that I need to go through the trouble of matching the
> individual lots. Normally, there would not be much point in doing that (at
> most, I'd only want "price" commands at the end of the year to get my
> **unrealized** PnL).
>
> Is my understanding correct? Or can lots somehow already been auto-matched
> according to e.g. FIFO?
>

Yeah, just specify "FIFO" on the account.




>
> Thanks,
> Dan
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/5003ba33-e6fd-4553-b3c8-1568afda1504n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhORySn-O2SEoVSVniH3JgCuqP%3DozwU-V%3DVGU_Tpvzj2Zw%40mail.gmail.com.


Re: Beancount docs: tagstack does not work over include

2023-11-19 Thread Martin Blais
If you'd like to make a suggestion I can open up the relevant doc for
comment & suggestion.
Let me know which one,


On Sun, Nov 19, 2023 at 3:46 AM Matthias Beyer 
wrote:

> Hi,
>
> the docs on the tagstack do not explicitely say that the tagstack
> functionality does only work per-file!
>
> So this:
>
> pushtag #foo
> include "./foos.beancount"
> poptag #foo
>
> does not do what one might expect it does.
>
> Maybe the docs on the tagstack should note this.
>
> Best,
> Matthias

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOTP5AxpxAqutYZgiGOquaR_1o2fszr2iO-gJ8AjPTPQA%40mail.gmail.com.


Re: Announce: new Beancount parser in Rust

2023-11-18 Thread Martin Blais
On Sat, Nov 18, 2023 at 2:53 PM Simon Guest  wrote:

> I had seen that, and it looks interesting!
>
> How could we free it from being C++ only? If such a test suite could be
> language independent, that would really open things up for testing of other
> language implementations.
>

Well it's based on the original Python one:
https://github.com/beancount/beancount/blob/master/beancount/parser/parser_test.py

If you have Python bindings and rendering woud be sufficient to get this
right, you'd use the Python bindings to run the tests
I think this parser_test.py could be converted to assert the data structure
as the C++ one does.
The elegant thing about the C++ one is that since it emits protobufs, using
ascii protobuf syntax naturally provides a way to describe the data
structure.
Do the Rust structs have an elegant ser/de to/from a text syntax?


The only thought I had so far would be for a parser adapter layer to output
> as, say JSON, which could be used for comparing with expected output for
> such a suite.
>

Urg... JSON.
I know JSON's popular, but it would make a rather crappy syntax for the
complexity of this schema.
(I know that's really widespread in the OSS community, and that's a real
shame. JSON sucks with its three types.
protos much nicer and better defined. See the C++ test strings...)

I think the right thing to do would be to make the Rust parser produce
protos and then you can create/assert equality against them in any language
(e.g. Python of the Rust produced data). Protos are nice in that way,
they're language independent.

But then we'd back to square one: how do you pass protos back and forth btw
Rust and Python without making copies.
And besides, I'm pretty sure you'll prefer the Rust data structures over
protos.
So maybe implement an elegant ser/de to some ascii format to/from Rust data
structures, as you would with protos.
Then create a binding from Python to accept and parse a string that creates
the corresponding Rust data structures.
Then implement a comparator function.
That's all a bunch of work -- none of it is rocket science, but you're
really just redoing protos at that point.




> cheers,
> Simon
>
> On Sun, 19 Nov 2023, 7:16 am Martin Blais,  wrote:
>
>> Have you guys seen this suite of tests?
>>
>> https://github.com/beancount/beancount/blob/master/beancount/cparser/parser_test.cc
>>
>> Any parser that supports a suite like this I'd probably want to integrate
>> and contemplate a Rust version of Beancount.
>> There are two crucial things at the bottom of it all:
>> - a good parser
>> - the ability to call to & from Python without any copies
>> Anything else is a piece of cake.
>>
>>
>>
>> On Wed, Nov 15, 2023 at 5:17 PM Simon Guest 
>> wrote:
>>
>>> beancount-parser-lima may do a bit more than the existing core parser in
>>> Beancount proper.  It processes all the included files and returns a
>>> date-ordered list of all the directives, with all pragmas either processed
>>> or returned as a single Options structure.
>>>
>>> It doesn't do the filling in of missing numbers, because that seems
>>> tricky indeed (and an application level thing not a parser level thing).
>>> Nor plugins.
>>>
>>> I'm currently making good progress with Python bindings, including some
>>> performance optimisations to reduce the number of allocations of Python
>>> objects.
>>>
>>> On Thursday, 16 November 2023 at 00:29:01 UTC+13 bl...@furius.ca wrote:
>>>
>>>> The c++ parser in V3 is pretty much done.
>>>> This is other people writing a parser in rust.
>>>>
>>>> It's worth noting that n beancount the parser alone isn't that useful.
>>>> It's because beancount processes its data in two stages: parsing, which
>>>> produces roughly a data structure that matches the input, and then running
>>>> over the stream of transactions to fill in missing numbers and also running
>>>> all the plugins. The result of that is the final stream of transactions
>>>> that you can do queries on. The logic in the second part is where all the
>>>> complexity lies. I haven't ported that.
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Nov 15, 2023, 04:54 Chary Chary  wrote:
>>>>
>>>>> Martin,
>>>>>
>>>>> is this somehow alternative to the C++ parser, which you are working
>>>>> on in beancount v3?
>>>>>
>>>>> On Sunday, November 12, 2023 at 9:46:50 PM UTC+1 bl...@furius.ca
>>>>> wrote:
>>>>>
>>>>>> Thank you for sharing. Added 

Re: Announce: new Beancount parser in Rust

2023-11-18 Thread Martin Blais
Have you guys seen this suite of tests?
https://github.com/beancount/beancount/blob/master/beancount/cparser/parser_test.cc

Any parser that supports a suite like this I'd probably want to integrate
and contemplate a Rust version of Beancount.
There are two crucial things at the bottom of it all:
- a good parser
- the ability to call to & from Python without any copies
Anything else is a piece of cake.



On Wed, Nov 15, 2023 at 5:17 PM Simon Guest  wrote:

> beancount-parser-lima may do a bit more than the existing core parser in
> Beancount proper.  It processes all the included files and returns a
> date-ordered list of all the directives, with all pragmas either processed
> or returned as a single Options structure.
>
> It doesn't do the filling in of missing numbers, because that seems tricky
> indeed (and an application level thing not a parser level thing).  Nor
> plugins.
>
> I'm currently making good progress with Python bindings, including some
> performance optimisations to reduce the number of allocations of Python
> objects.
>
> On Thursday, 16 November 2023 at 00:29:01 UTC+13 bl...@furius.ca wrote:
>
>> The c++ parser in V3 is pretty much done.
>> This is other people writing a parser in rust.
>>
>> It's worth noting that n beancount the parser alone isn't that useful.
>> It's because beancount processes its data in two stages: parsing, which
>> produces roughly a data structure that matches the input, and then running
>> over the stream of transactions to fill in missing numbers and also running
>> all the plugins. The result of that is the final stream of transactions
>> that you can do queries on. The logic in the second part is where all the
>> complexity lies. I haven't ported that.
>>
>>
>>
>>
>> On Wed, Nov 15, 2023, 04:54 Chary Chary  wrote:
>>
>>> Martin,
>>>
>>> is this somehow alternative to the C++ parser, which you are working on
>>> in beancount v3?
>>>
>>> On Sunday, November 12, 2023 at 9:46:50 PM UTC+1 bl...@furius.ca wrote:
>>>
 Thank you for sharing. Added to contrib doc.


 On Sun, Nov 12, 2023 at 3:15 PM Simon Guest 
 wrote:

> Ahoy Beancounters!
>
> Of interest really only to developers, I created a new parser for
> Beancount in Rust, called beancount-parser-lima
>  
> (because
> I am aware it is not the first such).
>
> I'm currently actively working on this, with my current focus being
> adding Python bindings.
>
> So far it parses everything I have tried.  No support for plugins,
> because, well, it's purely Rust so far!  (Also no support so far for query
> and custom directives, unsure how important they are.)
>
> Performance and rich error reporting are the two headlines.
>
> Hopefully this may be useful for some.
>
> cheers,
> Simon
>
> --
> 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 beancount+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/d63af5c5-2670-4a65-9a88-570dabbb19fbn%40googlegroups.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 beancount+...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/c82304a1-125a-4f93-a149-5717ce010079n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/f90b32ee-8226-46c9-831d-17450ac831e9n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOciLhn-b%2BjBTxdp622BnWhyEtTjLQYRo6Adj5bzZvNkA%40mail.gmail.com.


Re: Question about how to work with beancount for ETFs

2023-11-18 Thread Martin Blais
Check out the section on trading in the docs.
You can choose a booking method, e.g. FIFO, or do it manually (if you use
the "specific lot identification" method).
One trick that works well when doing by is to run bean-doctor to get the
context around a transaction, it gives you the contents of the account just
before the transaction with the individual lots and you can just select the
ones you want to reduce and copy-paste them.
If you specify a booking method it does it for you; you can use bean-doctor
context to view the selected lots in the same way.
Hope this helps,




On Sat, Nov 18, 2023 at 3:44 AM Matthias Beyer 
wrote:

> Hi Blais,
> Hi beancount list,
>
> I am a long term beancount user but only lately got into how to work with
> beancount and stock trading.
>
> I moved my stock trades from "normal syntax", like:
>
> 2023-11-18 * "Buy some"
> Assets:Stock +10 COOLSTOCK @ 10 EUR
> Assets:Bank:Account -105 EUR
> Expenses:Commissions
>
> to the appropriate one
>
> 2023-11-18 * "Buy some"
> Assets:Stock +10 COOLSTOCK {10 EUR}
> Assets:Bank:Account -105 EUR
> Expenses:Commissions
>
> because I just recently learned about how to actually use beancount for
> stock
> trading.
>
> Now, my issue is that I buy ETF for a rather long time now, recurringly
> (each
> months 1st). That means that there are a lot of postings for ETFs. I know
> about the (experimental) "recurring" plugin, but I assume that this won't
> work
> here because of the everchanging prices.
> Either way, I wouldn't actually use that plugin, because I auto-import
> transactions from my bank account and would need to filter out
> transactions
> that are already done by a recurring order.
>
> But that aside, my question is about something different actually: Do I
> move my
> ETF postings from the first syntax (from above) to the second? It is not
> that
> this is quite some effort (vim scripting ftw) but rather that it becomes
> quite
> complex once I sell ETF again, right? Because I would essentially "match"
> my
> ETF against the buying orders, although I probably do not sell the exact
> same
> amount that I bought order-by-order!
>
> E.G.
>
> * buy 100 EUR worth of ETF at 10
> * buy 100 EUR worth of  ETF at 11
> * buy 100 EUR worth of  ETF at 12
> * buy 100 EUR worth of ETF at 13
> * buy 100 EUR worth of ETF at 14
> * buy 100 EUR worth of ETF at 15
> * buy 100 EUR worth of ETF at 16
> ... years pass
> Now I have to sell. ETF is at 50 now and I want to have 100 out of it
> every
> transaction.
> So what I do now is
> * sell 100 EUR worth of ETF that I bought at 10
>
> The first 5 transactions of this work perfectly well... because the amount
> I
> bought at 10 is now worth 500 of my currency. But after that I have to
> sell
>  of what I bought at 11 to get out 100 and for the last bit
> of
> what I bought at 11 I also have to sell some fraction of what I bought at
> 12
> to get out 100 of my currency. And this gets even more complex in
> real-life
> because the ETF of course does not stay at 50 during my time that I am
> selling, but is still moving in price and also because/if I do not want to
> get
> out 100 but, say, 550 of my currency...
>
> Does my logic check out?
>
> Is there any "simple" solution to that? I can totally see the benefit of
> actually doing that calculation! It's just that I am looking for a less
> complex alternative to not burden my future self with work that might be
> unnecessary! :-)
>
> I am really looking forward to your answer!
> Thank you very much for beancount!
> Have a great weekend,
> best from Germany
> Matthias

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhP_oY38uAzC9VX6PbOzo5j39Ay97O2xE8BysGCon48CEg%40mail.gmail.com.


There’s a Reason a Killer Money-Saving App Still Doesn’t Exist - The Wall Street Journal.

2023-11-15 Thread Martin Blais
This is a pretty good article about Mint and budgeting apps:

There’s a Reason a Killer Money-Saving App Still Doesn’t Exist
https://www.wsj.com/articles/theres-a-reason-a-killer-money-saving-appstill-doesntexist-24558f8c


I like this quote: "“Nobody wants to track an expense item for expense item
tracking,” she said."

I think that's true for most people, but I also think the type of person
that's a beancount user also gets a kick just out of being able to
reconcile properly.

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPDCMwPoz1HUgsP_hS%3DB%3D0m9FRAkzOogEO%2BHcQHKAm2cA%40mail.gmail.com.


Re: Announce: new Beancount parser in Rust

2023-11-15 Thread Martin Blais
The c++ parser in V3 is pretty much done.
This is other people writing a parser in rust.

It's worth noting that n beancount the parser alone isn't that useful. It's
because beancount processes its data in two stages: parsing, which produces
roughly a data structure that matches the input, and then running over the
stream of transactions to fill in missing numbers and also running all the
plugins. The result of that is the final stream of transactions that you
can do queries on. The logic in the second part is where all the complexity
lies. I haven't ported that.




On Wed, Nov 15, 2023, 04:54 Chary Chary  wrote:

> Martin,
>
> is this somehow alternative to the C++ parser, which you are working on in
> beancount v3?
>
> On Sunday, November 12, 2023 at 9:46:50 PM UTC+1 bl...@furius.ca wrote:
>
>> Thank you for sharing. Added to contrib doc.
>>
>>
>> On Sun, Nov 12, 2023 at 3:15 PM Simon Guest  wrote:
>>
>>> Ahoy Beancounters!
>>>
>>> Of interest really only to developers, I created a new parser for
>>> Beancount in Rust, called beancount-parser-lima
>>>  
>>> (because
>>> I am aware it is not the first such).
>>>
>>> I'm currently actively working on this, with my current focus being
>>> adding Python bindings.
>>>
>>> So far it parses everything I have tried.  No support for plugins,
>>> because, well, it's purely Rust so far!  (Also no support so far for query
>>> and custom directives, unsure how important they are.)
>>>
>>> Performance and rich error reporting are the two headlines.
>>>
>>> Hopefully this may be useful for some.
>>>
>>> cheers,
>>> Simon
>>>
>>> --
>>> 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 beancount+...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/d63af5c5-2670-4a65-9a88-570dabbb19fbn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/c82304a1-125a-4f93-a149-5717ce010079n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMVwL0TQRAETwXQ3MWuubJCmR%2ByLKa8bbYJO8cnvMriaA%40mail.gmail.com.


Re: Announce: new Beancount parser in Rust

2023-11-12 Thread Martin Blais
Thank you for sharing. Added to contrib doc.


On Sun, Nov 12, 2023 at 3:15 PM Simon Guest  wrote:

> Ahoy Beancounters!
>
> Of interest really only to developers, I created a new parser for
> Beancount in Rust, called beancount-parser-lima
>  (because
> I am aware it is not the first such).
>
> I'm currently actively working on this, with my current focus being adding
> Python bindings.
>
> So far it parses everything I have tried.  No support for plugins,
> because, well, it's purely Rust so far!  (Also no support so far for query
> and custom directives, unsure how important they are.)
>
> Performance and rich error reporting are the two headlines.
>
> Hopefully this may be useful for some.
>
> cheers,
> Simon
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/d63af5c5-2670-4a65-9a88-570dabbb19fbn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPUMhfjNpVfsevF2BQSFVjFusapmd7ZX_4ZGWjz%3DXc3-w%40mail.gmail.com.


Re: Getting commodity tracking working for individual securities

2023-10-28 Thread Martin Blais
The problem is not your currencies, it's the account names.
Account names do not support underscores. Use dashes instead.
(They probably should (mabe), but I'm not going to change the syntax in
stable/v2).

I'm not sure what the invalid currency error is, needs more detail

On Sat, Oct 28, 2023 at 11:34 PM Sagar Shankar  wrote:

> Hi,
>
> I'm trying to import my mutual fund transactions into Beancount. The
> mutual fund security names are in the format, "ADIT_BSL_FRON_YK3Z7Z", which
> are the ticker names from Google Finance.
>
> Initially I had tried to create transactions like:
> Assets:Broker:ADIT_BSL_FRON_YK3Z7Z  100 ADIT_BSL_FRON_YK3Z7Z {10 USD}
> Assets:Broker:ADIT_BSL_NIFT_136TO8I  100 ADIT_BSL_NIFT_136TO8I {9 USD}
> and so and so forth.
>
> This threw up a "Invalid Token" error. So I thought, maybe Beancount has
> some restrictions on account names. So then I moved to the following format:
> Assets:Broker  100 ADIT_BSL_FRON_YK3Z7Z {10 USD}
> Assets:Broker  100 ADIT_BSL_NIFT_136TO8I {9 USD}
> and I'm now getting an "Invalid Currency" error.
>
> I'm following the examples from this page -
> https://beancount.github.io/docs/how_inventories_work.html, as what I
> want to achieve is:
> 1. Track per security inventory
> 2. Track cost basis and networth, the latter by pulling the latest market
> price from Google Finance.
>
> Appreciate any advice on how to get this working
>
> Thanks
> Sagar
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAAP45exGz6rcYUAj5AgCgzQFn16DRKxprbse74R3bUJR2UuTTw%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPS697i5660Qw4Soi75vte%3Dbw1SWCn_D6UsdDdQhLN9hg%40mail.gmail.com.


Re: Posting Resolution are being rounded

2023-10-26 Thread Martin Blais
Yes it's just being rendered that way.
You can override the precision with an option declaration for that currency.
Search mailing list for the specifics.


On Thu, Oct 26, 2023, 04:34 Martin Michlmayr  wrote:

> * Vishesh Handa  [2023-10-26 10:27]:
> > 2022-03-10 * "Test"
> >   Expenses:B  42.0 EUR
>
> Why don't you change this to 42.00 EUR and everything will work the
> way you expected.
>
> I *believe* the explanation is that beancount uses the most common
> precision rather than the most accurate one given in your beancount
> file. (Martin or Dan or someone can give an accurate explanation.)
>
> However, I agree that what beancount does is not optimal here.
> --
> Martin Michlmayr
> https://www.cyrius.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/20231026083421.GA2807092%40jirafa.cyrius.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMtDKXUx5MKB%3D6OA0hCVk9T7Lv6dvbjxGSwTL0-r7132g%40mail.gmail.com.


Re: uabean: importers for Wise, Interactive Brokers, some Ukrainian banks & more

2023-09-24 Thread Martin Blais
Thanks for sharing Oleksii.
I've added a link from the contribs doc.


On Sun, Sep 24, 2023 at 12:45 PM Oleksii Sadovyi 
wrote:

> Hi all,
>
> I've just published my set of beancount goodies:
> https://github.com/OSadovy/uabean/
>
> Focused on what's accessible for Ukrainians, but also generic stuff, most
> notably this includes:
>
>- Interactive brokers flexreport importer
>
> that
>supports short trading, lot matching, corporate actions (splits/merges/etc)
>-  Wise (formerly Transferwise) downloader
>
> and
>importer
>
> 
>- Binance importer
>
> 
>- A script
>
> to
>sort the transactions inplace using autobean.refactor
>- A script
>
> to
>run the smart_importer inspired machine learning predictions on already
>existing ledger, adding predictions inplace
>
>
> While porting to beangulp, I did not found a way to run importer tests via
> pytest, so I created
> a
> small utility for that as well. Also, came up with custom testing utility
> that supports running importers with some existing ledger together with a
> downloaded file, as my Ibkr importer supports reducing inventory that comes
> from an existing beancount ledger.
>
> Hope somebody finds this useful.
>
>
> Lex
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/a9d9acdd-7e63-470d-bc28-c42f46bdf7bbn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMiM7wnx1h%2B-u9CWE7D%2BkR4g7vFZjcq1HyU9FKYmCFfnQ%40mail.gmail.com.


Re: Sharing expenses for dinner after adding up all expenses

2023-09-17 Thread Martin Blais
- your outgoing expenses for AR$1 and $ar18000
- your incoming transfer for AT$6000 from friend 1
- your incoming transfer for AT$6000 from friend 2
are all four separate transactions.
Add a unique link to all three.
Not sure there's more to it than that.
Looks like you overpaid by AR$1


On Sun, Sep 17, 2023 at 3:38 PM Matias  wrote:

> ups! some missing information.
>
> I spent ar$18.000, buying:
> - ar$10.000 Icecream (Store A)
> - ar$18.000 Wine. (Store B)
>
>
> El domingo, 17 de septiembre de 2023 a la(s) 16:21:56 UTC-3, Matias
> escribió:
>
>> Hi!
>> I'm starting to use beancount and I can't handle the registration of a
>> particular situation.
>> Last night a friend invited a group of friends for a barbecue at his home.
>> Each invited person bought something to take (icecream, beer, wine,
>> meat, etc)
>> Then we add up all expenses and share.
>> I spent AR$18000, and after adding up all the spent, each invited friend
>> have to pay AR$6000. Then, I received a bank transfer from two friends for
>> ARS6000 each.
>>
>> How do I register this?
>>
>> Thanks!
>> Matías.-
>>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/6d144236-f734-4dd5-ae68-bedb4f08d318n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMcqsxmWKJj%3D3h54MRt6zSDoSCp7PAnJ2%3D6i%3Dd2r79vig%40mail.gmail.com.


Re: Struggling to get padding working

2023-09-09 Thread Martin Blais
Docs are in Google Docs itself, just make an edit request and I'll grant


On Fri, Sep 8, 2023 at 6:07 PM Eric Altendorf 
wrote:

> On Wed, Sep 6, 2023 at 8:33 AM Daniele Nicolodi 
> wrote:
>
>> On 06/09/23 16:54, Eric Altendorf wrote:
>> >
>> >
>> > On Wed, Sep 6, 2023 at 04:00 Daniele Nicolodi > > > wrote:
>> >
>> > On 06/09/23 01:27, Sagar Shankar wrote:
>> >  > Hi Dan,
>> >  >
>> >  > Thanks a lot, this works now! A simple line on this in the pad
>> >  > documentation would be great for future reference of others
>> >
>> > The behavior is due to the balance directive being treated specially
>> > when sorting, not to the pad directive. Ordering is relevant for how
>> > all
>> > directives are processed. You would have observed similar issues if
>> you
>> > had a transaction and a balance assertion on the same day. The
>> order in
>> > which directives are processed is documented. I don't think adding a
>> > note to the documentation of each directive remembering the ordering
>> > issue would make the documentation better.
>> >
>> >
>> > Booking decisions and validity are also order dependent.
>> >
>> > Given how much the current documentation emphasizes that the order of
>> > entries doesn’t matter, this is IMHO confusing for new users.
>>
>> Can you please point to where the documentation states that ordering
>> does not matter? Obviously, order matters in a system designed to track
>> the changes of quantities (the balance of accounts) over time. What the
>> documentation states is that the order in which the entries appear in
>> the ledger does not matter, unless it is required to break ordering ties
>> of events registered on the same date. This is precisely documented.
>>
>> > I do believe the documentation would be improved by describing
>> > (somewhere) those cases where intra-day ordering *does* matter, and
>> > referencing that caveat in the places where ordering-invariance is
>> claimed.
>>
>> Ordering of transactions registered on the same day has nothing to do
>> with the problem discussed in this thread.
>>
>> However, if you have ideas on how the documentation can be improved,
>> feel free to send patches. Help is always welcome.
>>
>
> Where does the documentation live in github?  I can look again for the
> spots that I personally found confusing in the past and reevaluate them
> given what you've said, and if I can still think of improvements, send
> patches.
>
> Thanks,
> Eric
>
>
>>
>> Cheers,
>> Dan
>>
>> --
>> 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 beancount+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/2f5012cb-2ddd-b30f-aa00-7b5bf035e7e8%40grinta.net
>> .
>>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0tNJn9VHJyp2mu3FMjqpAivmep3TdB1JtxV%2B_SiXAxUXQ%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOg2htaf5yHegRBkH4HRa7RiJEPEhZdP_7p%3Dwd724B_nA%40mail.gmail.com.


Re: Capital gains

2023-09-03 Thread Martin Blais
On Fri, Aug 11, 2023 at 8:20 PM Eric Altendorf 
wrote:

>
>
> On Fri, Aug 11, 2023 at 3:53 PM Bakul Shah  wrote:
>
>>
>>
>> On Aug 10, 2023, at 4:13 PM, Eric Altendorf 
>> wrote:
>>
>>
>>
>> On Thu, Aug 10, 2023 at 3:12 PM Bakul Shah  wrote:
>>
>>> [new user here]
>>>
>>> Consider this example snippet:
>>>
>>> 2023-06-18 * "Buy shares of XYZ"
>>>   Assets:US:ETrade:Cash   -110.00 USD
>>>   Assets:US:ETrade:XYZ10 XYZ {10.00 USD}
>>>   Expenses:Financial:Commissions   10.00 USD
>>>
>>> 2023-07-21 * "Sell shares of XYZ"
>>>   Assets:US:ETrade:XYZ -10 XYZ {10.00 USD}
>>> @ 12.00 USD
>>>   Assets:US:ETrade:Cash110.00 USD
>>>   Expenses:Financial:Commissions   10.00 USD
>>>   Income:US:ETrade:Gains   -20.00 USD
>>> //anything else yields an error with bean-check
>>>
>>> As I understand it, actual capital gains in this case would be 0 when
>>> you consider the two commissions.
>>>
>>
>> At least in the US, yes.  FWIW, what your ledger currently reflects is
>> that you made 20 USD in capital gains profits but paid 20 USD in
>> commissions, which is a legitimate way of looking at things, just not as
>> convenient for reporting "capital gains" for tax purposes.
>>
>>
>>> But if 20 shares were bought originally with a $10 commission, Cap gains
>>> income would be -5 dollars (since half of the original shares were sold).
>>>
>>> Is there a way to reflect the actual capital gains?
>>>
>>
>> Thanks for your response. Through a connection I asked a couple of
>> experienced CPAs the same question and they suggested this:
>>
>> [image: image.png]
>>
>> Not quite what I was hoping for!
>>
>
> I think this is a pretty standard way of doing capital gains taxes.  Add
> the commissions to the cost when you buy, and deduct the commissions from
> the sale when you sell.
>
+1


>
> This is what the linked beancount documentation means when it says:  "A
> convenient method to automatically allocate the acquisition costs to the
> pro-rata value of the number of shares sold is to add the acquisition
> trading cost to the total book value of the position [] You could even
> go one step further and fold the commission on sale into the price of each
> share sold as well"
>
> in this context, "book value" is the same thing as "cost", "cost basis",
> "acquisition cost", etc.  (AFAIK)
>
> You can manually adjust your cost and proceeds in this way, and then
> beancount will compute the gain or loss that you expect.  Here's what that
> would look like (I think):
>
> 2023-06-18 * "Buy shares of XYZ"
>   Assets:US:ETrade:Cash   -110.00 USD
>   Assets:US:ETrade:XYZ10 XYZ {11.00 USD}
>  ;; Cost per share is 10 USD plus 1 USD of commission
>   ;; Expenses:Financial:Commissions   10.00 USD   Don't
> account for commissions here
>
> 2023-07-21 * "Sell shares of XYZ"
>   Assets:US:ETrade:XYZ -10 XYZ {11.00 USD} @
> 11.00 USD   ;; Sale price per share was 12 USD minus 1 USD of commission
>   Assets:US:ETrade:Cash110.00 USD
> ;;  Expenses:Financial:Commissions   10.00 USD  Don't account
> for commissions here
>   Income:US:ETrade:Gains  ;;  this will now be
> computed as zero.
>
> As you can see, doing things this way isn't as clear to the reader of the
> ledger.  What doesn't exist in Beancount is a nice syntax for specifying
> the actual cost and proceeds, and separately specifying transaction fees,
> and asking beancount to do the desired computation, so you get clarity and
> the output you want.
>

In the input syntax you recognize the commissions & fees separately, and
it's at the reporting stage that something's needed to make the necessary
adjustments. I do this in Johnny, and I think it should be easy to write a
script to do this for a Beancount ledger as well.

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOUmjhXcg1HnrFvJxVKQ9bZaC8yf_SHX3UAoN-dMqJM1Q%40mail.gmail.com.


Re: Capital gains reporting tools

2023-09-03 Thread Martin Blais
On Sun, Sep 3, 2023 at 11:07 AM Eric Altendorf 
wrote:

>
>
> On Sun, Sep 3, 2023 at 09:58 Martin Blais  wrote:
>
>> On Mon, Jul 24, 2023 at 12:47 PM Eric Altendorf 
>> wrote:
>>
>>> [changing subject line]
>>>
>>> On Sat, Jul 22, 2023 at 3:41 AM Daniele Nicolodi 
>>> wrote:
>>>
>>>> On 19/07/23 22:03, Eric Altendorf wrote:
>>>> > In a related vein, are there other reporting tools I can use with v3
>>>> > to generate even non-interactive reports?
>>>>
>>>> It really depends on what you intend for reporting tools. I use
>>>> beanquery for extracting data from my ledgers, but it is not exactly
>>>> what most people would call a reporting tool.
>>>>
>>>
>>> Thanks, I have played around a bit more with bean-doctor and also seen
>>> in the documentation what look like a lot of capabilities for reporting.
>>>
>>> What I would like is a human readable and auditable report of asset
>>> transactions, with booking decisions, that justify profit/loss and capital
>>> gains numbers.  I'm not an accountant so I don't really know if there's a
>>> typical format for that type of report.  My guess is that a report which
>>> shows transactions and how sales are booked against the inventory, with a
>>> snapshot of the inventory interleaved every n lines, might be roughly what
>>> I want.
>>>
>>> Any recommendations on what a CPA might want to look at to audit, or
>>> which Beancount tools I should investigate to build such a report, would be
>>> most appreciated!
>>>
>>
>> I think a Form 8949 equivalent is what they'd be looking for (a
>> spreadsheet).
>> You'd have to build it yourself (I did something like that in Johnny.)
>>
>
> Fwiw, I talked to my tax preparer about this, and for his purposes all he
> needs are the final numbers, like an 8949.  My issue with the 8949 is it
> doesn’t seem really auditable — if you do the sales as “various” lots then
> you can’t verify the gains, and if you split out every single lot the
> report becomes a hundred pages and you can’t holistically verify it’s
> correctness.  I at least want to be able to review and spot check
> correctness myself :)
>
> He said if I took it to an accounting firm to audit, they’d probably want
> the underlying trade data to do their own analysis.  And he said if the irs
> audits, it’s unpredictable, likely they wouldn’t be sophisticated enough to
> process raw trade data so it sounded like grokkable reports could be
> helpful there.
>

I think I've mentioned this in person but it's worth adding a link to
future readers of this thread finding themselves here:
"TradeLog" is likely the most sophisticated tool for doing something like
this for retail traders in general:
https://tradelog.com/
I don't know how well it supports crypto but it has some pages here:
https://support.tradelogsoftware.com/hc/en-us/articles/360001914193-How-TradeLog-Handles-Cryptocurrency-Digital-Currency-

These accountants recommend using it for their clients:
https://greentradertax.com/




>>> Thanks,
>>> eric
>>>
>>>
>> --
>>> 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 beancount+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/CAFXPr0ud5YP-xCqc9jSX%3Dn2X%2Bx9Xjn5g9VKoEpXsU%3Do%2BM38%2BWQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/beancount/CAFXPr0ud5YP-xCqc9jSX%3Dn2X%2Bx9Xjn5g9VKoEpXsU%3Do%2BM38%2BWQ%40mail.gmail.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/CAK21%2BhPoebYAuM7L-rzXy9vNpHt3%2BCrHrD4Afk4QujGJc2726g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/beancount/CAK21%2BhPoebYAuM7L-rzXy9vNpHt3%2BCrHrD4Afk4QujGJc2726g%40mail.gmail.com?utm_medium=email_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 beancount+unsubscr...@go

Re: Capital gains reporting tools

2023-09-03 Thread Martin Blais
On Mon, Jul 24, 2023 at 12:47 PM Eric Altendorf 
wrote:

> [changing subject line]
>
> On Sat, Jul 22, 2023 at 3:41 AM Daniele Nicolodi 
> wrote:
>
>> On 19/07/23 22:03, Eric Altendorf wrote:
>> > In a related vein, are there other reporting tools I can use with v3
>> > to generate even non-interactive reports?
>>
>> It really depends on what you intend for reporting tools. I use
>> beanquery for extracting data from my ledgers, but it is not exactly
>> what most people would call a reporting tool.
>>
>
> Thanks, I have played around a bit more with bean-doctor and also seen in
> the documentation what look like a lot of capabilities for reporting.
>
> What I would like is a human readable and auditable report of asset
> transactions, with booking decisions, that justify profit/loss and capital
> gains numbers.  I'm not an accountant so I don't really know if there's a
> typical format for that type of report.  My guess is that a report which
> shows transactions and how sales are booked against the inventory, with a
> snapshot of the inventory interleaved every n lines, might be roughly what
> I want.
>
> Any recommendations on what a CPA might want to look at to audit, or which
> Beancount tools I should investigate to build such a report, would be most
> appreciated!
>

I think a Form 8949 equivalent is what they'd be looking for (a
spreadsheet).
You'd have to build it yourself (I did something like that in Johnny.)



>
> Thanks,
> eric
>
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0ud5YP-xCqc9jSX%3Dn2X%2Bx9Xjn5g9VKoEpXsU%3Do%2BM38%2BWQ%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPoebYAuM7L-rzXy9vNpHt3%2BCrHrD4Afk4QujGJc2726g%40mail.gmail.com.


Re: Proposal for cost accounting in transfers

2023-08-29 Thread Martin Blais
On Sat, Aug 19, 2023, 21:14 Eric Altendorf  wrote:

> So having thought about this issue some more, I think I need some advice
> on a core architectural question.
>
> We want to fill out cost information on an augmenting (receiving) leg of a
> transfer, such that it matches the cost information on the reducing legs of
> the transfer.  Should this be part of:
>
> 1) booking, because booking fills out cost information, and in particular,
> here we are filling out exactly the same cost information on the augmenting
> legs that booking is computing for the reducing legs,
>
> or
>
> 2) imputation,
>

Fwiw I dub this "interpolation" in the code

because imputation is about inferring values to make the
> transaction balance, and to make a transaction balance, the augmenting cost
> info must match the reducing cost info
>
> Conceptually, making it part of imputation feels more correct, but booking
> is already filling out *some* cost info (the date) and we'd have to undo
> that in imputation -- implementation wise it feels easier to implement this
> in booking.
>

It's really not obvious. I've thought a lot about them interplay of booking
an interpolation in the past and looked at many scenarios and haven't found
an elegant solution yet (one may exist). I'm not super happy about the
ordering in which I carry out those two. I think what I do now is try to do
the reductions first in order to gather information that I can then use in
interpolation. There are some comments in the code about this.




>
> On Sat, Aug 19, 2023 at 5:27 PM Eric Altendorf 
> wrote:
>
>> Well, I actually just realized that I can't assume there is only one
>> reduction posting, because the reduction may pull from multiple lots.  I
>> need to investigate more.
>>
>> On Sat, Aug 19, 2023 at 2:05 PM Eric Altendorf 
>> wrote:
>>
>>> Hi all,
>>>
>>> A few recent (and older threads) have discussed "transferring" cost
>>> information from account to account in a transfer transaction (reduction in
>>> one account with a balancing augmentation in another account).
>>>
>>> I've studied the code and current behavior and it seems quite feasible
>>> to improve how this works.  I wrote up my findings and proposal here:
>>>
>>> https://docs.google.com/document/d/1M0W9U5ZdwkiziLNKfiQVIHYSI7gz_gM9pMQhicNXbE0/edit?usp=sharing
>>>
>>> I am sure my understanding of the system is limited and flawed, however,
>>> so I would greatly appreciate feedback, on my understanding of the problem
>>> and the current behavior, as well as on the proposed changes.
>>>
>>> Thank you in advance,
>>> eric
>>>
>> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0uQH%2BwU37Rj5CWnNRW%3D5%2Bdmxiu7Ccz5nedd3YE2tkJ3OA%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhM_kkGq8R-ASb%2BVkX5ZoLCdJLp41q43Mi0P3PQXtmEXLA%40mail.gmail.com.


Re: Additional cookbooks?

2023-08-27 Thread Martin Blais
What's there is all we got.


On Wed, Aug 16, 2023 at 5:33 PM Daniel Schonfeld 
wrote:

> Hello,
>
> I was wondering if the Taxes part of the cookbook has ever been completed
> and also if there's a similar cookbook for how to run a typical small
> business operation(s) as well as the owner entries for putting money into
> the business and taking distributions from 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/bec8b9b5-632a-4ddc-8a8d-a7b6814d0242n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhO%3D15GUyE7enDpDEJG%2Bzhghd92W40gVD12-S3kPNo053g%40mail.gmail.com.


Re: partial support for commission syntax?

2023-08-18 Thread Martin Blais
This works and is not about commissions per se, what it is is a combined
{per unit # per posting} syntax for cost. If you have 3 units, {100 # 3} is
a per unit cost of 101 per share unit.

Have you tried playing with bean-doctor?

On Sat, Aug 19, 2023, 05:34 Eric Altendorf  wrote:

> I was studying the beancount booking and interpolation code and tests, and
> came across a test case featuring this syntax, which I don't recall seeing
> in docs or discussions:
>
> 2015-10-02 *
>   Assets:Account   10 HOOL {100.00 # 9.95 USD}
>   Assets:Other   -1009.95 USD
>
> ...which looks like a notation for commissions, and is part of a
> (presumably) passing unit test.
>
> Is this actually supported/working?
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0tU02LrgSKDYCxGC5rkfSSGmpFrEgqPjeAKbuSVMRwx2w%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNcKkBYgU4%3Dv8PsZ%2BstRVLZ-2krMBA2oxL7LmrHR--H0g%40mail.gmail.com.


Re: Price fetching, imputation, and PnL

2023-08-13 Thread Martin Blais
On Thu, Aug 10, 2023 at 12:50 AM Eric Altendorf 
wrote:

> On Wed, Aug 9, 2023 at 5:48 AM Martin Blais  wrote:
>
>> The original goal of bean-price is
>>
>> - load the ledger and figure out which price entries are missing, say, at
>> transaction times and at regular intervals while positions are held
>> - fetch/scrape rates from some external sites
>> - print out the missing Price directives in Beancount format so you can
>> insert them into your file.
>> That's all.
>>
>
> OK, that's what I thought.  It doesn't seem to be doing this for me, not
> sure if there's a bug or if my test cases (e.g. earlier this thread) don't
> match the patterns it looks for.  Although I'm strongly biased against
> forking/duplicating code, this may be a case where I'm better off managing
> price fetching myself...I'll dig inside the library to see if I can at
> least reuse the fetching infra, even if I drive it with my own triggers.
>

Code rots. I haven't been using this regularly myself. It's possibly broken.
There is not much to reuse here; roll out your own is a fine alternative.



>
> In v3/master, moved it to its own repo so I could focus on just the core.
>> I admit it needs a bit more love.
>>
>
> No problem.  Don't construe any of my questions as complaints.  :)  I'm
> just trying to understand the state of the world so I can plan in ways that
> meet my own goals and hopefully also advance the Beancount platform at the
> same time.
>

No worries.
I'm sorry I haven't been able to follow / respond to the flurry of emails.


On Wed, Aug 9, 2023, 13:11 Eric Altendorf  wrote:
>>
>>> Here's another example:
>>>
>>> 2020-06-02 * "Mining reward of 0.05 BTC"
>>>   Assets:Ledger:BTC  0.05 BTC
>>>   Income:Mining:USD
>>>
>>> $ bean-price -vn price-fetch-test.beancount
>>> INFO: Using price cache at "/tmp/bean-price.cache" (with indefinite
>>> expiration)
>>> INFO: Processing at date: 2023-08-08
>>> INFO: Loading "price-fetch-test.beancount"
>>> BTC /USD @ latest [
>>> beanprice.sources.yahoo(BTC-USD) ]
>>>
>>> None of the transactions I enter seem to cause bean-price to fetch
>>> anything but @latest.
>>>
>>> Is there some annotation I need to be putting on my transactions to say
>>> "hey, price is needed here" ?
>>>
>>>
>>>
>>> On Tue, Aug 8, 2023 at 9:07 PM Eric Altendorf 
>>> wrote:
>>>
>>>> Thanks, William.
>>>>
>>>> On Tue, Aug 8, 2023 at 4:04 PM William Bean  wrote:
>>>>
>>>>> Hey Eric,
>>>>>
>>>>> Check out the repo for this that is located here:
>>>>> https://github.com/beancount/beanprice
>>>>>
>>>>> There is a little documentation there that you can take a look at, but
>>>>> basically you'll want to use:
>>>>>
>>>>
>>>> I have read that too.
>>>>
>>>>
>>>>> bean-price --update ledger.beancount
>>>>>
>>>>> That will fetch all historical prices (as needed by your ledger) up to
>>>>> the current day.
>>>>>
>>>>
>>>> Thanks for confirming that it is supposed to fetch historical prices.
>>>>
>>>> Do you know what beancount considers "needed by the ledger"?  I can't
>>>> seem to make sense of it; as I reported in my original post, it's not
>>>> fetching the prices that it seems to *me* the ledger would need.
>>>>
>>>> I'm assuming bean-price is designed for a different use case than mine
>>>> and offers different behavior, but I can't quite figure out what that use
>>>> case or behavior is, and without understanding that I can't figure out
>>>> whether I can adapt bean-price for my case...
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> On Monday, August 7, 2023 at 7:39:31 PM UTC-4 erical...@gmail.com
>>>>> wrote:
>>>>>
>>>>>> Let me ask a more basic question.  What is bean-price actually
>>>>>> supposed to do?
>>>>>>
>>>>>> Re-reading
>>>>>> https://beancount.github.io/docs/fetching_prices_in_beancount.html ,
>>>>>> I'm piecing together that perhaps the only thing bean-price does is
>>>>>> value your assets as of a certain date.  Is that true?  TBH it'

Re: Price fetching, imputation, and PnL

2023-08-09 Thread Martin Blais
The original goal of bean-price is

- load the ledger and figure out which price entries are missing, say, at
transaction times and at regular intervals while positions are held
- fetch/scrape rates from some external sites
- print out the missing Price directives in Beancount format so you can
insert them into your file.
That's all.

In v3/master, moved it to its own repo so I could focus on just the core. I
admit it needs a bit more love.



On Wed, Aug 9, 2023, 13:11 Eric Altendorf  wrote:

> Here's another example:
>
> 2020-06-02 * "Mining reward of 0.05 BTC"
>   Assets:Ledger:BTC  0.05 BTC
>   Income:Mining:USD
>
> $ bean-price -vn price-fetch-test.beancount
> INFO: Using price cache at "/tmp/bean-price.cache" (with indefinite
> expiration)
> INFO: Processing at date: 2023-08-08
> INFO: Loading "price-fetch-test.beancount"
> BTC /USD @ latest [
> beanprice.sources.yahoo(BTC-USD) ]
>
> None of the transactions I enter seem to cause bean-price to fetch
> anything but @latest.
>
> Is there some annotation I need to be putting on my transactions to say
> "hey, price is needed here" ?
>
>
>
> On Tue, Aug 8, 2023 at 9:07 PM Eric Altendorf 
> wrote:
>
>> Thanks, William.
>>
>> On Tue, Aug 8, 2023 at 4:04 PM William Bean  wrote:
>>
>>> Hey Eric,
>>>
>>> Check out the repo for this that is located here:
>>> https://github.com/beancount/beanprice
>>>
>>> There is a little documentation there that you can take a look at, but
>>> basically you'll want to use:
>>>
>>
>> I have read that too.
>>
>>
>>> bean-price --update ledger.beancount
>>>
>>> That will fetch all historical prices (as needed by your ledger) up to
>>> the current day.
>>>
>>
>> Thanks for confirming that it is supposed to fetch historical prices.
>>
>> Do you know what beancount considers "needed by the ledger"?  I can't
>> seem to make sense of it; as I reported in my original post, it's not
>> fetching the prices that it seems to *me* the ledger would need.
>>
>> I'm assuming bean-price is designed for a different use case than mine
>> and offers different behavior, but I can't quite figure out what that use
>> case or behavior is, and without understanding that I can't figure out
>> whether I can adapt bean-price for my case...
>>
>>
>>
>>
>>>
>>> On Monday, August 7, 2023 at 7:39:31 PM UTC-4 erical...@gmail.com wrote:
>>>
 Let me ask a more basic question.  What is bean-price actually supposed
 to do?

 Re-reading
 https://beancount.github.io/docs/fetching_prices_in_beancount.html ,
 I'm piecing together that perhaps the only thing bean-price does is
 value your assets as of a certain date.  Is that true?  TBH it's not clear
 from the docs.

 There are other uses for prices, e.g., establishing cost basis for a
 purchase, or establishing the value of the transfer of an asset at a
 particular point in time be that for income or expenses.  Are there
 existing plugins that can look up historical prices and annotate
 transactions with them where they're missing?

 On Tue, Aug 1, 2023 at 5:54 PM Eric Altendorf 
 wrote:

> I'm having trouble understanding how automatic price fetching works,
> and I think it's being additionally complicated by questions of price
> imputation and maybe PnL accounts.  Let's start with the simplest case.
> Consider (commodity declarations omitted for brevity):
>
> 2020-01-01 * "Buy BTC (from USD)"
>   Assets:Coinbase:BTC   0.5000 BTC
>   Assets:Coinbase:USD  -4750. USD
>
> I would have expected bean-price to fetch a price for BTC for
> 2020-01-01, but instead it fails, saying the transaction doesn't balance.
> Now, if I supply a price
>
> 2020-01-01 * "Buy BTC (from USD)"
>   Assets:Coinbase:BTC   0.5000 BTC @ 9500.0 USD
>   Assets:Coinbase:USD  -4750. USD
>
> or supply a price spec with no number:
>
> 2020-01-01 * "Buy BTC (from USD)"
>   Assets:Coinbase:BTC   0.5000 BTC @ USD
>   Assets:Coinbase:USDT  -4750. USD
>
> then there is no error, but bean-price fetches *today's* price.
>
> Now let's consider a more complex example:
>
> 2020-02-01 * "Buy BTC (from USDT)"
>   Assets:Coinbase:BTC   0.5000 BTC
>   Assets:Coinbase:USDT  -4750. USDT
>   Income:PnL
>
> Here, I'd like to fetch the USD prices of both BTC and USDT, which
> would allow PnL to be computed, but bean-price fetches nothing.  Now, if I
> put "@ USD" at the end of the BTC posting (as above), instead of getting
> the price on 2020-01-01 (as I desire), or the price today (as in the
> earlier example), I get "Too many missing numbers for currency group 
> 'USD'".
>
> I can't quite figure out what bean-price is doing, or square it
> against the documentation
> 

Re: Should Pension(401K) be an Assets account?

2023-08-04 Thread Martin Blais
401k is an asset.
When I compute net worth I apply estimated taxes with a rate that depends
on the account, e.g. pre tax, Roth, taxable, etc.
In that sense assets is "gross" but I'm not sure it makes sense to say that.

I don't track pension at the government (social security). It's an expense
from my pov on the payroll.

On Sat, Aug 5, 2023, 07:23 Tianwei Dong  wrote:

> Pension(401K) normally is before tax, putting that as an Assets account
> will kind of inflate the Assets in the Balance sheet.
>
> How do everyone handle this?
>
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/03ae3bfa-38f0-40fa-9e94-dff47e9f6438n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOabX3CSqiVKQMrmbXdNWP_OcuU8h8Ot0ULqh4RLYNhAA%40mail.gmail.com.


Re: Errors from run_query(), not from bean-query

2023-08-02 Thread Martin Blais
Btw, fwiw, the beanlabs repo has a bunch of random scripts you might find
useful to eyeball, that use the api

On Thu, Aug 3, 2023, 08:54 Martin Blais  wrote:

> Use bn.loader.load_file(), not just the parser.
> Beancount has two stages: parsing, then booking and running all the
> plugins.
> Loading does both.
> The query is intended to be run on the output of the loader.
>
> On Thu, Aug 3, 2023, 08:21 Eric Altendorf  wrote:
>
>> I'm getting errors inside beancount/ops/summarize.py while using
>> beanquery's run_query() programmatically.  This is on a beancount ledger
>> that works fine when I run bean-query from the command line.  I'm not sure
>> if I'm failing to use the programmatic API correctly or if there's
>> something else going on.
>>
>> bean-query access (works):
>>
>> subprocess.run(["bean-query", ledger, query], check=True,
>> capture_output=True)
>>
>> Programmatic access (doesn't work):
>>
>> entries, errors, options = parser.parse_file(ledger)
>> run_query(entries, options, query)
>>
>> The first error I got was this:
>>   
>>   File "/home/eric/crypto-taxes/beancount/beancount/ops/summarize.py",
>> line 497, in conversions
>> narration = 'Conversion for {}'.format(conversion_balance)
>>   File "/home/eric/crypto-taxes/beancount/beancount/core/inventory.py",
>> line 122, in __str__
>> return self.to_string()
>>   File "/home/eric/crypto-taxes/beancount/beancount/core/inventory.py",
>> line 114, in to_string
>> ', '.join(pos.to_string(dformat) for pos in sorted(self)))
>>   File "/home/eric/crypto-taxes/beancount/beancount/core/position.py",
>> line 246, in __lt__
>> return self.sortkey() < other.sortkey()
>>   File "/home/eric/crypto-taxes/beancount/beancount/core/position.py",
>> line 227, in sortkey
>> if self.cost.number:
>> AttributeError: 'CostSpec' object has no attribute 'number'
>>
>> This was only a little surprising because I'm using the "{USD}" cost-spec
>> hack, and I've had to elsewhere tweak beancount-core to be robust to such
>> cost specs.  It's still a bit surprising since as I said don't get this
>> error when running the bean-query tool on the same file.  Anyway, I hacked
>> the comparator and got past this point, to:
>>   
>>   File "/home/eric/crypto-taxes/beancount/beancount/ops/summarize.py",
>> line 480, in conversions
>> conversion_balance = interpolate.compute_entries_balance(entries,
>> date=date)
>>   File "/home/eric/crypto-taxes/beancount/beancount/core/interpolate.py",
>> line 275, in compute_entries_balance
>> total_balance.add_position(posting)
>>   File "/home/eric/crypto-taxes/beancount/beancount/core/inventory.py",
>> line 461, in add_position
>> return self.add_amount(position.units, position.cost)
>>   File "/home/eric/crypto-taxes/beancount/beancount/core/inventory.py",
>> line 416, in add_amount
>> key = (units.currency, cost)
>> AttributeError: type object 'MISSING' has no attribute 'currency'
>>
>> So somehow I've got a missing value for some units.  I started tweaking
>> this code too to be robust to this case, but there were too many places
>> where it's assumed not-missing, and it seemed sketch to be hacking the code
>> for adding to inventories this way.
>>
>> Any idea what's going on?
>>
>> --
>> 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 beancount+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/CAFXPr0st_mX_NyovM%2BDkr8XJ%3D7Q048kOa8JHhUfCyaAcP9M0Zw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/beancount/CAFXPr0st_mX_NyovM%2BDkr8XJ%3D7Q048kOa8JHhUfCyaAcP9M0Zw%40mail.gmail.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNn8j6t8kcdPUgg3WL0B5WOCkGdWG4LMLcAa3es7QhE_A%40mail.gmail.com.


Re: Errors from run_query(), not from bean-query

2023-08-02 Thread Martin Blais
Use bn.loader.load_file(), not just the parser.
Beancount has two stages: parsing, then booking and running all the plugins.
Loading does both.
The query is intended to be run on the output of the loader.

On Thu, Aug 3, 2023, 08:21 Eric Altendorf  wrote:

> I'm getting errors inside beancount/ops/summarize.py while using
> beanquery's run_query() programmatically.  This is on a beancount ledger
> that works fine when I run bean-query from the command line.  I'm not sure
> if I'm failing to use the programmatic API correctly or if there's
> something else going on.
>
> bean-query access (works):
>
> subprocess.run(["bean-query", ledger, query], check=True,
> capture_output=True)
>
> Programmatic access (doesn't work):
>
> entries, errors, options = parser.parse_file(ledger)
> run_query(entries, options, query)
>
> The first error I got was this:
>   
>   File "/home/eric/crypto-taxes/beancount/beancount/ops/summarize.py",
> line 497, in conversions
> narration = 'Conversion for {}'.format(conversion_balance)
>   File "/home/eric/crypto-taxes/beancount/beancount/core/inventory.py",
> line 122, in __str__
> return self.to_string()
>   File "/home/eric/crypto-taxes/beancount/beancount/core/inventory.py",
> line 114, in to_string
> ', '.join(pos.to_string(dformat) for pos in sorted(self)))
>   File "/home/eric/crypto-taxes/beancount/beancount/core/position.py",
> line 246, in __lt__
> return self.sortkey() < other.sortkey()
>   File "/home/eric/crypto-taxes/beancount/beancount/core/position.py",
> line 227, in sortkey
> if self.cost.number:
> AttributeError: 'CostSpec' object has no attribute 'number'
>
> This was only a little surprising because I'm using the "{USD}" cost-spec
> hack, and I've had to elsewhere tweak beancount-core to be robust to such
> cost specs.  It's still a bit surprising since as I said don't get this
> error when running the bean-query tool on the same file.  Anyway, I hacked
> the comparator and got past this point, to:
>   
>   File "/home/eric/crypto-taxes/beancount/beancount/ops/summarize.py",
> line 480, in conversions
> conversion_balance = interpolate.compute_entries_balance(entries,
> date=date)
>   File "/home/eric/crypto-taxes/beancount/beancount/core/interpolate.py",
> line 275, in compute_entries_balance
> total_balance.add_position(posting)
>   File "/home/eric/crypto-taxes/beancount/beancount/core/inventory.py",
> line 461, in add_position
> return self.add_amount(position.units, position.cost)
>   File "/home/eric/crypto-taxes/beancount/beancount/core/inventory.py",
> line 416, in add_amount
> key = (units.currency, cost)
> AttributeError: type object 'MISSING' has no attribute 'currency'
>
> So somehow I've got a missing value for some units.  I started tweaking
> this code too to be robust to this case, but there were too many places
> where it's assumed not-missing, and it seemed sketch to be hacking the code
> for adding to inventories this way.
>
> Any idea what's going on?
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0st_mX_NyovM%2BDkr8XJ%3D7Q048kOa8JHhUfCyaAcP9M0Zw%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOK9NUkq7WbZfzrpK%3DSjVqn2ZiMyUV-xS10ykEX-m9zMw%40mail.gmail.com.


Re: ValueError: String too long (66 lines) - why?

2023-08-02 Thread Martin Blais
Send me a patch. Im not home and have only a minimal dev setup on an old
laptop and the odd late hour free every 3,4 days

On Thu, Aug 3, 2023, 02:45 Stefano Zacchiroli  wrote:

> On Wed, Aug 02, 2023 at 09:39:40PM +0800, Martin Blais wrote:
> > Happy to raise or remove the limit in v2 if you want.
>
> That would be nice (+ publishing a new minor version on PyPI ;-)),
> thanks! And thanks also to Daniele for explaining the rationale behind
> this limitation.
>
> My 2 cents on the rationale is that it's an odd trade-off. It doesn't go
> all the way of trying to detect that the long string is *actually*
> beancount markup that ended up in a string by mistake; hence when it is
> the case it provides a potentially misleading error message ("string too
> long"); and at the same time rejects (arguably) valid inputs like mine.
> These for me are good arguments for dropping removing the limit
> entirely. YMMV.
>
> Cheers
> --
> Stefano Zacchiroli . z...@upsilon.cc . https://upsilon.cc/zack  _. ^ ._
> Full professor of Computer Science  o o   o \/|V|\/
> Télécom Paris, Polytechnic Institute of Paris o o o   <\>
> Co-founder & CTO Software Heritageo o o o   /\|^|/\
> https://twitter.com/zacchiro . https://mastodon.xyz/@zacchiro   '" V "'
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/20230802184546.fvytscxwgcaiguci%40upsilon.cc
> .
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPN7Rute11ZBUcjqTcU9Du%2BfnpicpUFqQUUiZ-NRF70aA%40mail.gmail.com.


Re: ValueError: String too long (66 lines) - why?

2023-08-02 Thread Martin Blais
Happy to raise or remove the limit in v2 if you want.


On Wed, Aug 2, 2023 at 8:48 PM Daniele Nicolodi  wrote:

> On 02/08/23 11:43, Stefano Zacchiroli wrote:
> > Heya, I'm hitting this error in the beancount v2 C parser (quoting from
> > beancount/parser/tokens.c):
> >
> >  if (lines > LONG_STRING_LINES_MAX) {
> >  PyErr_Format(PyExc_ValueError, "String too long (%d lines)",
> lines);
> >  free(unescaped);
> >  return NULL;
> >  }
> >
> > What's the reason for that test/check?
>
> The idea is to detect instances where the user forgot a closing quote.
> However, for how a beancount ledger is usually structured, it is very
> hard to hit the line count limit before the ledger contains an unrelated
> quote character that get interpreted as the closing quote.
>
> IIRC I wanted to remove the check when I restructured the parser, but
> Martin wanted to keep it. The compromise was to set the line count limit
> to a relatively large number, 64, which makes hitting the limit in case
> of a syntax error even less likely, and thus the check less useful.
> Lately the limit as been increased again to 256, but a version of
> beancount with the limit raised has not been released yet. The limit in
> v3 is still there and set to 256.
>
> Probably installing v2 from source solves your immediate need, but I
> think we should just remove the limit.
>
> Cheers,
> Dan
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/00ac805b-1f2a-e934-3ae3-1865c803b5cf%40grinta.net
> .
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNNuDjKUjhpjuoLGy9do_O6%2BqykT5aRgA%2BjM5Ge%3DNweYg%40mail.gmail.com.


Re: Best path for some simple importers

2023-07-30 Thread Martin Blais
On Wed, Jul 19, 2023 at 9:10 AM Eric Altendorf 
wrote:

> FWIW I went ahead and wrote my importers to the Beangulp API.  I'm
> developing them here if anyone wants to follow along, contribute, or
> comment:
> https://github.com/ericaltendorf/beancount-crypto-importers
>
> Currently covers Coinbase, Coinbase Pro, and Gate.io.
>

Nice!
Added to contribs doc
https://docs.google.com/document/d/1Z37bQ45wDtjTPaMQ_x-f33p1trH9fNosEAUgbQXwp30/



>
> For now I just have a dumb shell script that runs each importer and merges
> their output textually.  I'll be investigating some of the
> deduping frameworks.
>
> On Mon, Jul 17, 2023 at 4:34 PM Martin Blais  wrote:
>
>> On Tue, Jul 18, 2023 at 12:52 AM Eric Altendorf 
>> wrote:
>>
>>> Thanks for the quick reply!
>>>
>>> On Sun, Jul 16, 2023 at 8:58 PM Red S  wrote:
>>>
>>>> I'd recommend exactly that as the first step---spitting out text files
>>>> of the write format, and using that with your workflow for a while. You'll
>>>> either find that sufficient, or truly understand the specific problems you
>>>> want to solve, and be able to pick the right framework with that knowledge.
>>>
>>>
>>> Cool, makes sense.
>>>
>>>
>>>> Beancount has a built in generic CSV importer, I'd suggest trying that
>>>> first. That'll get you bean-{identify, extract, file} for free. If you need
>>>> the heavy lifting of investments, find yourself solving similar problems
>>>> across multiple importers, or find your workflow could be smoother, my
>>>> importer framework can help.
>>>>
>>>
>>> I'm not even sure if identify/extract/file is useful to me.  I literally
>>> have 4 CSV files that have my all time historical transactions, that are
>>> already filed in the place I want them, and I just want to calculate cap
>>> gains and transaction fees for tax purposes.  I'll take a look at the
>>> generic importer and see if I can figure it out; it may be easier to start
>>> from scratch.
>>>
>>
>> I agree; if you do a one-off conversion from just a few sources of data
>> the whole importer/ingest framework doesn't buy you much.
>> I'd just write a script.
>>
>>
>>
>>
>>>
>>> thanks!
>>>
>>>
>>>
>>>>
>>>> On Sunday, July 16, 2023 at 8:34:59 PM UTC-7 erical...@gmail.com wrote:
>>>>
>>>>> I have a few CSV files with basic transactions (basically sent and
>>>>> received assets & amounts, plus commission cost).  These are all I need to
>>>>> process.  It would be pretty easy for me to just translate them line by
>>>>> line into Beancount format inputs, but I like to do things "the right
>>>>> way".  Problem is, I can't figure out what "the right way" is :)
>>>>>
>>>>> I spent a long time exploring the importer framework before realizing
>>>>> that it was the old one, tossed out for v3.  I have now read the design 
>>>>> doc
>>>>> for the v3 importer system, the readme, skimmed the code and some 
>>>>> examples,
>>>>> and then read some threads on this list which also led me to RedS's CSV
>>>>> framework, which I also looked into.
>>>>>
>>>>> Am I trying too hard?  Should I just ignore the frameworks and spit
>>>>> out text files of the right format?  If I should use a framework...which
>>>>> would folks recommend?
>>>>>
>>>>> thanks,
>>>>> eric
>>>>>
>>>> --
>>>> 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 beancount+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/beancount/c091350e-c0f5-45af-9a64-35bd17ae76f7n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/beancount/c091350e-c0f5-45af-9a64-35bd17ae76f7n%40googlegroups.com?utm_medium=email_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 beancount+unsubscr...@googleg

Re: Legs for asset exchanges out of operating currency

2023-07-30 Thread Martin Blais
On Wed, Jul 19, 2023 at 8:50 AM Eric Altendorf 
wrote:

> I'm trying to understand how to construct legs for a transaction where no
> legs are in the operating currency.  For example, one might exchange USDT
> (Tether) for BTC.  USDT is sorta like USD but actually not, and its
> exchange rate does fluctuate.  Such a transaction isn't technically just a
> purchase from the standpoint of US taxation; it rather is considered:
>
> 1) a virtual sale of the USDT for USD, for which capital gains may be owed
> 2) a virtual purchase of BTC with those USD proceeds, which establishes
> the cost basis for the BTC
>

FYI, I don't think we do crypto well in Beancount (yet). I mean, if it
works it's incidental, other than participation in threads and some design
notes for the future, its author never really sat down to solve those
issues.


I don't yet have a deep enough intuition on Beancount "cost" and "price" to
> understand whether this can be accomplished simply with two legs (a USDT
> leg and a BTC leg) with some "price" magic, or whether I need four legs
> (two additional USD legs).
>
> How would one record such a transaction?
>

Does this work well enough?

plugin "beancount.plugins.sellgains"


2022-01-01 open Equity:Opening-Balances

2022-01-01 open Assets:Coinbase:USDT USDT

2022-01-01 open Assets:Coinbase:BTC  BTC

2022-01-01 open Income:Coinbase:Pnl  USD



2022-06-01 * "Initial balances"

  Assets:Coinbase:USDT  2 USDT {1. USD}

  Assets:Coinbase:BTC   10 BTC {1.00 USD}

  Equity:Opening-Balances


2022-06-01 * "Your transaction"

  Assets:Coinbase:USDT  -10209.18 USDT {} @ 1.023 USD

  Assets:Coinbase:BTC   1 BTC {10444 USD}

  Income:Coinbase:Pnl

The thing is, the capital gains between the USDT and the BTC are mixed
together, maybe that's not great.




> (For bonus points, some exchanges charge transaction fees in other assets,
> e.g. USDT.  In that case, the transaction fees are then also an implicit
> sale for USD, so I need to figure out how to enter that as well.)
>
> thanks,
> eric
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0tqjUwuu6FPkN5wc9M0v5PrYnXoMDyzao%3DNY2zyiL69pg%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPrCQ%3DLnrSNnRj4RsEz7-1L-vh0y1mKu7if33h8X_bRuw%40mail.gmail.com.


Re: How to transfer lots between accounts and how to query lot information?

2023-07-30 Thread Martin Blais
On Wed, Jul 19, 2023 at 6:44 AM Eric Altendorf 
wrote:

> Just found this thread.  I think I'm encountering similar issues;
> difficulties tracking assets that have been transferred.
>
> Have there been any developments on this front since?
>

No



>
> On Saturday, June 5, 2021 at 4:05:36 PM UTC-7 Red S wrote:
>
>> Glad it helped. I'll post the python file if I find it. Meanwhile, here
>> is a dummy skeleton of a vim function written in python to serve as an
>> example. I find these useful to save for somewhat rare (say once/twice a
>> year) but repeated transformations. Eg: stock splits. I can never remember
>> the syntax of vimscript since I rarely use it, and hence, writing these in
>> python helps.
>>
>> # to be run on bean-doctor context output inside vim
>> function! CapGains()
>> python3 << EOF
>> import vim
>> from decimal import Decimal
>>
>> line = vim.current.line
>> s = line.split()
>> account = s[0].replace('Assets', 'Income')
>> vim.current.line = f'{line} ; Hello world: {account}'
>> EOF
>> endfunction
>>
>>
>> On Saturday, June 5, 2021 at 12:59:13 AM UTC-7
>> sm...@davethehappysinger.com wrote:
>>
>>> Thanks, some neat ideas there! :D
>>>
>>> On Saturday, 5 June 2021 at 3:04:46 pm UTC+10 redst...@gmail.com wrote:
>>>
 On Friday, June 4, 2021 at 8:40:54 PM UTC-7
 sm...@davethehappysinger.com wrote:

> Apologies for bumping an old thread with an off-topic question, but
> Redstreet, you said:
>
> > I personally have a vim plugin that uses bean-doctor context to
> insert the lots.
>
> This is really interesting; I wonder if this is something that's
> openly available or if it's a personal hack whether you'd be interested in
> sticking it on Github?
>

 For conversions, it's trivial: it's a 2 or 3 line python script that
 scales the units and cost fields. When I have an imported transaction that
 looks like:

 2000-01-01 * "Upgrade shares"
   Assets:XTrade:ABC -234.15 ABC
   Assets:XTrade:DEF 175.45 DEF

 Then what I do is: get beancount context (I've mapped this to '\g' in
 vim-beancount), which opens the context in a split. I then select (visual
 mode) all the ABC lots, and pipe it through the python script. An
 equivalent awk script would look roughly like:

 :'<,'>!awk '{print $1, -$2*(175.45/234.15), $3, $4, $5*(234.15/175.45),
 $6, $7}'

 My python script just made this easier by spitting out both sides of
 the transaction (DEF as well), and accepting parameters for the scale 
 value.



 --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/2a9684b7-8c10-47ee-8bec-bd58c1095023n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMisGxYyhdEk2RpFB-UWPz40T3wv7seWog-qyaC5qJEew%40mail.gmail.com.


Re: Workflow questions

2023-07-30 Thread Martin Blais
On Wed, Jul 19, 2023 at 2:08 AM Eric Altendorf 
wrote:

> Thanks so much for the detailed reply.  I'm slowly but surely wrapping my
> head around everything.
>
> [...]

> I'm a little surprised this doesn't seem to be a more common problem;
> I would think this would be useful to many traders.
>

Lots to say but others have already filled in with great answers. Overall
based on this thread it seems reasonably clear to me you'd be better served
by building something custom for what you're trying to achieve. Kind-of
like what I've done with project "Johnny" but specialized to (a) crypto and
(b) booking/matching rules that corresponding to your particular tax
reporting requirements. I don't think you'll get much from Beancount,
you're likely to invest enough time that what it'll provide for you won't
matter much.

That being said, some of the data structures could be used in implementing
your booking algo, but then again, it's probably simpler to write ones that
will do precisely what you need.

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOuGhaasCb-ZhD16bw7GXO%2BD5hXKr31jeVfE0VCTayf0A%40mail.gmail.com.


Re: Deduplication & merging questions

2023-07-30 Thread Martin Blais
One of the things that was never done is to specify deduplicating by import
source, which would make a lot of sense.
Some institutions, e.g. Amex, have really nice unique ids on each
transaction that can be used to dedup exactly (if preserved).  Some don't.
The heuristics I'm using today are imperfect... this needs improvement.


On Tue, Jul 18, 2023 at 6:22 AM Eric Altendorf 
wrote:

> I see hooks for dup deduction on importers, but the doc comments don't
> make it clear how those functions are used.  Poking around the code, it
> appears that these are only run to dedup items within a single import.
>
> Is there any functionality to automatically match up legs of a transaction
> that come from different importers, e.g., a transfer from one account to
> another?
>
> thanks,
> ericc
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0vp0MtWcDr0ueMuvXFREO5G1oTGC0UvD%2BRXD%2BdbLG9D%3Dg%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhM2Sexk%3D%3DZ5BQQxK67L9Xbx%2BFAE4%3D-mz9jO%2BjNSPYnJow%40mail.gmail.com.


Re: Questions for rigorous cap gains tracking

2023-07-30 Thread Martin Blais
On Sat, Jul 15, 2023 at 11:19 AM Eric Altendorf 
wrote:

> I'm looking into Beancount for the specific purpose of rigorous capital
> gains tracking for crypto transactions.  I just read the docs, and now have
> a few questions, hoping someone can help.  Thanks in advance!  :)
>

> I'd like to run my own rules for booking (mostly HIFO, except able to
> select a slightly lower basis lot if it qualifies for long term instead of
> short term cap gains .. maybe some other special cases).  I'm guessing I
> will need to implement these rules in my importer somehow, and have the
> importer label each lot and sale?  Or should I implement the rules in
> Beancount directly?
>

Those are not pluggable (but it would be a good idea to restructure some of
my code to make it so).
You'd have to make the change to the "master" branch, if you mirror the
other methods I'd welcome a PR (it should be easy I think).


I'll have a few (maybe 3-6) CSVs of all-time transactions from wallet
> software or downloaded from exchanges.  Should I write Beancount importers,
> or just scripts that generate Beancount text files?  Does my need for
> custom lot-selection rules affect this decision?
>

Not really. I think it's a matter of whether you think the
identify/extract/archive functionality is useful to you.
Based on all the emails that follow this one, I suspect not; a custom
script is probably what you're after.

Also note: if you'll invest a lot of time into this, if your only purpose
is to get booking like HIFO you can probably just as well do away with
Beancount and write something custom.


What's a good workflow for taking the booking decisions Beancount makes for
> a given tax year and "locking" them in so they can't be changed when I run
> again in the next tax year -- e.g., if I tweak my booking algorithm?
>

You don't reimport the same material. Updating your Beancount input file
should be an incremental process. Don't overwrite that you already
imported. Similar to my previous comment -- if you're going to automate
importing everything from scratch every time you might as well build
something distinct; I did that myself with github.com/blais/johnny.


I saw in the docs somewhere that transaction merging isn't well supported.
> Is that still the case?  This is something I'll encounter since transfers
> between an exchange and a cold wallet will result in one leg being imported
> from the exchange and the other from the cold wallet.
>

That's still the case.  For context: by "merging" what is meant here is
that the two halves of a two posting transaction are inserted in the input
as two distinct transactions and automatically merged into one.  (It just
requires a feature that matches the transactions and inserts postings to
transfer accounts, a bunch of design questions would come up.)


> I was a little surprised that Beancount doesn't deal with times or
> timezones :)  Are there cases where ordering of intraday transactions can
> mess things up?
>

That was an explicit design decision to (a) keep things simple (it can get
pretty hairy), (b) because the various institutions don't usually include
time and we're just trying to represent the data from the institutions. At
this stage my sense is that all we need is a way to resolve ordering.
Given that balance checks are done sparsely on the flow of transactions
changes in ordering don't cause dramatic problems, but like the ability to
resolve the mismatch in dates from two sides of a transaction, it would be
nice to eventually solve this properly.



>
> This page discussed Beancount's incomplete handling of acquisition
> costs/commissions:
> https://beancount.github.io/docs/trading_with_beancount.html#commissions
> Is that still an outstanding issue?
>

Yes.  Historically the few times I needed this I wrote a script to do this
at reporting time. Johnny also deals with this properly.


In cases where a transaction has legs in non-USD (e.g., a USDT (Tether
> stablecoin) / BTC swap), but it needs to be tracked for taxes in USD terms,
> is it a good practice to split the transaction with a synthetic temporary
> position in USD (i.e., one USDT-USD tx and one USD-BTC tx?)
>

I have no idea (I don't do crypto).
It sounds to me more onerous than to just use USD right away, but I have no
idea how those things get taxed.


This doesn't matter yet for crypto, but are there ways to catch/prevent
> wash sales using Beancount?
>

Oh gosh... I went down the rabbit hole of attempting to compute them some
years ago, I remember I went deep on that one. After spending days building
something and looking into all the minute details and examples from the IRS
I came out with the conviction that it's an ill-defined problem, there are
cases you can't resolve. I can't remember now. I'm scarred.

But that's a separate issue. It should be easy to build something that
warns you as of a particular date (say "today") and across all your
accounts what you can't trade. I think I do that in Johnny, it has 

Re: Best path for some simple importers

2023-07-17 Thread Martin Blais
On Tue, Jul 18, 2023 at 12:52 AM Eric Altendorf 
wrote:

> Thanks for the quick reply!
>
> On Sun, Jul 16, 2023 at 8:58 PM Red S  wrote:
>
>> I'd recommend exactly that as the first step---spitting out text files of
>> the write format, and using that with your workflow for a while. You'll
>> either find that sufficient, or truly understand the specific problems you
>> want to solve, and be able to pick the right framework with that knowledge.
>
>
> Cool, makes sense.
>
>
>> Beancount has a built in generic CSV importer, I'd suggest trying that
>> first. That'll get you bean-{identify, extract, file} for free. If you need
>> the heavy lifting of investments, find yourself solving similar problems
>> across multiple importers, or find your workflow could be smoother, my
>> importer framework can help.
>>
>
> I'm not even sure if identify/extract/file is useful to me.  I literally
> have 4 CSV files that have my all time historical transactions, that are
> already filed in the place I want them, and I just want to calculate cap
> gains and transaction fees for tax purposes.  I'll take a look at the
> generic importer and see if I can figure it out; it may be easier to start
> from scratch.
>

I agree; if you do a one-off conversion from just a few sources of data the
whole importer/ingest framework doesn't buy you much.
I'd just write a script.




>
> thanks!
>
>
>
>>
>> On Sunday, July 16, 2023 at 8:34:59 PM UTC-7 erical...@gmail.com wrote:
>>
>>> I have a few CSV files with basic transactions (basically sent and
>>> received assets & amounts, plus commission cost).  These are all I need to
>>> process.  It would be pretty easy for me to just translate them line by
>>> line into Beancount format inputs, but I like to do things "the right
>>> way".  Problem is, I can't figure out what "the right way" is :)
>>>
>>> I spent a long time exploring the importer framework before realizing
>>> that it was the old one, tossed out for v3.  I have now read the design doc
>>> for the v3 importer system, the readme, skimmed the code and some examples,
>>> and then read some threads on this list which also led me to RedS's CSV
>>> framework, which I also looked into.
>>>
>>> Am I trying too hard?  Should I just ignore the frameworks and spit out
>>> text files of the right format?  If I should use a framework...which would
>>> folks recommend?
>>>
>>> thanks,
>>> eric
>>>
>> --
>> 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 beancount+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/c091350e-c0f5-45af-9a64-35bd17ae76f7n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0ttR0e%2BraUfjnYwaUui1_rQH4nfOfx9QdaLFXA4EkoT-g%40mail.gmail.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPF1xj9Xw15Vkj911e5MOg7PaUEgz8LghywLcpw69tuwQ%40mail.gmail.com.


Re: Is v2 > v3 still?

2023-07-16 Thread Martin Blais
bean-query, bean-price have  been moved to their own projects in v3.
See other repos in the same org.

Bean-web has been deleted; use Fava instead.

On Mon, Jul 17, 2023, 10:26 Eric Altendorf  wrote:

> Thanks.
>
> make & pip install worked fine.  can run bean-check.  Still doesn't seem
> to be building some of the tools, e.g., `bean-web` is still missing:
>
> beancount$ ls bin
> bean-check  bean-doctor  bean-example  bean-format  BUILD  treeify
>
> do i still need to do something with setup.py like in v2?
>
>
> On Sun, Jul 16, 2023 at 5:10 PM Martin Blais  wrote:
>
>>
>>
>> On Mon, Jul 17, 2023, 06:00 Eric Altendorf 
>> wrote:
>>
>>> On Sun, Jul 16, 2023 at 2:27 PM Martin Blais  wrote:
>>>
>>>> Precisely reliable and reproducible packaging and instructions that
>>>> work for everyone all the time are impossible tasks in my experience and I
>>>> tried for 25 years and eventually gave up. Too many environments, to many
>>>> different users and setups. I keep it simple for dev which I think is the
>>>> key, best is to use it like that to get the freshest. Other people do
>>>> packaging. Packages will inevitably be slightly older. Here's the gist:
>>>>
>>>
>>> Sure.  I don't think I'm complaining about the install not working in
>>> weird corner cases or anything like that.  Mostly remarking that the
>>> documentation is incorrect/broken/misleading in case you want to fix it for
>>> the next person who comes along.
>>>
>>> - "make build" will compile a .so in place (in the tree where you can
>>>> import it). Needs a C compiler with Python dev headers and library, bison
>>>> and flex.
>>>>
>>>
>>> The v3 install instructions that I found said to use Bazel, not make.
>>> Is Bazel just wrapping make here?  Is there some reason to use make
>>> directly?
>>>
>>
>> Ignore bazel, this is work in progress you don't need. V3 works fine with
>> the Python/c parser. There will also be a warning when you run about
>> missing that library, ignore that too.
>>
>>
>>
>>>
>>>> - set your PYTHONPATH to be able to import directly from the tree.
>>>>
>>>
>>> I'll do this with a venv to manage and isolate the dependencies and path
>>> management (which, FYI, if you wanted a hermetic and 100% reproducible
>>> build setup, would probably be the way to go, although I'm hardly an expert
>>> on that, and the last thing I want to do is debate your package's build
>>> setup :).
>>>
>>
>> Knock yourself out,
>> pip install . into your venv should work.
>>
>>
>>> Hope this helps,
>>>>
>>>
>>> Thanks! :)
>>>
>>> eric
>>>
>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Jul 17, 2023, 02:37 Eric Altendorf 
>>>> wrote:
>>>>
>>>>> Aha, looks like this is the page:
>>>>> https://beancount.github.io/docs/installing_beancount_v3.html
>>>>>
>>>>> I'll work from that.  Just sharing the FYI that some of the install
>>>>> instructions / links seem to be misleading.
>>>>>
>>>>> On Sun, Jul 16, 2023 at 10:19 AM Eric Altendorf <
>>>>> ericaltend...@gmail.com> wrote:
>>>>>
>>>>>> On Fri, Jul 14, 2023 at 8:35 PM Martin Blais  wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Sat, Jul 15, 2023, 11:06 Eric Altendorf 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On Fri, Jul 14, 2023 at 4:45 PM Martin Blais 
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> v3 > v2
>>>>>>>>> No less stable; less overall code, many parts moved to subprojects
>>>>>>>>> that have been more actively developed. Some c++ bit present but not 
>>>>>>>>> used
>>>>>>>>> in the main loop.
>>>>>>>>> Use v3.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Cool.  FWIW, https://beancount.github.io/ still says v3 "is
>>>>>>>> unstable and you want to use version 2 below".
>>>>>>>>
>>>>>>>
>>>>>>> All types of us

Re: Is v2 > v3 still?

2023-07-16 Thread Martin Blais
On Mon, Jul 17, 2023, 06:00 Eric Altendorf  wrote:

> On Sun, Jul 16, 2023 at 2:27 PM Martin Blais  wrote:
>
>> Precisely reliable and reproducible packaging and instructions that work
>> for everyone all the time are impossible tasks in my experience and I tried
>> for 25 years and eventually gave up. Too many environments, to many
>> different users and setups. I keep it simple for dev which I think is the
>> key, best is to use it like that to get the freshest. Other people do
>> packaging. Packages will inevitably be slightly older. Here's the gist:
>>
>
> Sure.  I don't think I'm complaining about the install not working in
> weird corner cases or anything like that.  Mostly remarking that the
> documentation is incorrect/broken/misleading in case you want to fix it for
> the next person who comes along.
>
> - "make build" will compile a .so in place (in the tree where you can
>> import it). Needs a C compiler with Python dev headers and library, bison
>> and flex.
>>
>
> The v3 install instructions that I found said to use Bazel, not make.  Is
> Bazel just wrapping make here?  Is there some reason to use make directly?
>

Ignore bazel, this is work in progress you don't need. V3 works fine with
the Python/c parser. There will also be a warning when you run about
missing that library, ignore that too.



>
>> - set your PYTHONPATH to be able to import directly from the tree.
>>
>
> I'll do this with a venv to manage and isolate the dependencies and path
> management (which, FYI, if you wanted a hermetic and 100% reproducible
> build setup, would probably be the way to go, although I'm hardly an expert
> on that, and the last thing I want to do is debate your package's build
> setup :).
>

Knock yourself out,
pip install . into your venv should work.


> Hope this helps,
>>
>
> Thanks! :)
>
> eric
>
>
>>
>>
>>
>>
>>
>> On Mon, Jul 17, 2023, 02:37 Eric Altendorf 
>> wrote:
>>
>>> Aha, looks like this is the page:
>>> https://beancount.github.io/docs/installing_beancount_v3.html
>>>
>>> I'll work from that.  Just sharing the FYI that some of the install
>>> instructions / links seem to be misleading.
>>>
>>> On Sun, Jul 16, 2023 at 10:19 AM Eric Altendorf 
>>> wrote:
>>>
>>>> On Fri, Jul 14, 2023 at 8:35 PM Martin Blais  wrote:
>>>>
>>>>>
>>>>>
>>>>> On Sat, Jul 15, 2023, 11:06 Eric Altendorf 
>>>>> wrote:
>>>>>
>>>>>> On Fri, Jul 14, 2023 at 4:45 PM Martin Blais  wrote:
>>>>>>
>>>>>>> v3 > v2
>>>>>>> No less stable; less overall code, many parts moved to subprojects
>>>>>>> that have been more actively developed. Some c++ bit present but not 
>>>>>>> used
>>>>>>> in the main loop.
>>>>>>> Use v3.
>>>>>>>
>>>>>>
>>>>>> Cool.  FWIW, https://beancount.github.io/ still says v3 "is unstable
>>>>>> and you want to use version 2 below".
>>>>>>
>>>>>
>>>>> All types of users, this is largely for non technical users. It's
>>>>> stable enough for you. I try not to commit build breaking changes (lots of
>>>>> tests).
>>>>>
>>>>
>>>> OK.  Looks like `apt install` just gives me v2, so I removed that and
>>>> I'm back to installing from source.  I'd like to install for dev, in case I
>>>> want to experiment with writing my own booking algorithm.
>>>>
>>>>
>>>>>
>>>>>
>>>>> And https://beancount.github.io/docs/installing_beancount.html says
>>>>>> it is instructions for installing v2.
>>>>>>
>>>>>> Also I tried following the "Installing for Development" instructions
>>>>>> there, running git clone, then `sudo python3 setup.py develop` and 
>>>>>> `python3
>>>>>> setup.py build_ext -i` and this produced a broken install.
>>>>>>
>>>>>
>>>>> This is for development, in just modify your PYTHONPATH to include the
>>>>> repo. See beancount/etc/env
>>>>>
>>>>
>>>> Sorry, I think I'm missing something more basic; things were very
>>>> broken just following the instructions.  I do notice there is a Makefile in
>>>> the directory, 

Re: Is v2 > v3 still?

2023-07-16 Thread Martin Blais
Precisely reliable and reproducible packaging and instructions that work
for everyone all the time are impossible tasks in my experience and I tried
for 25 years and eventually gave up. Too many environments, to many
different users and setups. I keep it simple for dev which I think is the
key, best is to use it like that to get the freshest. Other people do
packaging. Packages will inevitably be slightly older. Here's the gist:

- "make build" will compile a .so in place (in the tree where you can
import it). Needs a C compiler with Python dev headers and library, bison
and flex.
- set your PYTHONPATH to be able to import directly from the tree.

Hope this helps,





On Mon, Jul 17, 2023, 02:37 Eric Altendorf  wrote:

> Aha, looks like this is the page:
> https://beancount.github.io/docs/installing_beancount_v3.html
>
> I'll work from that.  Just sharing the FYI that some of the install
> instructions / links seem to be misleading.
>
> On Sun, Jul 16, 2023 at 10:19 AM Eric Altendorf 
> wrote:
>
>> On Fri, Jul 14, 2023 at 8:35 PM Martin Blais  wrote:
>>
>>>
>>>
>>> On Sat, Jul 15, 2023, 11:06 Eric Altendorf 
>>> wrote:
>>>
>>>> On Fri, Jul 14, 2023 at 4:45 PM Martin Blais  wrote:
>>>>
>>>>> v3 > v2
>>>>> No less stable; less overall code, many parts moved to subprojects
>>>>> that have been more actively developed. Some c++ bit present but not used
>>>>> in the main loop.
>>>>> Use v3.
>>>>>
>>>>
>>>> Cool.  FWIW, https://beancount.github.io/ still says v3 "is unstable
>>>> and you want to use version 2 below".
>>>>
>>>
>>> All types of users, this is largely for non technical users. It's stable
>>> enough for you. I try not to commit build breaking changes (lots of tests).
>>>
>>
>> OK.  Looks like `apt install` just gives me v2, so I removed that and I'm
>> back to installing from source.  I'd like to install for dev, in case I
>> want to experiment with writing my own booking algorithm.
>>
>>
>>>
>>>
>>> And https://beancount.github.io/docs/installing_beancount.html says it
>>>> is instructions for installing v2.
>>>>
>>>> Also I tried following the "Installing for Development" instructions
>>>> there, running git clone, then `sudo python3 setup.py develop` and `python3
>>>> setup.py build_ext -i` and this produced a broken install.
>>>>
>>>
>>> This is for development, in just modify your PYTHONPATH to include the
>>> repo. See beancount/etc/env
>>>
>>
>> Sorry, I think I'm missing something more basic; things were very broken
>> just following the instructions.  I do notice there is a Makefile in the
>> directory, is running `make` supposed to be part of the install-from-source
>> or install-for-dev process?
>>
>> The instructions just say to run setup.py but that doesn't seem to do
>> much.
>>
>> I'm also not sure if I'm even following the right instructions since, as
>> I mentioned, the document itself says it's for installing v2, and the link
>> to instructions for installing v3 is broken (links to
>> https://beancount.github.io/docs/installing_beancount_v3.md )
>>
>>
>>>
>>>
>>>> Backing out of that and just running `apt install beancount` worked
>>>> fine though :-D
>>>>
>>>>
>>>>
>>>>> (Apologies for the little warning in every invocation.)
>>>>>
>>>>> On Sat, Jul 15, 2023, 07:42 Eric Altendorf 
>>>>> wrote:
>>>>>
>>>>>> I'd like to get started with Beancount, and it wasn't clear to me if
>>>>>> the docs have been updated recently.  Is v3 still considered unstable, 
>>>>>> and
>>>>>> it's best to use v2?
>>>>>>
>>>>>> thanks,
>>>>>> eric
>>>>>>
>>>>>> --
>>>>>> 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 beancount+unsubscr...@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/beancount/1f684516-bd76-4ff5-adcb-b2b15b28b6a6n%40googlegroups.com
>>>>>> <https://groups.goog

Re: Is v2 > v3 still?

2023-07-14 Thread Martin Blais
On Sat, Jul 15, 2023, 11:06 Eric Altendorf  wrote:

> On Fri, Jul 14, 2023 at 4:45 PM Martin Blais  wrote:
>
>> v3 > v2
>> No less stable; less overall code, many parts moved to subprojects that
>> have been more actively developed. Some c++ bit present but not used in the
>> main loop.
>> Use v3.
>>
>
> Cool.  FWIW, https://beancount.github.io/ still says v3 "is unstable and
> you want to use version 2 below".
>

All types of users, this is largely for non technical users. It's stable
enough for you. I try not to commit build breaking changes (lots of tests).


And https://beancount.github.io/docs/installing_beancount.html says it is
> instructions for installing v2.
>
> Also I tried following the "Installing for Development" instructions
> there, running git clone, then `sudo python3 setup.py develop` and `python3
> setup.py build_ext -i` and this produced a broken install.
>

This is for development, in just modify your PYTHONPATH to include the
repo. See beancount/etc/env


> Backing out of that and just running `apt install beancount` worked fine
> though :-D
>
>
>
>> (Apologies for the little warning in every invocation.)
>>
>> On Sat, Jul 15, 2023, 07:42 Eric Altendorf 
>> wrote:
>>
>>> I'd like to get started with Beancount, and it wasn't clear to me if the
>>> docs have been updated recently.  Is v3 still considered unstable, and it's
>>> best to use v2?
>>>
>>> thanks,
>>> eric
>>>
>>> --
>>> 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 beancount+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/1f684516-bd76-4ff5-adcb-b2b15b28b6a6n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/beancount/1f684516-bd76-4ff5-adcb-b2b15b28b6a6n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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/LVBQ4cD0PYc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> beancount+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/CAK21%2BhOasM-ix1nUcL5LwykQpmQefjrtD9RNRVy53K_VPthCrQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/beancount/CAK21%2BhOasM-ix1nUcL5LwykQpmQefjrtD9RNRVy53K_VPthCrQ%40mail.gmail.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFXPr0vzhgK2oJihR8eZLfwboFpaQWvm8wR%3Dj0sBUd3TMmOkzQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/beancount/CAFXPr0vzhgK2oJihR8eZLfwboFpaQWvm8wR%3Dj0sBUd3TMmOkzQ%40mail.gmail.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhN5vkWmTc2D2RUBCT2hJ_b6WZqO7W986cLhCsLSkJE4sg%40mail.gmail.com.


Re: Is v2 > v3 still?

2023-07-14 Thread Martin Blais
v3 > v2
No less stable; less overall code, many parts moved to subprojects that
have been more actively developed. Some c++ bit present but not used in the
main loop.
Use v3.

(Apologies for the little warning in every invocation.)

On Sat, Jul 15, 2023, 07:42 Eric Altendorf  wrote:

> I'd like to get started with Beancount, and it wasn't clear to me if the
> docs have been updated recently.  Is v3 still considered unstable, and it's
> best to use v2?
>
> thanks,
> eric
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/1f684516-bd76-4ff5-adcb-b2b15b28b6a6n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOasM-ix1nUcL5LwykQpmQefjrtD9RNRVy53K_VPthCrQ%40mail.gmail.com.


Re: Best approach for folder structure | Generic transaction question

2023-06-16 Thread Martin Blais
About the ledgers: It doesn't make sense to segregate transaction by
account type.
Use a single large file, it what I'd recommend.

About matching: I'm not too sure what you mean by match, the way it works
is that as you accrue postings to an inventory it'll attempt to pair off
with existing postings with the same Cost values. If you want to be really
specific you can put labels on each posting and be explicit about which of
those lots you want to reduce in a later transaction.




On Fri, Jun 16, 2023 at 6:38 AM Logic-gate  wrote:

> Hey,
>
> I am on the verge of creating a front-end app for SailfishOS. I am trying
> to figure out the best approach for folders.
>
> My core folder structure is as follows(See Structure Class)
>
> [image: Diagram1.png]
>
> An imperative note here is that it relies on the separation of transaction
> folders as per the user's definition. This could be based accounts,
> sub-accounts, monthly, yearly...the lots.
>
> Example:
>
>- ledger.beancount
>- ledgers
>   - 2023
>  - income.beancount
>  - expenses.beancount
>  - etc...
>
> Or
>
>
>- ledger.beancount
>- ledgers
>   - Income
>  - 2023
> - ledger.beancount
>
>
> The structure of the documents folder will mirror 'ledgers'
>
> The idea is to regex the entry type and commit the entry to the
> appropriate file; for example if the entry type is `open` or `pad`, these
> will go to the main ledger(defined as `ledger.beancount` in the example
> above) and so on.
>
> Is this folder structure method considered acceptable?
> If not, is there a best-practices structure that I can use?
>
> As for my generic transaction question, following the documentation; I
> couldn't find how to exactly to register a `buy` trade and match it to a
> `sell` order. Previously I had to implement this ugly function(
> https://github.com/Logic-gate/cryptodash/blob/main/operations/beancount.py#L153)
> and I seem to have written a note to the effect of "there is currently no
> programmatic way to match the sell transaction with the initial buy trade".
>
> Is this still true? if not, mind sharing a snippet of how it's done as per
> the documentation here(
> https://beancount.github.io/docs/api_reference/beancount.core.html).
>
>
> And thank you very much for beancount, it has saved me a lot of money and
> headache.
>
>
> Cheers,
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/03745325-f0d5-45a0-a0bf-17e2836ef73fn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOELBJMNGQYR0y57VMfytgyj0iBTViYAS20khjsW3aW-w%40mail.gmail.com.


Re: [jcornaz/beancount-parser] beancount_parser_2 alpha (Discussion #38)

2023-06-03 Thread Martin Blais
During my visit at PyCon recently it was impossible to miss the fact that a
number of Python projects are rewriting their core in Rust for performance
reasons. Rust and Python seem to be best friends.

On Wed, May 31, 2023 at 4:02 AM Chary Chary  wrote:

> Martin,
>
> re "With the Python community aiming in that direction it was unavoidable
> I guess."
>
> Do I understand this correctly, that that there is a growing tendency to
> write high speed extensions for python in rust rather than C/C++?
>
> On Tuesday, May 23, 2023 at 5:34:55 AM UTC+2 bl...@furius.ca wrote:
>
>> +Beancount
>>
>> Looks fun. I started toying around with Rust myself.
>> With the Python community aiming in that direction it was unavoidable I
>> guess.
>>
>> Plus the C++ protobuf story just isn't getting much better.
>> I'm wondering if there's a nicer by-ref sharing story with protos and
>> Rust, where an instance created in Rust can be shared to Python without
>> making copies (and possibly mutated).
>> I'd be curious to see if your parser can be made to produce protobufs.
>>
>>
>>
>>
>> On Mon, May 22, 2023 at 9:51 AM Jonathan Cornaz 
>> wrote:
>>
>>> Hi,
>>>
>>> I started a "big rewrite" of the beancount parser: beancount_parser_2
>>> 
>>>
>>> It is now in alpha. Hopefully, I'll be able to stabilize it reasonably
>>> quickly (but there's no ETA)
>>>
>>> This old implementation (beancount-parser) is now in "maintenance
>>> mode". I'll still fix reported bugs, and I'll review/merge submitted pull
>>> requests. But I won't actively implement new features on that version.
>>>
>>> The new implementation already has some features that the old one hasn't:
>>>
>>>- line numbers of errors
>>>- line numbers of directives
>>>- more convenient to destructure the result because structs expose
>>>public fields
>>>- can treat the account as string slices
>>>- can use any decimal type when parsing (f64, rust_decimal::Decimal,
>>>and more)
>>>- can catch more syntax errors (instead of silently ignoring unknown
>>>syntax)
>>>- single result type (instead of an iterator over results)
>>>- and more...
>>>
>>> Though there are still many missing functionalities, you may want to
>>> have a look at it ;-)
>>>
>>> —
>>> Reply to this email directly, view it on GitHub
>>> , or
>>> unsubscribe
>>> 
>>> .
>>> You are receiving this because you are subscribed to this thread.Message
>>> ID: 
>>>
>> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/6e4eb19a-8de2-47c9-b57f-70b6c6f7b3adn%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhP2g-FOLuu-yHm7zRJjutG6sRZK%3D9EPytpGrxm6b-dCaA%40mail.gmail.com.


Re: [jcornaz/beancount-parser] beancount_parser_2 alpha (Discussion #38)

2023-05-22 Thread Martin Blais
+Beancount 

Looks fun. I started toying around with Rust myself.
With the Python community aiming in that direction it was unavoidable I
guess.

Plus the C++ protobuf story just isn't getting much better.
I'm wondering if there's a nicer by-ref sharing story with protos and
Rust, where an instance created in Rust can be shared to Python without
making copies (and possibly mutated).
I'd be curious to see if your parser can be made to produce protobufs.




On Mon, May 22, 2023 at 9:51 AM Jonathan Cornaz 
wrote:

> Hi,
>
> I started a "big rewrite" of the beancount parser: beancount_parser_2
> 
>
> It is now in alpha. Hopefully, I'll be able to stabilize it reasonably
> quickly (but there's no ETA)
>
> This old implementation (beancount-parser) is now in "maintenance mode".
> I'll still fix reported bugs, and I'll review/merge submitted pull
> requests. But I won't actively implement new features on that version.
>
> The new implementation already has some features that the old one hasn't:
>
>- line numbers of errors
>- line numbers of directives
>- more convenient to destructure the result because structs expose
>public fields
>- can treat the account as string slices
>- can use any decimal type when parsing (f64, rust_decimal::Decimal,
>and more)
>- can catch more syntax errors (instead of silently ignoring unknown
>syntax)
>- single result type (instead of an iterator over results)
>- and more...
>
> Though there are still many missing functionalities, you may want to have
> a look at it ;-)
>
> —
> Reply to this email directly, view it on GitHub
> , or
> unsubscribe
> 
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: 
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNfxeUQY2TcG%3DgZ%3DdQu37%3DK6MNwMBu9gcqEfLshfZntzw%40mail.gmail.com.


Re: BQL for non-transactions?

2023-05-20 Thread Martin Blais
Here, expand as desired:


#!/usr/bin/env python3
"""Example processing postings using petl.
"""

from beancount import loader
from beancount.core import data

import argparse
import itertools
import petl

petl.config.look_style = "minimal"
petl.config.failonerror = True


HEADER = ["txn", "posting", "date", "account", "units", "cost"]


def rows(entries):
for txn in data.filter_txns(entries):
for posting in txn.postings:
yield (txn, posting, txn.date, posting.account, posting.units,
posting.cost)


def main():
parser = argparse.ArgumentParser(description=__doc__.strip())
parser.add_argument("filename", help="Ledger filename")
args = parser.parse_args()

entries, errors, options_map = loader.load_file(args.filename)
table = petl.wrap(itertools.chain([HEADER], rows(entries)))
print(table.cut(["date", "account", "units"]).lookallstr())


if __name__ == "__main__":
main()




On Sat, May 20, 2023 at 5:50 PM Martin Blais  wrote:

> There isn't one but if needed I can probably make you one in short order.
>
> On Sat, May 20, 2023 at 5:31 PM Stefano Zacchiroli 
> wrote:
>
>> On Sat, May 20, 2023 at 04:57:44PM -0400, Martin Blais wrote:
>> > (Note that you could build a little Python script and use petl to
>> achieve
>> > this in ~20LOC or something.)
>>
>> Is there an existing mapping from Beancount data to Petl that I'm
>> missing?
>>
>> I'm aware of Petl usage for importing data into Beancount, which makes a
>> lot of sense, because you usually have tabular data before ingesting
>> into Beancount. But I'm not aware of any bridge between Beancount
>> (presumably and more specifically: the tabular data model on which BQL
>> evaluate queries) and Petl. Would love to hear about it.
>>
>> Cheers
>> --
>> Stefano Zacchiroli . z...@upsilon.cc . https://upsilon.cc/zack  _. ^ ._
>> Full professor of Computer Science  o o   o \/|V|\/
>> Télécom Paris, Polytechnic Institute of Paris o o o   <\>
>> Co-founder & CTO Software Heritageo o o o   /\|^|/\
>> https://twitter.com/zacchiro . https://mastodon.xyz/@zacchiro   '" V "'
>>
>> --
>> 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 beancount+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/20230520213125.q3j7mvfhks3q7pwd%40upsilon.cc
>> .
>>
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMNSw2LODCLASqo-ZZfwFfZh99wTzorw%3D9m6aRuU-iFkg%40mail.gmail.com.


Re: BQL for non-transactions?

2023-05-20 Thread Martin Blais
There isn't one but if needed I can probably make you one in short order.

On Sat, May 20, 2023 at 5:31 PM Stefano Zacchiroli  wrote:

> On Sat, May 20, 2023 at 04:57:44PM -0400, Martin Blais wrote:
> > (Note that you could build a little Python script and use petl to achieve
> > this in ~20LOC or something.)
>
> Is there an existing mapping from Beancount data to Petl that I'm
> missing?
>
> I'm aware of Petl usage for importing data into Beancount, which makes a
> lot of sense, because you usually have tabular data before ingesting
> into Beancount. But I'm not aware of any bridge between Beancount
> (presumably and more specifically: the tabular data model on which BQL
> evaluate queries) and Petl. Would love to hear about it.
>
> Cheers
> --
> Stefano Zacchiroli . z...@upsilon.cc . https://upsilon.cc/zack  _. ^ ._
> Full professor of Computer Science  o o   o \/|V|\/
> Télécom Paris, Polytechnic Institute of Paris o o o   <\>
> Co-founder & CTO Software Heritageo o o o   /\|^|/\
> https://twitter.com/zacchiro . https://mastodon.xyz/@zacchiro   '" V "'
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/20230520213125.q3j7mvfhks3q7pwd%40upsilon.cc
> .
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNC2rjHcYLi3FhPjbfsDr%3D3u6wdwHCOcX1puMNO1Svqsg%40mail.gmail.com.


Re: BQL for non-transactions?

2023-05-20 Thread Martin Blais
I think not.
A long long while ago I had an idea for the revamp of the SQL client I
thought a good mapping would be for each of the postings and directive
types: transactions, balance, note, etc. to be individual tables with their
own dedicated set of columns but I don't think this was implemented.

(Note that you could build a little Python script and use petl to achieve
this in ~20LOC or something.)


On Sat, May 20, 2023 at 1:10 PM Scott  wrote:

> Hi,
>
> with the recent fava dashboards plugin, I now have a use case where I'm
> interested in using BQL to find note directives.  Is this possible?
> Looking through the documentation, I suspect it is not, but I may be
> missing something.  If it's not possible, I might try to take a stab at
> implementing it, so any useful thoughts/pointers on the best approach would
> be appreciated.
>
>  -S
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/23af24bb-ce74-40b2-863b-6093844da0a8n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOvxC%3DXNuXr4jR5wCg4ye-s2Q32uCL4PmhXugQYLnioZA%40mail.gmail.com.


Re: GPT-4 and trimming expenses

2023-05-06 Thread Martin Blais
On Fri, May 5, 2023 at 8:15 AM fin  wrote:

> Red S wrote:
> ...
> > But hooking GPT up to this suddenly means it can send letters of all
> sorts
> > to anyone in the world. Meaning, it can cause physical actions to be
> taken
> > in the real world with minimal effort and expertise. One doesn't have to
> be
> > very imaginative to figure out what this means with the tons of APIs for
> > all kinds of things on the planet.
>
>   oh great even more junk mail!  yick...


I'm more worried about having to read and review code output from GPT that
users with too little understanding of it will produce.

Maybe this is the future...
- In the past, people used to understand assembly code, though they did C
- then they only knew Java
- and then it was Ruby and Python
- and next... well, maybe the whole of programming is going to become a
paint-by-color exercise.

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhN1BOMkQARmxCmN50V1Fvw19vQwyT7Yb573Ue5Pw9OOxA%40mail.gmail.com.


Re: GPT-4 and trimming expenses

2023-05-04 Thread Martin Blais
On Thu, May 4, 2023 at 11:18 PM Red S  wrote:

> Sending these to this list since I assume a lot of us have made somewhat a
> hobby out of personal finance, and you might be interested in knowing the
> state of the art in how generative AI is starting to be applied to this
> area.
>

At this stage I think it's pretty safe to assume everything will get
initiated with a starting point of some GPT4 output.
- Non-technical people are using it profusely already, since it doesn't
require programming
- Even technical people are using it, since it's amazingly easy to go from
nothing to "something okay" in zero time
It's all over the place already. It's a bit scary even. I've been floored
at GPT's performance. I've never seen anything this amazing.

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNpkNq5A5OjzkJzQ2DVui0GAavYpv-y06HEsG4487vbWA%40mail.gmail.com.


Re: Closing multiple accounts in one shot.

2023-04-30 Thread Martin Blais
Merged. Thank you!

On Thu, Mar 16, 2023 at 4:37 AM Red S  wrote:

> Of course, and pull request sent
> <https://github.com/beancount/beancount/pull/751>.
>
> Caveats:
> - I couldn't get pytest to run in that repo.
> - the tests have been failing
> <https://github.com/beancount/beancount/actions/runs/4435020145/jobs/7781647942>
>  before
> my commit. I can look into that whenever I have the time next (could be
> days) if you don't already know what the issue is
>
> Docs:
> - It looks like this doc page
> <https://beancount.github.io/docs/api_reference/beancount.plugins.html> is
> auto generated from the plugin's docstring, which I've added.
> - This plugin needs to be added to either the core list here
> <https://beancount.github.io/docs/beancount_v3.html#restructuring-the-code> or
> the experimental list for v3
>
> -Red
>
> On Wednesday, March 15, 2023 at 1:11:42 PM UTC-7 bl...@furius.ca wrote:
>
> Sgtm!
> You can make it part of v2
> Will bubble it down to v3
> Then you Red!
>
> On Wed, Mar 15, 2023, 13:23 Red S  wrote:
>
> Happy to make it a part of the core. Would you like me to submit a pull
> request?
>
> On Sunday, March 12, 2023 at 6:34:47 PM UTC-7 bl...@furius.ca wrote:
>
> Nice plugin!  Should be part of the core.
>
>
> On Sun, Mar 12, 2023 at 4:18 PM Stefano Mihai Canta 
> wrote:
>
> Actually, yes.
>
>
> https://github.com/redstreet/beancount_reds_plugins/tree/main/beancount_reds_plugins/autoclose_tree#readme
>
> On Sun, Mar 12, 2023, 11:48 Martin Blais  wrote:
>
> No.
>
> On Sun, Mar 12, 2023 at 10:02 AM Bman Q  wrote:
>
> Title, i have 20+ accounts i want to close
>
> 2018-04-01 open Expenses:Business:DivA:Hosting
> 2018-04-01 open Expenses:Business:DivA:Contractors
> ...
> 2018-04-01 open Expenses:Business:DivA:OfficeSupplies
>
> Is there a way to close them all in one shot? like
> 2023-03-01 close Expenses:Business:DivA:*
>
> --
> 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 beancount+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/f281c004-64ba-4201-8abb-05468e96a3fen%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/f281c004-64ba-4201-8abb-05468e96a3fen%40googlegroups.com?utm_medium=email_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 beancount+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAK21%2BhOC9rVBrNUo_NK097cWVApBgHREjv45tcCYxMbg2-MeSQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/beancount/CAK21%2BhOC9rVBrNUo_NK097cWVApBgHREjv45tcCYxMbg2-MeSQ%40mail.gmail.com?utm_medium=email_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 beancount+...@googlegroups.com.
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAMzm8_qdTrs%3D1pRcSpi0FER8fMYRy1QDzsdRHsP86P0uyv-8sQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/beancount/CAMzm8_qdTrs%3D1pRcSpi0FER8fMYRy1QDzsdRHsP86P0uyv-8sQ%40mail.gmail.com?utm_medium=email_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 beancount+...@googlegroups.com.
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/8b57a1a3-4fb8-4cce-9423-69c54692797fn%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/8b57a1a3-4fb8-4cce-9423-69c54692797fn%40googlegroups.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/f56e33a2-909f-41f5-9072-5d7836522f87n%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/f56e33a2-909f-41f5-9072-5d7836522f87n%40googlegroups.com?utm_medium=email_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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhNzZ1QUCCO-TRhwzjrBbfRmL6nQcm63F483_Uu%2Bmh19HQ%40mail.gmail.com.


Re: Declaring dividends

2023-04-23 Thread Martin Blais
The previous earnings account is just where  net income from the time
before the start of the reporting period goes, but I think you should be
able to add postings to it, there little really that special about it, it's
just another account.

On Sat, Apr 22, 2023, 18:44 Aragon  wrote:

> Hello,
>
> For someone who uses Beancount to keep the books of a small company, I was
> wondering what is the correct convention for declaring dividends?
>
> After reading about this in general accounting documents, it seems like in
> Beancount one should add to the Equity:Earnings:Previous account, and
> subtract from a Liabilities:Dividends-Payable account.
>
> However, in Beancount the Equity:Earnings:Previous account is a sort of
> "virtual" account which is usually not opened in the journal, whose balance
> is auto-generated. If I do open that account so that I'm able to write
> transactions to it, its balance is always visible in Fava's balance sheet,
> which I'm not sure, but it looks a bit odd.
>
> And if I use a different equity account, eg. Equity:Dividends, then the
> Equity:Earnings:Previous balance doesn't get calculated correctly, ie. it
> looks as though the company has a delicious balance of previous earnings
> when it has actually declared them as dividends.
>
>
> Thanks,
> Aragon
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/6759a4bf-ad0a-4eca-b9e0-fa80c23b1899n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPtaXrS0D1wG6u84FoBwOLU4EyKhedq8vdHtkM9w6hunw%40mail.gmail.com.


Re: Mac Shortcut to scrape Fidelity trade history and convert to Beancount

2023-04-06 Thread Martin Blais
Thanks for sharing David.
Added to contribs doc.


On Thu, Apr 6, 2023 at 6:09 PM David Avraamides 
wrote:

> For the subset of this group that uses both a Mac and uses Fidelity, I
> wrote up a description of how I use a Shortcut to scrape trade history from
> Fidelity’s website, run it through a Python script to convert to
> Beancount’s ledger format, and then save it in the clipboard so I can paste
> it into a ledger file.
>
> It is a little complicated to explain so I wrote it up on my website here:
> https://noisysignal.com/trade_hist_shortcut/
>
> In any case, I found it a useful way of doing a one-time import of the
> history of all my open and closed trades and will probably use this
> technique for other financial accounts who do not provide an easy-to-parse
> format for all of my data (while Fidelity supports CSV export of trade
> activity, they only go back 5 years and I wanted to go back further in
> time).
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/96c9be7d-b897-4881-9779-0e688c87b3ben%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOcCNmDWz5S68Mnty0r1OEEzgNHw%2BmpER_dTruC3tfuwg%40mail.gmail.com.


Re: starting to hit my stride with beancount

2023-04-04 Thread Martin Blais
You could write a script to regenerate it if you ever miss it ;-)

On Tue, Apr 4, 2023 at 8:21 PM fin  wrote:

> Martin Blais wrote:
>
>   i was getting very tired of my old spreadsheet method
> (based upon Multiplan from the mid 80s that was converted
> to libreoffice calc years ago, but i didn't like it any
> more than the MP version...).
>
>
>   fin
>
>
> > --b3b3ea05f88ba801
> > Content-Type: text/plain; charset="UTF-8"
> > Content-Transfer-Encoding: quoted-printable
> >
> > Glad you could get to a comfortable place!
> >
> >
> > On Tue, Apr 4, 2023 at 8:05=E2=80=AFPM fin  wrote:
> >
> >>
> >>   today was my first regular use of some importers and my
> >> custom importer for TdA and bean-price.  :)
> >>
> >>   it has been going better and my small bug fixing today
> >> was efficient enough that i was happy.
> >>
> >>   thank you to Red and Martin and everyone else here who's
> >> got me this far.
> >>
> >>   this was a superb link to a useful summary that helped me a
> >> great deal:
> >>
> >>
> >>   Accounting for Computer Scientists =E2=80=94 Martin
> Kleppmann=E2=80=99s=
> >  blog
> >>
> >>   <
> >>
> https://martin.kleppmann.com/2011/03/07/accounting-for-computer-scientist=
> > s.html
> >> >
> >>
> >>
> >>   fin
> >>
> >> --
> >> 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 beancount+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/beancount/siqufj-2ui.ln1%40anthive.com.
> >>
> >
> > --=20
> > 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 e=
> > mail to beancount+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/=
> > beancount/CAK21%2BhOpbmAX5J8LazZKj9X5tNPsVeEnXKptTeKVFfHhrH5%3DwA%
> 40mail.gm=
> > ail.com.
> >
> > --b3b3ea05f88ba801
> > Content-Type: text/html; charset="UTF-8"
> > Content-Transfer-Encoding: quoted-printable
> >
> > style=3D"font-family:arial,sa=
> > ns-serif;font-size:small">Glad you could get to a comfortable
> place!<=
> > div class=3D"gmail_default"
> style=3D"font-family:arial,sans-serif;font-size=
> >:small"> cla=
> > ss=3D"gmail_attr">On Tue, Apr 4, 2023 at 8:05=E2=80=AFPM fin  href=3D=
> > "mailto:f...@anthive.com;>f...@anthive.com
> wrote: > e class=3D"gmail_quote" style=3D"margin:0px 0px 0px
> 0.8ex;border-left:1px s=
> > olid rgb(204,204,204);padding-left:1ex">
> >=C2=A0 today was my first regular use of some importers and my 
> > custom importer for TdA and bean-price.=C2=A0 :)
> >
> >=C2=A0 it has been going better and my small bug fixing today 
> > was efficient enough that i was happy.
> >
> >=C2=A0 thank you to Red and Martin and everyone else here whos
> > got me this far.
> >
> >=C2=A0 this was a superb link to a useful summary that helped me a 
> > great deal:
> >
> >
> >=C2=A0 Accounting for Computer Scientists =E2=80=94 Martin
> Kleppmann=E2=80=
> >=99s blog
> >
> >=C2=A0  https://martin.kleppmann.com/2011/03/07/accounting-fo=
> > r-computer-scientists.html" rel=3D"noreferrer" target=3D"_blank">
> https://ma=
> > rtin.kleppmann.com/2011/03/07/accounting-for-computer-scientists.html
> =
> > t;
> >
> >
> >=C2=A0 fin
> >
> > -- 
> > You received this message because you are subscribed to the Google
> Groups &=
> > quot;Beancount group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an e=
> > mail to mailto:beancount%2bunsubscr...@googlegroups.com;
> target=
> >=3D"_blank">beancount+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit  https://groups.google.c=
> > om/d/msgid/beancount/siqufj-2ui.ln1%40anthive.com" rel=3D"noreferrer"
> targe=
> > t=3D"_blank">
> https://groups.google.com/d/msgid/beancount/siqufj-2ui.ln1%40a=
>

Re: starting to hit my stride with beancount

2023-04-04 Thread Martin Blais
Glad you could get to a comfortable place!


On Tue, Apr 4, 2023 at 8:05 PM fin  wrote:

>
>   today was my first regular use of some importers and my
> custom importer for TdA and bean-price.  :)
>
>   it has been going better and my small bug fixing today
> was efficient enough that i was happy.
>
>   thank you to Red and Martin and everyone else here who's
> got me this far.
>
>   this was a superb link to a useful summary that helped me a
> great deal:
>
>
>   Accounting for Computer Scientists — Martin Kleppmann’s blog
>
>   <
> https://martin.kleppmann.com/2011/03/07/accounting-for-computer-scientists.html
> >
>
>
>   fin
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/siqufj-2ui.ln1%40anthive.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhOpbmAX5J8LazZKj9X5tNPsVeEnXKptTeKVFfHhrH5%3DwA%40mail.gmail.com.


Re: autobean-format: deep cleanup, recursive formatting, entry sorting, and more

2023-04-04 Thread Martin Blais
On Tue, Apr 4, 2023 at 6:45 PM Archimedes Smith  wrote:

> (reposting as the previous reply somehow got deleted)
>
Somehow you got caught by the spam filter. I whitelisted you.



>
> Thanks Martin for flagging this.
>
> I thought I replicated the full v2 syntax except out-of-line tags / links
> in transaction but apparently I missed that note also supports tags /
> links, which is now added. Can you try upgrading autobean-refactor to 0.2.3
> and see if it works?
>
> Also, behind `--sort` is a non-standard O(N^2) algorithm which probably
> won't work with this huge file with 68996+ lines. It could be made O(N
> logN) but I just didn't think about files of that size...
>
> On Saturday, April 1, 2023 at 4:10:50 PM UTC+1 bl...@furius.ca wrote:
>
>> Added to the contrib doc, thank you for this,
>>
>> FYI I gave it a spin and hit this error, probably just needs an
>> adjustment on your parser:
>>
>> lumia [git|main]:~/src/.../SEIAROTg/autobean-format$ autobean-format $L
>> Traceback (most recent call last):
>>   File "/usr/local/lib/python3.11/site-packages/lark/lexer.py", line 590,
>> in lex
>> yield lexer.next_token(lexer_state, parser_state)
>>   ^^^
>>   File "/usr/local/lib/python3.11/site-packages/lark/lexer.py", line 528,
>> in next_token
>> raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos,
>> line_ctr.line, line_ctr.column,
>> lark.exceptions.UnexpectedCharacters: No terminal matches '^' in the
>> current parser context, at line 68996 col 73
>>
>> rade:Main:Cash "Intra-Account Transfer" ^td-25441737451
>> ^
>> Expected one of:
>> * WHITESPACE
>> * _NEWLINE_INDENT_COMMENT
>> * INLINE_COMMENT
>> * _NEWLINE
>> * BLOCK_COMMENT
>> * INDENT
>>
>> Previous tokens: Token('WHITESPACE', ' ')
>>
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "/usr/local/bin/autobean-format", line 8, in 
>> sys.exit(main())
>>  ^^
>>   File "/usr/local/lib/python3.11/site-packages/autobean_format/main.py",
>> line 79, in main
>> for file in formatter.load_files(filename):
>>   File "/usr/local/lib/python3.11/site-packages/autobean_format/main.py",
>> line 45, in load_files
>> model = self._parser.parse(text, models.File)
>> ^
>>   File
>> "/usr/local/lib/python3.11/site-packages/autobean_refactor/parser.py", line
>> 135, in parse
>> return self._parse(text, target, self._lark)
>>^
>>   File
>> "/usr/local/lib/python3.11/site-packages/autobean_refactor/parser.py", line
>> 156, in _parse
>> for token in parser.lexer_thread.lex(parser.parser_state):
>>   File
>> "/usr/local/lib/python3.11/site-packages/autobean_refactor/parser.py", line
>> 54, in process
>> for token in stream:
>>   File "/usr/local/lib/python3.11/site-packages/lark/lexer.py", line 599,
>> in lex
>> raise UnexpectedToken(token, e.allowed, state=parser_state,
>> token_history=[last_token],
>> terminals_by_name=self.root_lexer.terminals_by_name)
>> lark.exceptions.UnexpectedToken: Unexpected token Token('LINK',
>> '^td-25441737451') at line 68996, column 73.
>> Expected one of:
>> * WHITESPACE
>> * _NEWLINE_INDENT_COMMENT
>> * INLINE_COMMENT
>> * _NEWLINE
>> * BLOCK_COMMENT
>> * INDENT
>> Previous tokens: [Token('WHITESPACE', ' ')]
>>
>>
>>
>>
>> On Fri, Mar 31, 2023 at 6:25 PM Archimedes Smith 
>> wrote:
>>
>>> Hi beancounters,
>>>
>>> I've written yet another formatter for beancount, autobean-format
>>> , powered by my earlier
>>> project autobean-refactor
>>> , a library for parsing
>>> and programmatically manipulating beancount files.
>>>
>>> Highlights:
>>>
>>>- Deep cleanup
>>>   - Unlike bean-format which is regex-based, autobean-format is
>>>   based on a proper parser, allowing it to format every corner of your
>>>   ledger, including *arithmetic expressions*.
>>>- Recursive formatting
>>>   - Optionally formats all included files.
>>>   - Honors glob include.
>>>- Sort entries
>>>   - Optionally sorts dated entries.
>>>   - Honors "time" meta (HH:MM, HH:MM:SS, epoch seconds, epoch ms,
>>>   epoch us).
>>>   - Honors pushtag / pushmeta.
>>>   - Preserves existing comments, structure, and ordering whenever
>>>   possible.
>>>- Preview-able
>>>   - Optionally prints diff.
>>>- Thousands separators.
>>>   - Optionally add, remove, or keep (default) thousands separators.
>>>- Typed and extensible
>>>   - For example, the code for supporting thousands separator is as
>>>   simple as this
>>>   
>>> 

Re: ChatGPT & Beancount

2023-04-01 Thread Martin Blais
FYI for those who might be tempted to feed their entire ledger into the
thing, keep in mind the privacy implications of doing this.
The queries are very likely logged and even if used indirectly as training
data for further updates, might leak your personal info to someone else
generating transaction data.
Just saying... it might not be obvious to some.



On Sat, Apr 1, 2023 at 10:51 PM Red S  wrote:

> Very neat! I've got to admit, I'm bowled over by the natural language
> interface working so well.
>
> Amazon purchase classification is almost the only area of classification
> where smart_importer doesn't do greatly well for me, since there are few
> repeat purchases or keywords.
>
> Good to know about aichat too.
>
> That said, here are the results I tried to replicate with the same data.
> Note the claim at the bottom: "You can use any account name you like as
> long as it doesn’t contain spaces," and its incongruency with literally
> every classification containing a space. One of the limitations of the
> current generation is a lack of a confidence-in-results indicator, which
> shows up here.
>
> 2022-08-19 * "Amazon.com" "Beginning Drawing Atelier: An Instructional
> Sketchbook" Assets:Zero-Sum-Accounts:Amazon-Purchases -24.71 USD
> Expenses:Art Supplies 2022-09-14 * "Amazon.com" "Amazon Basics Clear Sheet
> Protectors for 3 Ring Binder, 8.5 x 11 Inch, 200-Pack"
> Assets:Zero-Sum-Accounts:Amazon-Purchases -18.16 USD Expenses:Office
> Supplies 2022-10-05 * "Amazon.com" "Bosch Rear Wiper Blade H307 /3397011429
> Original Equipment Replacement- 12\" (Pack of 1)"
> Assets:Zero-Sum-Accounts:Amazon-Purchases -11.6 USD Expenses:Auto Parts
> 2023-01-26 * "Amazon.com" "Duxtop 1600W Single Burner Electric Cooktop,
> Electric Hot Plate for Cooking, Electric Stove with Sensor Touch Control,
> Portable Infrared Burner with T" Assets:Zero-Sum-Accounts:Amazon-Purchases
> -69.43 USD Expenses:Kitchen Appliances 2023-01-26 * "Amazon.com" "PILOT
> Parallel Caligraphy Pens, Assorted Point Sizes and Colors, 6 Count (12722)"
> Assets:Zero-Sum-Accounts:Amazon-Purchases -32.44 USD Expenses:Art Supplies
> 2023-02-28 * "Amazon.com" "Laptop Stand, Laptop Holder Riser Computer
> Stand, Adjustable Aluminum Foldable Portable Notebook Stand, Compatible
> with MacBook Air Pro, HP, Lenovo, D"
> Assets:Zero-Sum-Accounts:Amazon-Purchases -14.29 USD Expenses:Laptop
> Accessories
>
> In this example, I’ve added a category to each transaction by adding a new
> line after the transaction line and indenting it by two spaces. The
> category is specified as an account name and is preceded by a colon. You
> can use any account name you like as long as it doesn’t contain spaces.
>
> On Saturday, April 1, 2023 at 7:51:20 AM UTC-7 ree...@gmail.com wrote:
>
>> I used a command-line tool, aichat ,
>> to pipe transactions to GPT-4 and categorize expenses. I gave it the
>> following input (generated according to Booking Amazon Purchases
>> 
>> ):
>>
>> 2022-08-19 * "Amazon.com" "Beginning Drawing Atelier: An Instructional
>> Sketchbook"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -24.71 USD
>>
>> 2022-09-14 * "Amazon.com" "Amazon Basics Clear Sheet Protectors for 3
>> Ring Binder, 8.5 x 11 Inch, 200-Pack"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -18.16 USD
>>
>> 2022-10-05 * "Amazon.com" "Bosch Rear Wiper Blade H307 /3397011429
>> <(339)%20701-1429> Original Equipment Replacement- 12\" (Pack of 1)"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -11.6 USD
>>
>> 2023-01-26 * "Amazon.com" "Duxtop 1600W Single Burner Electric Cooktop,
>> Electric Hot Plate for Cooking, Electric Stove with Sensor Touch Control,
>> Portable Infrared Burner with T"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -69.43 USD
>>
>> 2023-01-26 * "Amazon.com" "PILOT Parallel Caligraphy Pens, Assorted Point
>> Sizes and Colors, 6 Count (12722)"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -32.44 USD
>>
>> 2023-02-28 * "Amazon.com" "Laptop Stand, Laptop Holder Riser Computer
>> Stand, Adjustable Aluminum Foldable Portable Notebook Stand, Compatible
>> with MacBook Air Pro, HP, Lenovo, D"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -14.29 USD
>>
>> Using the following prompt and command:
>>
>> cat amz.beancount | aichat add categorized expense postings to balance
>> each of the following transactions, preserving the included zero sum
>> posting. do not use spaces in account names > out.beancount
>>
>> I got these results:
>>
>> 2022-08-19 * "Amazon.com" "Beginning Drawing Atelier: An Instructional
>> Sketchbook"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -24.71 USD
>>   Expenses:Art:Instructional-Sketchbook
>>
>> 2022-09-14 * "Amazon.com" "Amazon Basics Clear Sheet Protectors for 3
>> Ring Binder, 8.5 x 11 Inch, 200-Pack"
>>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -18.16 USD
>>   Expenses:Office-Supplies:Sheet-Protectors
>>
>> 2022-10-05 * 

Re: autobean-format: deep cleanup, recursive formatting, entry sorting, and more

2023-04-01 Thread Martin Blais
Added to the contrib doc, thank you for this,

FYI I gave it a spin and hit this error, probably just needs an adjustment
on your parser:

lumia [git|main]:~/src/.../SEIAROTg/autobean-format$ autobean-format $L
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/lark/lexer.py", line 590,
in lex
yield lexer.next_token(lexer_state, parser_state)
  ^^^
  File "/usr/local/lib/python3.11/site-packages/lark/lexer.py", line 528,
in next_token
raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos,
line_ctr.line, line_ctr.column,
lark.exceptions.UnexpectedCharacters: No terminal matches '^' in the
current parser context, at line 68996 col 73

rade:Main:Cash "Intra-Account Transfer" ^td-25441737451
^
Expected one of:
* WHITESPACE
* _NEWLINE_INDENT_COMMENT
* INLINE_COMMENT
* _NEWLINE
* BLOCK_COMMENT
* INDENT

Previous tokens: Token('WHITESPACE', ' ')


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/autobean-format", line 8, in 
sys.exit(main())
 ^^
  File "/usr/local/lib/python3.11/site-packages/autobean_format/main.py",
line 79, in main
for file in formatter.load_files(filename):
  File "/usr/local/lib/python3.11/site-packages/autobean_format/main.py",
line 45, in load_files
model = self._parser.parse(text, models.File)
^
  File
"/usr/local/lib/python3.11/site-packages/autobean_refactor/parser.py", line
135, in parse
return self._parse(text, target, self._lark)
   ^
  File
"/usr/local/lib/python3.11/site-packages/autobean_refactor/parser.py", line
156, in _parse
for token in parser.lexer_thread.lex(parser.parser_state):
  File
"/usr/local/lib/python3.11/site-packages/autobean_refactor/parser.py", line
54, in process
for token in stream:
  File "/usr/local/lib/python3.11/site-packages/lark/lexer.py", line 599,
in lex
raise UnexpectedToken(token, e.allowed, state=parser_state,
token_history=[last_token],
terminals_by_name=self.root_lexer.terminals_by_name)
lark.exceptions.UnexpectedToken: Unexpected token Token('LINK',
'^td-25441737451') at line 68996, column 73.
Expected one of:
* WHITESPACE
* _NEWLINE_INDENT_COMMENT
* INLINE_COMMENT
* _NEWLINE
* BLOCK_COMMENT
* INDENT
Previous tokens: [Token('WHITESPACE', ' ')]




On Fri, Mar 31, 2023 at 6:25 PM Archimedes Smith  wrote:

> Hi beancounters,
>
> I've written yet another formatter for beancount, autobean-format
> , powered by my earlier
> project autobean-refactor ,
> a library for parsing and programmatically manipulating beancount files.
>
> Highlights:
>
>- Deep cleanup
>   - Unlike bean-format which is regex-based, autobean-format is based
>   on a proper parser, allowing it to format every corner of your ledger,
>   including *arithmetic expressions*.
>- Recursive formatting
>   - Optionally formats all included files.
>   - Honors glob include.
>- Sort entries
>   - Optionally sorts dated entries.
>   - Honors "time" meta (HH:MM, HH:MM:SS, epoch seconds, epoch ms,
>   epoch us).
>   - Honors pushtag / pushmeta.
>   - Preserves existing comments, structure, and ordering whenever
>   possible.
>- Preview-able
>   - Optionally prints diff.
>- Thousands separators.
>   - Optionally add, remove, or keep (default) thousands separators.
>- Typed and extensible
>   - For example, the code for supporting thousands separator is as
>   simple as this
>   
> 
>   .
>
> Please check out autobean-format
>  if you are interested. Bug
> reports / suggestions / contributions are appreciated.
>
> Regards,
> SEIAROTg
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/962be409-86aa-4fed-859e-2ff983fe0d95n%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: ChatGPT & Beancount

2023-04-01 Thread Martin Blais
Mind blown *poofff*

On Sat, Apr 1, 2023 at 10:51 AM Reed Law  wrote:

> I used a command-line tool, aichat ,
> to pipe transactions to GPT-4 and categorize expenses. I gave it the
> following input (generated according to Booking Amazon Purchases
> 
> ):
>
> 2022-08-19 * "Amazon.com" "Beginning Drawing Atelier: An Instructional
> Sketchbook"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -24.71 USD
>
> 2022-09-14 * "Amazon.com" "Amazon Basics Clear Sheet Protectors for 3 Ring
> Binder, 8.5 x 11 Inch, 200-Pack"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -18.16 USD
>
> 2022-10-05 * "Amazon.com" "Bosch Rear Wiper Blade H307 /3397011429
> Original Equipment Replacement- 12\" (Pack of 1)"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -11.6 USD
>
> 2023-01-26 * "Amazon.com" "Duxtop 1600W Single Burner Electric Cooktop,
> Electric Hot Plate for Cooking, Electric Stove with Sensor Touch Control,
> Portable Infrared Burner with T"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -69.43 USD
>
> 2023-01-26 * "Amazon.com" "PILOT Parallel Caligraphy Pens, Assorted Point
> Sizes and Colors, 6 Count (12722)"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -32.44 USD
>
> 2023-02-28 * "Amazon.com" "Laptop Stand, Laptop Holder Riser Computer
> Stand, Adjustable Aluminum Foldable Portable Notebook Stand, Compatible
> with MacBook Air Pro, HP, Lenovo, D"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -14.29 USD
>
> Using the following prompt and command:
>
> cat amz.beancount | aichat add categorized expense postings to balance
> each of the following transactions, preserving the included zero sum
> posting. do not use spaces in account names > out.beancount
>
> I got these results:
>
> 2022-08-19 * "Amazon.com" "Beginning Drawing Atelier: An Instructional
> Sketchbook"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -24.71 USD
>   Expenses:Art:Instructional-Sketchbook
>
> 2022-09-14 * "Amazon.com" "Amazon Basics Clear Sheet Protectors for 3 Ring
> Binder, 8.5 x 11 Inch, 200-Pack"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -18.16 USD
>   Expenses:Office-Supplies:Sheet-Protectors
>
> 2022-10-05 * "Amazon.com" "Bosch Rear Wiper Blade H307 /3397011429
> Original Equipment Replacement- 12\" (Pack of 1)"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -11.6 USD
>   Expenses:Car:Maintenance
>
> 2023-01-26 * "Amazon.com" "Duxtop 1600W Single Burner Electric Cooktop,
> Electric Hot Plate for Cooking, Electric Stove with Sensor Touch Control,
> Portable Infrared Burner with T"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -69.43 USD
>   Expenses:Kitchen:Appliances
>
> 2023-01-26 * "Amazon.com" "PILOT Parallel Caligraphy Pens, Assorted Point
> Sizes and Colors, 6 Count (12722)"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -32.44 USD
>   Expenses:Art:Calligraphy-Pens
>
> 2023-02-28 * "Amazon.com" "Laptop Stand, Laptop Holder Riser Computer
> Stand, Adjustable Aluminum Foldable Portable Notebook Stand, Compatible
> with MacBook Air Pro, HP, Lenovo, D"
>   Assets:Zero-Sum-Accounts:Amazon-Purchases  -14.29 USD
>   Expenses:Office-Supplies:Laptop-Stand
>
> There was some trial and error that resulted in the final prompt. At
> first, it removed the zero-sum postings and only output expenses. The
> expense accounts had spaces in their names (e.g. "Expenses:Office
> Supplies:Laptop Stand"). There is still room for improvement (I don't
> really care to have an account for laptop stands). Overall, it looks very
> helpful. Perhaps a good workflow is to use GPT to categorize a small batch
> of expenses, manually correct them, and then use smart_importer
>  to handle the rest.
>
> If anyone else has tips please share!
>
>
> On Saturday, April 1, 2023 at 1:53:46 AM UTC-4 Red S wrote:
>
>> Great idea. Talk about drudgery!
>>
>> On Friday, March 31, 2023 at 12:35:09 AM UTC-7 bl...@furius.ca wrote:
>>
>> I haven't tried yet but my hope is that gpt would be great at writing
>> test code. Can you imagine?
>>
>> On Fri, Mar 31, 2023, 01:03 Red S  wrote:
>>
>> Fantastic! Hooray for reducing drudgery!
>>
>> It's apparently quite effective at using code from existing github
>> projects. I love the code explanations in natural language.
>>
>> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/38f90ec4-fea3-4794-98de-4d90f28c960dn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving 

Re: ChatGPT & Beancount

2023-03-31 Thread Martin Blais
I haven't tried yet but my hope is that gpt would be great at writing test
code. Can you imagine?

On Fri, Mar 31, 2023, 01:03 Red S  wrote:

> Fantastic! Hooray for reducing drudgery!
>
> It's apparently quite effective at using code from existing github
> projects. I love the code explanations in natural language.
>
> --
> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/d7116b04-c77d-450d-b015-2f2148e9664en%40googlegroups.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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhO6nbJbOu9TfJ2eDAqVA%2BSY0J1Kujv_rAGeCScEHpovLQ%40mail.gmail.com.


  1   2   3   4   5   6   7   8   9   10   >