Hi,
Problem: you have a bunch of old investor lots, and you want to convert them into new admiral lots. The new lots must be scaled for quantity and price, but must retain the original dates for the cost bases. Essentially, you want your transaction to look like:
2021-01-01 * "Conversion"
Assets:Vanguard:VINV -100 VINV {1 USD, 2010-01-01}
Assets:Vanguard:VINV -80 VINV {1.2 USD, 2010-08-23}
...
...
Assets:Vanguard:VADM 50 VADM {2 USD, 2010-01-01}
Assets:Vanguard:VADM 40 VADM {2.4 USD, 2010-08-23}
...
That's the entire transaction. No gains are realized. Your lots retain their original dates, which is important.
You probably can take it from here, but for anyone reading along who wants an easy way to hit the keystrokes to make it happen: given this is a one-time thing, a hack suffices. Simply transform your input lines using any kind of scripting. Here is what I do in vim:
Here is a thread where I discuss this.
1. Use your editor to edit your transaction and bring up the lots in bean-context once you visually select the transaction. I use the excellent
vim-beancount, and have:
au FileType beancount nnoremap <buffer> <leader>g vip:GetContext<CR>
2. filter it through this script:
!awk '{print $1, -$2*(NEW_QTY/OLD_QTY), $3, $4, $5*(OLD_QTY/NEW_QTY), $6, $7}'
replace the QTY (quantity) fields with your data.
(you might need to insert a space after the '{' for this to work)
3. Copy paste the lines into your source .beancount file, and fix up as needed