This seems to be the most logical thing, as beancount internally already 
using must be using this information.

Anyone who attempts to write a plugin to implement this will have to 
simulate beancount logic inside them, which is probably not an intention of 
plugins.

On Friday, June 14, 2024 at 3:30:44 PM UTC+2 [email protected] wrote:

> BTW I think the best way to implement this is by modifying the booking 
> process to insert metadata IDs on its output, so that one could call a 
> function to easily extract all the trades from the same set of directives 
> after they've been booked and interpolated, by just matching these IDs.
>
>
>
>
> On Thu, Jun 13, 2024, 21:56 Martin Blais <[email protected]> wrote:
>
>> In order to generate this you need to produce this as a side-effect of 
>> the booking process (which involves matching the incomplete posting spec to 
>> the inventory contents).
>> I think I've wanted to make this part of the core - an important part I 
>> should say - but at the time I switched to building Johnny (
>> https://github.com/edgebips/johnny) for more sophisticated trading 
>> (options with adjustments to multiple legs) and never built it in. I 
>> documented this for the rewrite, as I think it's important: 
>> https://docs.google.com/document/d/1qPdNXaz5zuDQ8M9uoZFyyFis7hA0G55BEfhWhrVBsfc/edit#heading=h.1on91pqrb473
>>
>> So right now, unfortunately no.
>>
>>
>>
>>
>> On Tue, Jun 11, 2024 at 7:38 AM Peter <[email protected]> wrote:
>>
>>> Hey there,
>>>
>>> Is there a way to list a history of all lots for a given commodity? I am 
>>> using FiFo and I would like to create some sort of spreadsheet that lists 
>>> all lots with their buy date and sell date (if there is one).
>>>
>>> So, these transactions
>>>
>>> 2023-06-01 * "Buy shares"
>>>   Assets:Investments:Stocks  50 AAPL {300.00 USD}
>>>   Assets:Bank:Checking
>>>
>>> 2023-07-01 * "Buy shares"
>>>   Assets:Investments:Stocks  50 AAPL {400.00 USD}
>>>   Assets:Bank:Checking
>>>
>>> 2023-08-01 * "Buy shares"
>>>   Assets:Investments:Stocks  50 AAPL {500.00 USD}
>>>   Assets:Bank:Checking
>>>
>>> 2023-12-01 * "Sell shares"
>>>     Assets:Investments:Stocks -75 AAPL {500.00 USD}
>>>     Assets:Bank:Checking 37,500 USD
>>>     Income:Capital:Gains
>>>
>>> 2024-01-01 * "Sell shares"
>>>     Assets:Investments:Stocks -25 AAPL {500.00 USD}
>>>     Assets:Bank:Checking 12,500 USD
>>>     Income:Capital:Gains
>>> Should become something like this:
>>>
>>> +-----------+------------+-----+-------+------------+-----+-------+--------+-----------------+--------------------------+
>>>  
>>> | Commodity | Bought | Qty | Price | Sold | Qty | Price | PnL | Duration 
>>> (days) | Held more than 145 days? | 
>>> +-----------+------------+-----+-------+------------+-----+-------+--------+-----------------+--------------------------+
>>>  
>>> | AAPL | 2023-06-01 | 50 | 300 | 2023-12-01 | 50 | 500 | 10,000 | 150 | Y | 
>>> +-----------+------------+-----+-------+------------+-----+-------+--------+-----------------+--------------------------+
>>>  
>>> | AAPL | 2023-07-01 | 50 | 400 | 2023-12-01 | 25 | 500 | 5000 | 120 | N | 
>>> +-----------+------------+-----+-------+------------+-----+-------+--------+-----------------+--------------------------+
>>>  
>>> | | | | | 2024-01-01 | 25 | 500 | 5000 | 150 | Y | 
>>> +-----------+------------+-----+-------+------------+-----+-------+--------+-----------------+--------------------------+
>>>  
>>> | AAPL | 2023-08-01 | 50 | 500 | | | | | | | 
>>> +-----------+------------+-----+-------+------------+-----+-------+--------+-----------------+--------------------------+
>>> Is this possible? If so, how?
>>>
>>> Regards
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Beancount" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/beancount/2b279e0f-255e-4783-951c-6b53042fcd5dn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/beancount/2b279e0f-255e-4783-951c-6b53042fcd5dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/d0fe0e7c-ad35-4503-90ea-bdd480d9a49fn%40googlegroups.com.

Reply via email to