Re: Changes to support cost transfers

2024-04-13 Thread Eric Altendorf
Awesome, thanks.  This sounds good:
1) I'll add unit tests, try to clean up some of the questions and todos i
had, and develop more certainty around the problem and solution
2) I'll share with you my findings and the unit tests, and you can try
running it on your data to ensure things match
3) Then we can make a call on creating a branch or a conditional in the
master branch.

fwiw i'm not too worried about divergence -- i created this at least 6
months ago, and just pulled from head with no merge conflicts, so i don't
think this is very active part of the code base :)

On Sat, Apr 13, 2024 at 6:57 AM Martin Blais  wrote:

> - 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
> 
> .
>

-- 
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/CAFXPr0vYtcvujJeD_RzuvWgujX6F5v0Y7tf%3D5xc-FCy6nonVDw%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: Closing lots when brokers report dissimilar cost basis (IBKR)

2024-04-13 Thread nug get
just to add, my pdf activity statements from IBKR also state those two 
different costs ("T.Price") in activity statements from 2022 and today, so 
the numbers are clearly coming from them

On Saturday 13 April 2024 at 10:30:58 UTC+2 nug get wrote:

> Hi everyone
> I recently closed some positions I held at InteractiveBrokers, for which i 
> have a nice API-based ingestion pipeline to beancount. However I noted lots 
> of "No position matches"-Errors. 
> Turns out, the reported cost basis / Trade prices  of the closed positions 
> are very slightly off (by a handful of USD-cents) the reported cost basis 
> at purchase. As a result, beancount can't match the lots. 
>
>
>1. Has anyone dealt with this specific issue with IBKR before?
>2. What would be your best practice?
>   1. change the cost basis reported at opening time to match the cost 
>   basis at closing time?
>   2. change the cost basis reported at closing time to match the cost 
>   basis at opening time?
>   3. ...?
>
> Below a sample pair of transactions, as i obtain them via the FlexQuery 
> API.note the $172.74 vs. $172.86
> Thanks for any hints!
> nugget
>
> 2022-04-08 * "VBR" "BUY 3 VBR @ 172.74 USD"
>   Assets:Invest:IB:VBR 3 VBR {172.74 USD, 2022-04-08}
>   Assets:Invest:IB:USD   -518.22 USD
> ...
> 2024-03-04 * "VBR" "SELL -3 VBR @ 183.81 USD"
>   Assets:Invest:IB:VBR   -3 VBR {172.86 USD, 2022-04-08} @ 
> 183.81 USD
>
>
>

-- 
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/d346106a-845f-467b-8691-339a72a5bf9dn%40googlegroups.com.


Closing lots when brokers report dissimilar cost basis (IBKR)

2024-04-13 Thread nug get
Hi everyone
I recently closed some positions I held at InteractiveBrokers, for which i 
have a nice API-based ingestion pipeline to beancount. However I noted lots 
of "No position matches"-Errors. 
Turns out, the reported cost basis / Trade prices  of the closed positions 
are very slightly off (by a handful of USD-cents) the reported cost basis 
at purchase. As a result, beancount can't match the lots. 


   1. Has anyone dealt with this specific issue with IBKR before?
   2. What would be your best practice?
  1. change the cost basis reported at opening time to match the cost 
  basis at closing time?
  2. change the cost basis reported at closing time to match the cost 
  basis at opening time?
  3. ...?
   
Below a sample pair of transactions, as i obtain them via the FlexQuery 
API.note the $172.74 vs. $172.86
Thanks for any hints!
nugget

2022-04-08 * "VBR" "BUY 3 VBR @ 172.74 USD"
  Assets:Invest:IB:VBR 3 VBR {172.74 USD, 2022-04-08}
  Assets:Invest:IB:USD   -518.22 USD
...
2024-03-04 * "VBR" "SELL -3 VBR @ 183.81 USD"
  Assets:Invest:IB:VBR   -3 VBR {172.86 USD, 2022-04-08} @ 
183.81 USD


-- 
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/b2be0ffd-b14f-47a4-95c5-13088e349515n%40googlegroups.com.