On Friday, June 4, 2021 at 8:40:54 PM UTC-7 [email protected]
wrote:
> Apologies for bumping an old thread with an off-topic question, but
> Redstreet, you said:
>
> > I personally have a vim plugin that uses bean-doctor context to insert
> the lots.
>
> This is really interesting; I wonder if this is something that's openly
> available or if it's a personal hack whether you'd be interested in
> sticking it on Github?
>
For conversions, it's trivial: it's a 2 or 3 line python script that scales
the units and cost fields. When I have an imported transaction that looks
like:
2000-01-01 * "Upgrade shares"
Assets:XTrade:ABC -234.15 ABC
Assets:XTrade:DEF 175.45 DEF
Then what I do is: get beancount context (I've mapped this to '\g' in
vim-beancount), which opens the context in a split. I then select (visual
mode) all the ABC lots, and pipe it through the python script. An
equivalent awk script would look roughly like:
:'<,'>!awk '{print $1, -$2*(175.45/234.15), $3, $4, $5*(234.15/175.45), $6,
$7}'
My python script just made this easier by spitting out both sides of the
transaction (DEF as well), and accepting parameters for the scale value.
--
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/b45a8ea7-dd4f-4a2b-9da6-1219d5917e3cn%40googlegroups.com.