A cursory Google search lead me to this[1], which seems to be what you're looking for, something similar probably exists for ledger/hledger.
Personally having dealt with crypto in beancount a few times I used a separate file which got updated periodically with a script, which worked well enough.
If you're interested I suggest reading the beancount cookbook[2] as it contain many examples.