Thanks for the response. Maybe I should have made it more clear that the first line in my ledger was for the pricesdb which would give ledger the daily conversion rate for BTC-GBP, which from what I read should be enough.
===================================================================== P 2020/06/29 BTC 7497.15 GBP ===================================================================== I feel like ledger was made to do this, just not clear on how to make it do it as a virtual posting. On Sunday, July 5, 2020 at 8:03:57 AM UTC-7 d10 wrote: > > > On Wednesday, July 1, 2020 at 1:31:41 PM UTC-4, Charles Lindsay wrote: >> >> Basically I want to insert a virtual transaction of a different commodity >> price based on the price of the commodity in the pricedb. >> >> I need help converting the currency in the virtual posting. >> Given the following ledger: >> >> ===================================================================== >> >> P 2020/06/29 BTC 7497.15 GBP >> >> = expr 'account =~ /Accounts:Client/' >> >> (Btc:Stock) -(??? Need Help Here??? BTC) >> >> 2020-06-30 * (4284af3d-dc3d-4b83-a3c0-f87f013f06f3) 03378c0c >> >> ; :Credit:Payments: >> >> Accounts:Client:9cc2fdda06e04c29a40071 35.00 GBP >> >> Accounts:External:bfc20917a2bd4ca18fb259 >> >> ===================================================================== >> I want the rules to save the 35.00 GBP in BTC as calculated from the >> pricesdb, i.e. -(35.00 GBP / 7497.15 GBP) or -0.004668440674122833 BTC >> >> Any help is appreciated. >> > > Maybe take a look at `lotter` (https://src.d10.dev/lotter). While it > does not do exactly what you're asking for, it does something close. Maybe > you could modify it to suit your needs. > > Lotter supports a "base" operation, which observes price data, and will > convert values from other currencies into the base currency. But it does > this only when a cost is expressed in a non-base currency, and a price > converting that currency to the base is known on the same day. > > In your example, the transaction involves only GBP, and there's nothing > about it that hints BTC is involved in any way. For this reason, I think > you'll have to modify your ledger file in some way to get accounting for > the BTC. You might need to explicity add a split with an amount like > "35.00 GBP @@ 0.00466844 BTC". > > -- --- You received this message because you are subscribed to the Google Groups "Ledger" 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/ledger-cli/61a50c0d-eea1-42a3-924a-f4227bcf2f27n%40googlegroups.com.
