Re: Crypto Chart of Accounts setup (staking, DeFi, impermanent loss etc).
> "DM" == Daryl Manning writes: DM> Interesting. I was rather hoping there was something like Reckon that DM> could suck in csvs from the various CEX and DEX exports (where they have DM> them) and then figure out how to write the entries in Ledger themselves. DM> (tho recognize that this makes it hard perhaps to see if a particular DM> strategy eg looping is working as you have no semantic information in the DM> transactions about it.) In addition to modules for managing staking for different cryptos, there will also be modules for snarfing data from different transaction exports. It will have to be done as an open architecture where all that you need to provide is any executable that can convert the input to the expected CSV input. John -- --- 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 ledger-cli+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/m2y22my553.fsf%40newartisans.com.
Re: Multicurrency accounting
There's one small mistake in the comments in the example journal I provided: Equity:Trading:EUR-USD:USD:20220103 120.00 USD ; balance: 100 USD ought to be Equity:Trading:EUR-USD:USD:20220103 120.00 USD ; balance: 120 USD On Monday, 7 February, 2022 at 8:24:11 pm UTC+5:30 the.so...@gmail.com wrote: > Hi, > I'm guessing the wiki page you're referring to is: > > https://github.com/ledger/ledger/wiki/Multiple-currencies-with-currency-trading-accounts > > The trading accounts method is not incorrect: it simply doesn't match what > you expect. The trading accounts method will always give you a 0 balance, > regardless of the currency in which you calculate the balance, which is not > the case for postings using @ (which will differ, depending on the > currency). The downside is that in the trading accounts method, you have > to note capital gains and losses by hand. It is not auto-calculated. > > To handle lots with trading accounts, you'll need to use dated > sub-accounts: > > cat temp.j > P 2022-01-01 EUR 1.0 USD > > 2022-01-01 Salary > Assets:Bank:EUR 100.00 EUR > Equity:Trading:EUR-USD:EUR:20220101-100.00 EUR > Equity:Trading:EUR-USD:USD:20220101 100.00 USD > Income:Salary -100.00 USD > > > P 2022-01-02 EUR 1.1 USD > > 2022-01-02 Bank | Convert 50 EUR to 55 USD > Assets:Bank:USD 55.00 USD > Equity:Trading:EUR-USD:USD:20220101 -50.00 USD ; balance: 50 USD > Equity:Trading:EUR-USD:EUR:20220101 50.00 EUR ; balance: -50 EUR > Income:Capital:Short-Term-5.00 USD > Assets:Bank:EUR -50.00 EUR > > > P 2022-01-03 EUR 1.2 USD > > 2022-01-03 Salary > Assets:Bank:EUR 100.00 EUR > Equity:Trading:EUR-USD:EUR:20220103-100.00 EUR ; balance: -100 EUR > Equity:Trading:EUR-USD:USD:20220103 120.00 USD ; balance: 100 USD > Income:Salary -120.00 USD > > > P 2022-01-04 EUR 1.3 USD > > 2022-01-04 Bank | Convert 100 EUR to 130 USD > Assets:Bank:USD 130.00 USD > Equity:Trading:EUR-USD:USD:20220101 -50.00 USD ; balance: 0 USD > Equity:Trading:EUR-USD:USD:20220103 -60.00 USD ; balance: 60 USD > Equity:Trading:EUR-USD:EUR:20220101 50.00 EUR ; balance: 0 EUR > Equity:Trading:EUR-USD:EUR:20220103 50.00 EUR ; balance: -50 EUR > Income:Capital:Short-Term -20.00 USD > Assets:Bank:EUR-100.00 EUR > > > P 2022-01-05 EUR 1.4 USD > > > with that you get > > ledger -f temp.j bal -X USD > 255.00 USD Assets:Bank >70.00 USDEUR > 185.00 USDUSD > -10.00 USD Equity:Trading:EUR-USD > -70.00 USDEUR:20220103 >60.00 USDUSD:20220103 > -245.00 USD Income > -25.00 USDCapital:Short-Term > -220.00 USDSalary > >0 > > So, > Cash = 255.00 USD (balance of Assets:Bank) > Income:Salary = 220.00 USD (balance of Income:Salary) > Realized Gains = 25.00 USD (balance of Income:Capital:Short-Term) > Unrealized Gains = 10.00 USD (balance of Equity:Trading:EUR-USD) > > I hope this helps. > > Regards, > Pranesh > On Sunday, 23 January, 2022 at 8:05:58 pm UTC+5:30 thea...@gmail.com > wrote: > >> This is copy of reddit post. Wiki example does not work for me or it's >> wrong >> >> Let we have following transaction: >> Income 100 EUR @ 1.0 >> Sell 50 EUR @ 1.1 >> Income 100 EUR @ 1.2 >> Sell 100 EUR @ 1.3 >> Now @ 1.4 >> >> If calculate everything in USD I expect to have balance >> >> Assets.Cash 50 * 1.4 + 50 * 1.1 + 100 * 1.3 = 255 USD >> Income 100 * 1 + 100 * 1.2 = 220 USD >> Equity.Realized 50 * (1.1 - 1.0) + 50 * (1.3 - 1.0) + 50 * (1.3 - 1.2) = >> 25 USD >> Equity.Unrealized 50 * (1.4 - 1.2) = 10 USD >> >> I tried trading account according to wiki and results are unadequate >> >> P 2022-01-01 EUR 1.0 USD >> 2022-01-01 Salary >> Assets:Bank 100.00 EUR >> Income:Salary >> >> P 2022-01-02 EUR 1.1 USD >> 2022-01-02 Transaction 1 >> Assets:Bank -50.00 EUR >> Equity:Trading:USD 50.00 EUR >> Equity:Trading:EUR -55.00 USD >> Assets:Bank 55.00 USD >> >> P 2022-01-03 EUR 1.2 USD >> 2022-01-03 Salary >> Assets:Bank 100.00 EUR >> Income:Salary >> >> P 2022-01-04 EUR 1.3 USD >> 2022-01-04 Transaction 1 >> Assets:Bank -100.00 EUR >> Equity:Trading:USD 100.00 EUR >> Equity:Trading:EUR -130.00 USD >> Assets:Bank 130.00 USD >> >> P 2022-01-05 EUR 1.4 USD >> >> Income is not adequate >> >> $ ledger bal -f trade.txt -X USD >> 255.00 USD Assets:Bank >> 25.00 USD Equity:Trading >> -185.00 USD EUR >> 210.00 USD USD >> -280.00 USD Income:Salary >> >> 0 >> >> If I put FIFO logic manually >> >> P 2022-01-01 EUR 1.0 USD >> 2022-01-01 Salary >> Assets:Bank 100.00 EUR @ 1.0 USD >> Income:Salary >> >> P 2022-01-02 EUR 1.1 USD >>
Re: Multicurrency accounting
Hi, I'm guessing the wiki page you're referring to is: https://github.com/ledger/ledger/wiki/Multiple-currencies-with-currency-trading-accounts The trading accounts method is not incorrect: it simply doesn't match what you expect. The trading accounts method will always give you a 0 balance, regardless of the currency in which you calculate the balance, which is not the case for postings using @ (which will differ, depending on the currency). The downside is that in the trading accounts method, you have to note capital gains and losses by hand. It is not auto-calculated. To handle lots with trading accounts, you'll need to use dated sub-accounts: cat temp.j P 2022-01-01 EUR 1.0 USD 2022-01-01 Salary Assets:Bank:EUR 100.00 EUR Equity:Trading:EUR-USD:EUR:20220101-100.00 EUR Equity:Trading:EUR-USD:USD:20220101 100.00 USD Income:Salary -100.00 USD P 2022-01-02 EUR 1.1 USD 2022-01-02 Bank | Convert 50 EUR to 55 USD Assets:Bank:USD 55.00 USD Equity:Trading:EUR-USD:USD:20220101 -50.00 USD ; balance: 50 USD Equity:Trading:EUR-USD:EUR:20220101 50.00 EUR ; balance: -50 EUR Income:Capital:Short-Term-5.00 USD Assets:Bank:EUR -50.00 EUR P 2022-01-03 EUR 1.2 USD 2022-01-03 Salary Assets:Bank:EUR 100.00 EUR Equity:Trading:EUR-USD:EUR:20220103-100.00 EUR ; balance: -100 EUR Equity:Trading:EUR-USD:USD:20220103 120.00 USD ; balance: 100 USD Income:Salary -120.00 USD P 2022-01-04 EUR 1.3 USD 2022-01-04 Bank | Convert 100 EUR to 130 USD Assets:Bank:USD 130.00 USD Equity:Trading:EUR-USD:USD:20220101 -50.00 USD ; balance: 0 USD Equity:Trading:EUR-USD:USD:20220103 -60.00 USD ; balance: 60 USD Equity:Trading:EUR-USD:EUR:20220101 50.00 EUR ; balance: 0 EUR Equity:Trading:EUR-USD:EUR:20220103 50.00 EUR ; balance: -50 EUR Income:Capital:Short-Term -20.00 USD Assets:Bank:EUR-100.00 EUR P 2022-01-05 EUR 1.4 USD with that you get ledger -f temp.j bal -X USD 255.00 USD Assets:Bank 70.00 USDEUR 185.00 USDUSD -10.00 USD Equity:Trading:EUR-USD -70.00 USDEUR:20220103 60.00 USDUSD:20220103 -245.00 USD Income -25.00 USDCapital:Short-Term -220.00 USDSalary 0 So, Cash = 255.00 USD (balance of Assets:Bank) Income:Salary = 220.00 USD (balance of Income:Salary) Realized Gains = 25.00 USD (balance of Income:Capital:Short-Term) Unrealized Gains = 10.00 USD (balance of Equity:Trading:EUR-USD) I hope this helps. Regards, Pranesh On Sunday, 23 January, 2022 at 8:05:58 pm UTC+5:30 thea...@gmail.com wrote: > This is copy of reddit post. Wiki example does not work for me or it's > wrong > > Let we have following transaction: > Income 100 EUR @ 1.0 > Sell 50 EUR @ 1.1 > Income 100 EUR @ 1.2 > Sell 100 EUR @ 1.3 > Now @ 1.4 > > If calculate everything in USD I expect to have balance > > Assets.Cash 50 * 1.4 + 50 * 1.1 + 100 * 1.3 = 255 USD > Income 100 * 1 + 100 * 1.2 = 220 USD > Equity.Realized 50 * (1.1 - 1.0) + 50 * (1.3 - 1.0) + 50 * (1.3 - 1.2) = > 25 USD > Equity.Unrealized 50 * (1.4 - 1.2) = 10 USD > > I tried trading account according to wiki and results are unadequate > > P 2022-01-01 EUR 1.0 USD > 2022-01-01 Salary > Assets:Bank 100.00 EUR > Income:Salary > > P 2022-01-02 EUR 1.1 USD > 2022-01-02 Transaction 1 > Assets:Bank -50.00 EUR > Equity:Trading:USD 50.00 EUR > Equity:Trading:EUR -55.00 USD > Assets:Bank 55.00 USD > > P 2022-01-03 EUR 1.2 USD > 2022-01-03 Salary > Assets:Bank 100.00 EUR > Income:Salary > > P 2022-01-04 EUR 1.3 USD > 2022-01-04 Transaction 1 > Assets:Bank -100.00 EUR > Equity:Trading:USD 100.00 EUR > Equity:Trading:EUR -130.00 USD > Assets:Bank 130.00 USD > > P 2022-01-05 EUR 1.4 USD > > Income is not adequate > > $ ledger bal -f trade.txt -X USD > 255.00 USD Assets:Bank > 25.00 USD Equity:Trading > -185.00 USD EUR > 210.00 USD USD > -280.00 USD Income:Salary > > 0 > > If I put FIFO logic manually > > P 2022-01-01 EUR 1.0 USD > 2022-01-01 Salary > Assets:Bank 100.00 EUR @ 1.0 USD > Income:Salary > > P 2022-01-02 EUR 1.1 USD > 2022-01-02 Transaction 1 > Assets:Bank -50.00 EUR {1.0 USD} @ 1.1 USD > Assets:Bank 55.00 USD > Equity:Realized Gains -5.00 USD > > P 2022-01-03 EUR 1.2 USD > 2022-01-03 Salary > Assets:Bank 100.00 EUR @ 1.2 USD > Income:Salary > > P 2022-01-04 EUR 1.3 USD > 2022-01-04 Transaction 1 > Assets:Bank -50.00 EUR {1.0 USD} @ 1.3 USD > Assets:Bank -50.00 EUR {1.2 USD} @ 1.3 USD > Assets:Bank 130.00 USD > Equity:Realized Gains -20.00 USD > > P 2022-01-05 EUR 1.4 USD > > balance is correct > > $ ledger bal -f trade2.txt -X USD > 255.00 USD Assets:Bank >