Lot matching

Mike Bray (Quote Loader Author)'s Avatar

Mike Bray (Quote Loader Author)

14 Jan, 2021 10:37 AM

What is the best way to retrieve the lot matching information from an investment transaction?

  1. Support Staff 1 Posted by Sean Reilly on 14 Jan, 2021 10:49 AM

    Sean Reilly's Avatar

    In the security SplitTxn for each sell there is a parameter "cost_basis" which contains a SyncRecord that maps transaction IDs of buy transactions to the number of shares allocated from that buy.

    I would strongly request that you don't change that value as a lot of work has gone into ensuring that the allocations are calculated properly, especially since it has to deal with stock splits.

    Thanks!
    Sean

    --
    Sean Reilly
    Developer, The Infinite Kind
    https://infinitekind.com

  2. 2 Posted by Mike Bray (Quot... on 14 Jan, 2021 10:57 AM

    Mike Bray (Quote Loader Author)'s Avatar

    Thanks Sean, I am not interested in changing the values, just extracting the information for reporting purposes. I understand that the info is in the parameters, all I was interested in was whether or not here was an API call to retrieve the information or do I need to go to the parameters directly?

  3. Support Staff 3 Posted by Sean Reilly on 14 Jan, 2021 10:58 AM

    Sean Reilly's Avatar

    That's great to hear Mike. Unfortunately there isn't any API for it yet.

    Thanks,
    Sean

  4. 4 Posted by Mike Bray (Quot... on 14 Jan, 2021 11:11 AM

    Mike Bray (Quote Loader Author)'s Avatar

    OK, Interesting I have tried it out and found the tag on the Parent txn, rather than the security split. Is this correct? See enclosed dump of transaction.

  5. Support Staff 5 Posted by Sean Reilly on 14 Jan, 2021 12:27 PM

    Sean Reilly's Avatar

    I think that actually is on the security split. The screenshot is showing the combined parameters for the parent and any splits, so the "0.cost_basis" means it is getting the "cost_basis" parameters from the 0th split.

    Because transactions are atomic units the split information is always combined as part of the main transaction. In other words, whenever any part (split) of a transaction is changed, that updates the state of the entire transaction.

    Thanks,
    Sean

  6. 6 Posted by Mike Bray (Quot... on 14 Jan, 2021 01:46 PM

    Mike Bray (Quote Loader Author)'s Avatar

    OK

  7. Mike Bray (Quote Loader Author) closed this discussion on 01 Feb, 2021 08:10 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac