It looks like I had a quick go at this in 2020 and concluded I'd never more
than an afternoon:
https://github.com/beancount/beancount/tree/trade_quick_experiment



On Fri, Jun 14, 2024 at 1:29 PM Martin Blais <bl...@furius.ca> wrote:

> Yeah, that's why it wasn't done.
> I'll see if I can just insert the metadata for it, should be pretty easy.
>
> On Fri, Jun 14, 2024, 13:13 Chary Chary <chary...@gmail.com> wrote:
>
>> This seems to be the most logical thing, as beancount internally already
>> must be using this information.
>>
>> Anyone who attempts to write a plugin to implement this will have to
>> simulate beancount logic inside the plugin, and then somehow verify that
>> plugin's logic was equivalent to the one of beancount
>>
>> On Friday, June 14, 2024 at 3:30:44 PM UTC+2 bl...@furius.ca 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 <bl...@furius.ca> 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 <tobias....@gmail.com> 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 beancount+...@googlegroups.com.
>>>>> 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 beancount+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/fd36d738-0d4a-4051-aad3-bf78de5a9a10n%40googlegroups.com
>> <https://groups.google.com/d/msgid/beancount/fd36d738-0d4a-4051-aad3-bf78de5a9a10n%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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhM_xW8-4MYFRLxYRoxiVmZorSFQVEXJO8p4s1YjpikAzg%40mail.gmail.com.

Reply via email to