Re: Limit to securities in specific currency

2024-03-16 Thread Martin Michlmayr
* lipp f  [2024-03-16 05:37]:
> In my portfolio account I have US / CA / EU securities and I would like get 
> balance by market.
> Wondering if there is a way to have a limit filter able to  limit to 
> securities in specific currency in ledger bal / reg. 

-l "commodity == 'EUR'"

Note that quoted commodities need to be quoted properly:

-l "commodity == '\"GB00BPN5P782\"'"

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20240316132430.GA2419445%40panya.cyrius.com.


Re: What could be the reason for this warning?

2024-02-03 Thread Martin Michlmayr
* lipp f  [2024-02-02 06:57]:
> Getting many warnings like this:
> 
> Warning: "/mnt/e/Data/Invest/data//ldg-t14/t14.j", line 27591: Transaction 
> check failed: (commodity == "TDB164")

The check needs to be:
    commodity == '"TDB164"'

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20240203124249.GA782471%40jirafa.cyrius.com.


Re: Total posting costs and precision issues?

2023-12-11 Thread Martin Michlmayr
* Tavis Ormandy  [2023-11-24 19:13]:
> 2023/11/02 * Sell Shares
> Assets:401K   (-partial_lot(5, "FSKAX", $734.43, 
> 6.456, "[2023/11/01]")) @ $120.00
> 
> ...ugly hack or elegant solution, you decide :)

I can't decide but it's certainly a very creative solution!

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20231212030354.GC214467%40jirafa.cyrius.com.


Re: Make "reg" output the account balance

2023-11-22 Thread Martin Michlmayr
How about:
ledger reg --daily
It doesn't quite do what you want but I think it's the best there is
for now.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20231122234157.GA2819100%40jirafa.cyrius.com.


Re: Total posting costs and precision issues?

2023-11-21 Thread Martin Michlmayr
* Bob Wilson  [2023-11-20 21:05]:
> So it looks like the lot I sold doesn't quite match what ledger thinks I
> owned. I anticipate the issue is that the precision used in printing is
> different than the precision used to store lots internally.

The only solution I'm aware of is:

2023/11/01 * Buy Shares
Assets:401K 6.456 FSKAX {$113.7592936803} 
[2023/11/01] @@ $734.43
Income:Opening Balances  -$734.43

2023/11/02 * Sell Shares
Assets:401K-6.456 FSKAX {$113.7592936803} 
[2023/11/01] @ $120.00
Income:Capital Gains  -$40.29
Assets:401K   $774.72

I don't know if there's a better one.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20231122000327.GA2667362%40jirafa.cyrius.com.


Re: Ledger 3.3.2 change in commodity format sub-directive handling

2023-11-20 Thread Martin Michlmayr
There was a bug in earlier version that the format info in commodity
directives were not properly validated.

1,234. is not a valid number in ledger.

Just try this:

2023-01-01 * "Test"
  Assets:Investments  1,100. GBP
  Assets:Cash-1,100.00 GBP

Related bug not the same:
https://github.com/ledger/ledger/issues/2095
https://github.com/ledger/ledger/issues/1990

Martin


* Antonio MCh  [2023-11-20 19:57]:
> I tested the commodity declaration in Ledger 3.2.1-20200518, and there it 
> is valid, just wondering if there was a reason to stop supporting that 
> format.
> 
> El lunes, 20 de noviembre de 2023 a las 21:50:49 UTC-5, Martin Michlmayr 
> escribió:
> 
> > * Antonio MCh  [2023-11-20 15:35]:
> > > commodity JPY
> > > format 1,234. JPY
> > > 
> > > Note that I have a dot '.' to indicate the commodity does not uses 
> > > decimals. This is recommended by hledger, but when I try it in ledger 
> > > (Ledger 3.3.2-20230330) I get the error:
> >
> > hledger and ledger are incompatible in several ways. 1,234. is not a
> > valid number in ledger.
> >
> > -- 
> > Martin Michlmayr
> > https://www.cyrius.com/
> >
> 
> -- 
> 
> --- 
> 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/6801b1ac-32b1-4a8f-8f24-3139cbb64c8an%40googlegroups.com.


-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20231121040706.GA2538382%40jirafa.cyrius.com.


Re: Ledger 3.3.2 change in commodity format sub-directive handling

2023-11-20 Thread Martin Michlmayr
* Antonio MCh  [2023-11-20 15:35]:
> commodity JPY
>   format 1,234. JPY
> 
>   Note that I have a dot '.' to indicate the commodity does not uses 
> decimals. This is recommended by hledger, but when I try it in ledger 
> (Ledger 3.3.2-20230330) I get the error:

hledger and ledger are incompatible in several ways.  1,234. is not a
valid number in ledger.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20231121025029.GA2508350%40jirafa.cyrius.com.


Re: rules about account names with spaces

2023-10-16 Thread Martin Michlmayr
* lipp f  [2023-10-16 10:55]:
> 2003-08-31 TD Canadian Money Market
> TD Group RRSP CAD -23,284.00
> "SDRRSP - TD:TD Canadian Money Market"  "TDB164" 2,328.4 @@ CAD 
> 23,284.00
> 
> This seems to be working but quotes are part of the account name and 

Never quote account names.

> There is another post here saying that the only rule is that two
> spaces are not allowed because two spaces separate account name from
> amount.

Correct.  Two spaces or a tab.  But one space between characters is
fine in account names.  No need to quote.

> commodity name as well, which I don't think is correct.

The rule for commodities is here:
https://ledger-cli.org/doc/ledger3.html#Naming-Commodities

"Commodity names can have any character, including white-space.
However, if you include white-space or numeric characters, the
commodity name must be enclosed in double quotes ‘"’:"

> commodity name as well, which I don't think is correct.

Yes, the quotes become part of the name of a quoted commodity.
That's in fact correct, even if a bit unintuitive.

I opened a bug about this years ago:
https://github.com/ledger/ledger/issues/1473

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20231016233341.GA1244006%40jirafa.cyrius.com.


Re: Liability Account

2023-08-29 Thread Martin Michlmayr
* Lazar Slavkovic-Raco  [2023-08-29 12:51]:
> I am new to the plain-text accounting and after some buildup of the
> transactions I stumbled on the problem of adding new account for
> Liabilities. When I am creating new transaction where I created new
> Liability, to which counter account should be tied to? My first
> initial thoughts of this would be to my assets but I want to hear
> from you.

Initially, it would typically be an expense; assets is only involved
when you eventually pay off the liability.

For example: you buy some stuff (e.g. computer, raw materials, etc)
but can pay 30 days later.  You now have:

 - And expense.  But you didn't pay with cash (an asset) but instead
   you owe the amount (a liability)
 - Later you pay the debt (liability) with cash or bank transfer (assets)

In ledger:

2022-08-30 * Buy stuff
Expenses:Stuff   1000.00 USD
Liability:Payable   -1000.00 USD

2022-09-30 * Pay for stuff
Liability:Payable1000.00 USD
Assets:Bank -1000.00 USD

Now there's no Liability:Payable anymore, your bank account is lower
and your expenses higher.

(Obviously Expenses:Stuff is a really bad account name; for example
Expenses:Electronics might be good if you buy a computer).

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20230830011241.GA1610916%40jirafa.cyrius.com.


Re: Search/filter for payee or description

2023-08-27 Thread Martin Michlmayr
* 'Grzegorz Lippe' via Ledger  [2023-08-27 02:44]:
> How can I search or limit the output of a balance or register command  to a 
> specific payee?

-l "payee =~ /foo/"

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20230828031047.GA1466018%40jirafa.cyrius.com.


Re: Need some help on lot date and lot price

2023-07-05 Thread Martin Michlmayr
* Lanrete Li  [2023-07-04 23:52]:
> 2023/07/01 * Buy ETF
>   Assets:Bank  -130 USD
>   Assets:Fund: 100 "FD_" @@ 130 USD
> 
> In my understanding, this will create an internal commodity record that says
> "FD_" = 1.3 USD at 07/01

You can run "ledger bal --lots" to see the lot information.

> I'm not exactly happy with this because

Unfortunately, afaik you have to do it manually at the moment because
ledger has no built-in mechanism to do it for you.

> Lastly, I sw some one will record the "incremental gain" as 
> `Income:CapitalGain` when selling the fund, for example, in the official 
> document there is:
> 
> 2004/05/01 Stock purchase 
>   Assets:Broker50 AAPL @ $30.00 
>   Expenses:Broker:Commissions  $19.95 
>   Assets:Broker$-1,519.95
> 
> 2005/08/01 Stock sale 
>   Assets:Broker-50 AAPL {$30.00} @ $50.00 
>   Expenses:Broker:Commissions  $19.95 
>   Income:Capital Gains $-1,000.00 
>   Assets:Broker$2,480.05

Yes, this is correct.  Actually, it's slightly incorrect because you
also have to give the date:

2005/08/01 Stock sale
  Assets:Broker-50 AAPL {$30.00} [2004/05/01] @ $50.00
  Expenses:Broker:Commissions  $19.95
  Income:Capital Gains $-1,000.00
  Assets:Broker$2,480.05

> It seems to me that the later transaction can be just written as 
> 
> 2005/08/01 Stock sale 
>   Assets:Broker-50 AAPL @ $50.00 
>   Expenses:Broker:Commissions  $19.95 
>   Assets:Broker$2,480.05

> Both ledger will balance, which one SHOULD i follow?

The correct one.  You have to specify {} @ manually.  Only
this way ledger knows what you're talking about exactly.

Run "bal --lots" - if the lots are red, you have a problem.

> what if my 50 share of AAPL is purchased at different date and
> therefore different price?

You can do something like this:

  Assets:Broker-25 AAPL {$25.00} [2003/03/02] @ $50.00
  Assets:Broker-25 AAPL {$30.00} [2004/05/01] @ $50.00

Unfortunately, all of this is quite a manual process.

Basically: run "ledger bal --lots assets:Broker", copy the info,
afterwards run "bal --lots assets:broker" again and make sure nothing
is red.

If something is red, it means you removed a lot that doesn't exist.
This can be because you forgot to write the date (as in the example
above).

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20230705070712.GF470632%40jirafa.cyrius.com.


Re: gains for last 7 days?

2023-06-23 Thread Martin Michlmayr
* lipp f  [2023-06-23 05:54]:
>  "ledger bal --gain" returns all gains since inception but I would like to 
> get the gains for last week only.
> 
> I'm trying 
> ledger bal --gain  -p "last 7 days"
> but it does not return anything.

I don't think --gain can be used for this.  However, what should be
possible is to value your holding on day 1 and then on day 2 and
calculate the difference (manually).

e.g.
ledger -p "until 2023-01-01" --price-db pricedb/funds.pricedb -V --now 
2022-12-31

I think you need both -p and --now

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20230623153504.GA823193%40jirafa.cyrius.com.


Re: Querying transactions based on multiple accounts (from accountA to accountB)

2023-06-12 Thread Martin Michlmayr
* Ankur Sinha  [2023-06-12 22:04]:
> I'm looking for a way to list/filter transactions based on multiple
> accounts. For example, I'd like to see transactions where money moved
> from Account A to Account B (or vice versa).

ledger bal Assets:A -l "any(account =~ /Assets:B/)"

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20230612210931.GA154455%40jirafa.cyrius.com.


Re: Default Currency for an Account

2023-06-04 Thread Martin Michlmayr
* Inder Sen  [2023-06-01 03:50]:
> If not, is there a way to avoid entering currency symbol for every
> transaction entry?

No.

I'd argue this is a task that your import process should handle.  How
do you get your data into ledger?

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20230604153123.GB212580%40jirafa.cyrius.com.


Re: Ledger 3.3.2 change in commodity format sub-directive handling

2023-06-04 Thread Martin Michlmayr
I think this works as expected (now), but maybe it needs to be
documented better.  "format" requires an example of how the commodity
is to be used - you have to include the commodity because some people
(or regions) put it before the number and some people after.



* Scott Carpenter  [2023-06-04 06:00]:
> I see now that if I use, say:
> 
> commodity xyz
> format 1,000.000 xyz
> 
> Putting the commodity last, things behave the same  as before with my 
> output.
> 
> On Sunday, June 4, 2023 at 7:23:06 AM UTC-5 Scott Carpenter wrote:
> 
> > After updating to 3.3.2, I was getting errors like this with my 
> > commodities:
> >
> > While parsing file , line 6:
> > Error: commodity directive symbol abc and format directive symbol  should 
> > be the same
> >
> > Note the two spaces between "symbol" and "should". Looks like there is no 
> > format directive symbol. Commodities look like this:
> >
> > commodity $
> > format $ 1,000.00
> > default
> >
> > commodity abc
> > format 1,000.00
> >
> > commodity xyz
> > format 1,000.000
> >
> > And many more entries. I've been using these for many years. Every format 
> > line after the first one produced an error like the above when I ran the 
> > file through ledger.
> >
> > Adding the commodity to the format line makes the error go away:
> >
> > commodity abc
> > format abc 1,000.00
> >
> > Was I doing it wrong all this time and just getting away with it?
> >
> > Figured I'd share as an FYI that something changed with this, and to help 
> > others that might run into the same error.
> >
> > Thank you!
> >
> 
> -- 
> 
> --- 
> 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/c12415e0-8882-4f43-bb1c-71993986f803n%40googlegroups.com.


-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20230604153008.GA212580%40jirafa.cyrius.com.


Re: How do I check for tags without value?

2023-05-26 Thread Martin Michlmayr
* crea.24...@gmail.com  [2023-05-26 01:14]:
> This works fine if you check for a specific tag value, but it doesn't work 
> if you want to check for a tag without a value. check value != "" ,or check 
> value != '' or a similar regex don't raise any warnings.
> 
> Is there a way to check if a tag has no value?

This works for me:

-l 'has_tag("foo")' -l 'tag("foo") !~ /./'

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20230526085637.GA524428%40jirafa.cyrius.com.


[ANNOUNCE] ledger 3.3.2

2023-03-30 Thread Martin Michlmayr
I tagged ledger 3.3.2:
https://github.com/ledger/ledger/releases/tag/v3.3.2

This is a bug fix release in the 3.3.x series.

Changes:

- Fix divide by zero (bugs #777 and #2207)

- Increase string size limit in src/unistring.h assert (bug #2174)

- Require tzdata for Nix flake build (bug #2213)

Thanks to John Wiegley for fixing the first two issues and to Steve
Purcell for fixing the third issue.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20230330074721.GA781310%40jirafa.cyrius.com.


Re: divide by zero processing transaction

2023-03-04 Thread Martin Michlmayr
* Tavis Ormandy  [2023-03-04 15:42]:
> Yes, that is how I want it formatted - but I want it tracked
> internally at higher precision. I think that is a valid thing to want, right?

Yeah, I thought "format" was for *display* precision only, so it
doesn't make sense that this cuts off precision.  Am I
misunderstanding "format?"

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/ZAPpPJ2USeH9v5uR%40jirafa.cyrius.com.


[ANNOUNCE] ledger 3.3.1

2023-03-03 Thread Martin Michlmayr
I tagged ledger 3.3.1:
https://github.com/ledger/ledger/releases/tag/v3.3.1

This is a bug fix release in the 3.3.x series.  Most notably, it fixes
a regression introduced in 3.3.0.

Changes:

- Fix regression leading to incorrect error about `format` directives (bug 
#2205)

- Add information about compile features to `--version`

- Fix compiler warnings by minimizing the use of deprecated APIs

- Update flake.nix to match nixpkgs ledger/default.nix

- Remove unused Python server related code

- Various documentation improvements

Thanks to Reddit users u/sepen_ and u/Boldewyn for reporting the
regression and to John for fixing it quickly.  Alexis Hildebrandt
has made a number of code and documentation cleanups.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/ZAHS3GxA3j3FJpXL%40jirafa.cyrius.com.


Re: Register filter for a specific currency

2023-02-20 Thread Martin Michlmayr
* Paulo Flabiano Smorigo  [2023-02-20 15:21]:
> Is this a bug or the expected result? If this is expected, how can I
> use a register filter to show only the entries in a specific
> currency that also works with --market argument?

I don't think it's possible at the moment, at least I don't know how.
-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y/QudVkmvtvAlxmu%40jirafa.cyrius.com.


Re: Unexpected balance verification

2023-02-18 Thread Martin Michlmayr
* 'Dave Webb' via Ledger  [2023-02-18 11:53]:
> 2016-09-25 X
>   Expenses:Other  £ 2
>   Assets:Cash  = £ 1
> 
> 2016-09-26 X
>   Expenses:Other  £ 1
>   Assets:Cash   = £ 1   ; I would expect this to fail

If I change the last transaction to:

2016-09-26 X
  Expenses:Other  £ 1
  Assets:Cash   = £ 1   ; I would expect this to fail
  x

then I get:
 with 3.2.1:
   Error: Only one posting with null amount allowed per transaction
 with 3.3.0:
   2016-09-25 X  Assets:Cash   £ -2
 x £ -1

so it seems the "Assets:Cash" posting is treated as not having an
amount.

BTW, if I rename "Assets:Cash" to another account it works fine.

So the problem is 2 balance assignments to the same account after
each other.

There are some open bug reports but I'm not sure this is covered
already.
-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y/GH%2BSGWkbh5rLpM%40jirafa.cyrius.com.


Re: [ANNOUNCE] ledger 3.3.0

2023-02-08 Thread Martin Michlmayr
* o1bigtenor  [2023-02-08 05:33]:
> Should I be waiting until this update wends its way into Debian's repositories
> or should I upgrade from source code?

That's up to you.

There are no earth-shattering changes that would require an immediate
upgrade imho.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y%2BO00EVQpxgTkT6n%40jirafa.cyrius.com.


[ANNOUNCE] ledger 3.3.0

2023-02-07 Thread Martin Michlmayr
I tagged ledger 3.3.0:
https://github.com/ledger/ledger/releases/tag/v3.3.0

Thanks to all contributors who made this release possible!  It's been
a long time since the last release and there are quite a number of
changes.

Here are the changes in 3.3.0:

- Use `$PAGER` when environment variable is set (bug #1674)

- Make `--depth` correctly fold postings to accounts of greater depth into the
  parent at the specified level (bug #987)

- When using wild-cards in the `include` directive, include matched files in
  sorted order (bug #1659)

- Ensure absolute path for include (bug #2075)

- Try to use `$XDG_HOME_CONFIG/ledger/ledgerrc` or `~/.config/ledger/ledgerrc`
  first

- Improve Python 3 support and drop support for Python 2

- Add support for automatically reading files encrypted with GPG (bug #1949)

- Add support for a "debit" column in the `convert` command (bug #1120)

- Fix parsing of files without end of line (bug #516)

- Fix incorrect parsing of expressions containing a `-` without spaces (bug 
#2001)

- Fix payee metadata on postings not being validated and payee aliases not
  being honored (bug #556 & bug #1892)

- Fix ledger interpreting a posting with 0 difference as a null-posting,
  which leads to it auto-balancing the posting (bug #1942)

- Correctly escape all string values in lisp report (bug #2034)

- Fix a regression where empty commodities were shown (bug #1969)

- Fix a regression where using multiple commodities in one transaction triggers
  an assertion (bug #1998)

- Fix --time-colon for negative time amounts

- Use correct int return type for stream input operations (bug #2058)

- Use amount_width for balance report

- Remove some UTF-8 code that was having no effect (bug #2061)

- Fix unrounding for equity

- Fix SIGABRT when python subcommand raises an exception

- Improve XML reports

- Support building on older versions of CMAKE (less than 3.7)

- Fix compilation with Boost 1.76 (bug #2030)

- Fix Msys2 MinGW build (bug #1905)

- Fix unicode problems on Windows (bug #1986)

- Fix the issue that with Boost >= 1.77 `include` directive cannot find the file
  to include for stdin (`-f -`). Also for `-f -` when `include` cannot find the
  file it reports the error with full path now. (bug #2057 & bug #2092)

- Fix Nix build

- Rename `quoted_rfc4180` to `quoted_rfc`, as numbers used in function names
  confuses the parser (#2007).

- Numbers are no longer permitted in value expression function names.

- Various documentation improvements

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y%2BNQ8nCbaWk0Z10R%40jirafa.cyrius.com.


Re: Stats Report Failure

2023-02-03 Thread Martin Michlmayr
* Jasel17212  [2023-01-30 15:49]:
> John / Martin - I've noticed that running the stats report fails when I 
> have an automatic transaction configured.

Do you have a test case you can add to 
https://github.com/ledger/ledger/issues/2079

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y94ARzKK4/3OyNv9%40jirafa.cyrius.com.


Re: Stats Report Failure

2023-01-30 Thread Martin Michlmayr
* Jasel17212  [2023-01-30 15:49]:
> Is this a bug? Other than commenting out the automatic transaction, is 
> there a workaround?

That looks like: https://github.com/ledger/ledger/issues/2079

I'm not aware of a workaround.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y9iEjj8XenGxRL1N%40jirafa.cyrius.com.


Re: Unused Accounts

2023-01-26 Thread Martin Michlmayr
* Martin Michlmayr  [2023-01-27 10:14]:
> The only way I can think of is:

grep "^account" d | sed -e "s/^account *//" | sort | uniq > 1
ledger -f d bal --empty --flat -F "%a\n" | sort | uniq > 2
comm -3 1 2
rm -f 1 2

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y9M9nEqcFLcULcPG%40jirafa.cyrius.com.


Re: Unused Accounts

2023-01-26 Thread Martin Michlmayr
* Jasel17212  [2023-01-26 18:11]:
> Anyone know of a way to list defined but unused accounts, similar to 
> hledger's --unused option?

I don't think so.

Why do you need this?

The only way I can think of is:

1) grep for "^account" and find the accounts you defined

2) do "ledger bal --empty" to find all accounts that have been used

the difference is unused accounts; they will not show up, even with
--empty

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y9Mzov8cL1zX8Zfs%40jirafa.cyrius.com.


Re: Assertion failure in unistring

2023-01-25 Thread Martin Michlmayr
* John Wiegley  [2023-01-25 14:10]:
> TO> Hello! I've been hitting an assertion when experimenting with register
> TO> formats: $ ledger --file finance.dat reg -F '%12(total)' Error: Assertion
> TO> failed in "/build/ledger-SR1_DQ/ledger-3.1.3/src/unistring.h", line
> TO> 72:ledger::unistring::unistring(const string&): len < 1024
> 
> Hi Tavis, the example data in your message doesn't abort on my machine. Do you
> have a reproducible example I could use for debugging?

Did you run the command he mentioned:
ledger --file finance.dat reg -F '%12(total)'

It fails for me with ledger from Git:

Error: Assertion failed in "ledger/src/unistring.h", line 
72:ledger::unistring::unistring(const string&): len < 1024

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y9HYdj2r4Z99IErh%40jirafa.cyrius.com.


Re: Assertion failure in unistring

2023-01-24 Thread Martin Michlmayr
* Tavis Ormandy  [2023-01-25 06:56]:
> Hello! I've been hitting an assertion when experimenting with register 
> formats:

Can you please report this at https://github.com/ledger/ledger/issues

> Maybe this is not the intended solution, should I just average the cost basis 
> and record it as one big lot?

The transaction looks ok to me, but ledger has had some problems with long
transactions; I guess you hit one such problem.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y9DXOkMo95nYu5k1%40jirafa.cyrius.com.


Planning new ledger release

2023-01-19 Thread Martin Michlmayr
I've been saying for months that we need a new release of ledger.
There have been a lot of fixes in the last ~2 years.

If anyone has pending fixes or contributions, please open PRs now.

Is anyone aware of any blockers?  (I am not of anything major that
would block a release.)

I intend to make a new release of ledger soon.  Ideally this month.
Your help is appreciated!

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y8oWUJMQZethk/mC%40jirafa.cyrius.com.


ledger2beancount 2.7: ledger-to-beancount converter

2022-12-03 Thread Martin Michlmayr
I released version 2.7 of ledger2beancount, the ledger-to-beancount
converter.

You can get ledger2beancount from GitHub:
https://github.com/beancount/ledger2beancount

Here are the changes in 2.7:

* Fix parsing of amounts with decimal comma with default commodity in hledger 
mode
* Allow amounts without fractional part but decimal separator for hledger
* Improve pre-processing example in documentation
* Add support for amounts with plus sign
* Set option `name_income` for top-level account `Revenue`
* Fix whitespace handling for inline maths

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y4s49u%2BzNM2S85PJ%40jirafa.cyrius.com.


Re: squash weekly totals across sub-accounts?

2022-11-09 Thread Martin Michlmayr
* Alan  [2022-11-09 16:42]:
> I have some of my Expense accounts organized hierarchically. For example, 
> rather than simply "Expenses:Food" I have a few accounts, such as:
> 
>- Expenses:Food:Groceries
>- Expenses:Food:Chicken
>- Expenses:Food: ... (a few others)

For "bal", adding "--display 'l <= 2'" will do what you want

For reg, I think --depth 2 in Git will do what you want thanks to
https://github.com/ledger/ledger/pull/1901

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y2xko4jtxOq71MMu%40jirafa.cyrius.com.


Re: Currency synonyms

2022-11-05 Thread Martin Michlmayr
* Paulo Phagula  [2022-11-05 07:32]:
> I'd like to know if ledger has a functionality to make currency
> synonyms.  Allow me to explain: I'm in Mozambique, where the
> currency is Metical. The ISO code is MZN and the abbreviated symbol
> is MT. Depending on the Institution I may get a statement using
> either. I'd like ledger to consider these two as one and the same.

C 1 MZN = 1 MT

https://www.ledger-cli.org/3.0/doc/ledger3.html#Commodity-equivalences

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y2Z7Tf/b4RQgrTCn%40jirafa.cyrius.com.


Function to regex match accounts in a transaction?

2022-10-29 Thread Martin Michlmayr
"any(account =~ /Ass/)" is a boolean. Is there a way to do a regex on
all accounts in a transaction and get a string as a result?

Use case: imagine you receive Income:Dividends on two accounts:
Assets:Broker 1 and Assets:Broker 2

You want to --group-by the Assets: account to find on which broker
account you received dividends, e.g.:

bal Income:Dividends --group-by get_account("^Assets:Broker")

Inspired by this question:
https://www.reddit.com/r/plaintextaccounting/comments/yedxd8/grouping_balances_by_target_account/

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Y14JHn3JnOr502My%40jirafa.cyrius.com.


Re: Question about "4.5.2 Buying and Selling Stock"

2022-09-02 Thread Martin Michlmayr
* Tobias Pfeiffer  [2022-09-01 21:28]:
> > >   2005/08/01 Stock sale
> > > Assets:Broker-50 AAPL {$30.00} @ $50.00
> > > Expenses:Broker:Commissions$19.95
> > > Income:Capital Gains   $-1,000.00
> > > Assets:Broker   $2,480.05

> I think I kind of understand your explanation, but I have trouble
> understanding on a technical level how that transaction balances.
> When you write "you *also* have a capital gain of $20 per share", can I
...

Let me try to explain it the way I see it.

Assets:Broker contains 50 AAPL {$30.00}.  We agree on that.  This is
$1500.  Now we can argue what it's really worth right now because the
value of AAPL goes up and down but we know that Assets:Broker contains
50 AAPL with a *book value* of $30 each and that's a total of $1500.
You can verify this with "bal Assets:Broker -B"

So now when you do:

Assets:Broker-50 AAPL {$30.00} @ $50.00

{$30.00} is the cost.  @ $50.00 is the price.  You're selling
something with a cost of $30.00 (the book value) for a price of $50.

So you're basically saying: hey, this APPL I own with a total book
value of $1500... you know what, I'm selling it for $2500

So Assets:Broker goes down by $1500 (remember, the book value!) and
you get $2500 (what you sold it for).  That doesn't quite balance,
does it?  So where does the difference come from?  You made a gain.

So basically we have:

  Assets:Broker  -$1500 of APPL [book value]
  Assets:Broker   $2500 of cash
  Income:Capital gains   -$1000 (the balancing figure)

> imagine that this lot notation means that there is an implicit "hidden
> posting"
>   Assets:Broker (($50 - $30) * 50)
> that is used to balance the "Income:Capital Gains" posting?

I don't think that's correct.  Like I showed, Assets:Broker is just
$1500 (the book value).

At least this is how I understand it.  Maybe I'm wrong, but my
explanation appears to make sense. ;)

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YxGwGmlJt4likmhS%40jirafa.cyrius.com.


Re: Question about "4.5.2 Buying and Selling Stock"

2022-08-31 Thread Martin Michlmayr
* Tobias Pfeiffer  [2022-09-01 08:39]:
> However, I don't understand the example.
> 
>   2004/05/01 Stock purchase
> Assets:Broker 50 AAPL @ $30.00
> Expenses:Broker:Commissions$19.95
> Assets:Broker  $-1,519.95

This example is actually not ideal.  It would be better to write:

  2004/05/01 Stock purchase
Assets:Broker 50 AAPL {$30.00} @ $30.00

since that makes it clearer that you're creating what ledger calls a
"lot".

In order to understand what's going on with lots, it's very useful to
run "bal --lots".  This is important because ledger allows you to
remove lots that do not exist, so it's a good idea to run "bal --lots"
periodically -- anything in red is a bed sign.  In fact, the example
from the ledger tutorial is broken: the first transaction creates a
lot with a specific date, but the second transaction doesn't remove
that specific lot (since it doesn't specify the date).

For example the example you posted creates:

50 AAPL {$30.00} [2004-05-01]  Assets:Broker

This is a lot.  It was a cost ($30) and a date.

>   2005/08/01 Stock sale
> Assets:Broker-50 AAPL {$30.00} @ $50.00
> Expenses:Broker:Commissions$19.95
> Income:Capital Gains   $-1,000.00
> Assets:Broker   $2,480.05
> 
> Clearly the second transaction does not balance if I leave out the lot
> price "{$30.00}". What exactly is happening here with the lot price so
> that this transaction balances?

You sell 50 AAPL for $50, so that's $2500.  You also have a capital
gain of $20 per share ($50 - $30), so that's income of $1000; income
is negative in ledger, so that's -$1000.

* Tobias Pfeiffer  [2022-09-01 09:03]:
> So this looks like it is basically equivalent to
> 
>   2005/08/01 Stock sale
> Assets:Broker-50 AAPL @ $30.00
> Expenses:Broker:Commissions$19.95
> Income:Capital Gains   $-1,000.00
> Assets:Savings  $2,480.05
> 
> except that the former explicitly keeps the information about the sell
> price, and also tracks it in the price history, is that right?

Well, apart from the fact that it's incorrect (*) because you're in fact
not selling at $30.

(*) Incorrect in the sense that it doesn't represent the true nature
of the transaction.  It's not a faithful representation of what
happened.

The basic problem is that selling at $30 and selling something bought
at $30 at $50 leads to the same result:

50 * $30 = 1500

50 * $50 = 2500
50 * ($50-$30) = -1000 (capital gain)

Total 1500

So it's easy to get these sales wrong.  Maybe ledger should post the
capital gains to some account automatically so reduce errors but the
problem is that there might not be a single capital gains account, so
you'd need special syntax to specify where the capital gains/loss
goes.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YxAT2XmbveK9EY/j%40jirafa.cyrius.com.


Re: Listing only specific currency transactions in the same account

2022-07-05 Thread Martin Michlmayr
* nik...@gmail.com  [2022-07-05 01:27]:
> I have accounts for example in Expenses that hold transactions in
> different currencies.  So lets say that i have Books expense that
> hold books that i bought with EUR and USD.  When i type "ledger r
> Books" presents all the transactions and balance in all currencies.
> How can i list only one currency transactions and one balance?

You can add:
  --limit "commodity == 'EUR'"

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YsP%2ByYEkBpQFZ8ue%40jirafa.cyrius.com.


Re: Are you using bracketed dates in comments ?

2022-05-23 Thread Martin Michlmayr
* Alan  [2022-05-23 18:32]:
> Referring to the "Bountiful Blessings" example in the Effective Dates manual 
> , if you 
> say `ledger --effective register Groceries` you get the proper effective 
> dates. If you instead say `ledger --effective register Checking` you would 
> get just the one date, 2008/10/16, which makes sense now that I think about 
> it. But I was somehow expecting/hoping that it would show separate lines in 
> the Checking register, with the same effective dates from the Expenses 
> lines.

If you want to same effective date for checking and expenses, you have
to add the effective date on the transaction header:

2020-05-20=2020-02-03 * Foo

You probably have it on the posting using the ; [...] syntax.  If you
do this, it only applies to the posting.

In other words: there are two ways to specify effective dates, one is
for the whole transaction and one is only for a posting.

Martin

-- 

--- 
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/Yow47TrwH1eeHXHn%40jirafa.cyrius.com.


Re: Are you using bracketed dates in comments ?

2022-05-23 Thread Martin Michlmayr
Yes, please post an example.  Maybe you're not using them correctly.

* Alan  [2022-05-23 16:41]:
> I use bracketed dates. However, recently I've been having some trouble 
> getting them to work.
> 
> I thought they were working before, although I can't be sure I remember 
> exactly. They're supposed to be used if you give the "--effective" 
> command-line flag, right?
> 
> On Friday, May 18, 2018 at 10:59:00 AM UTC-7 Simon Michael (sm) wrote:
> 
> >
> > > On May 17, 2018, at 10:38 PM, John Wiegley  wrote:
> > > Brackets came first, yes, by several years. I still use them, though, 
> > because
> > > they're quick and convenient.
> >
> > Good! I've been remembering correctly. Agreed, they are slightly quicker 
> > and more convenient than writing the tag/metadata syntax. I find myself 
> > starting to use them.
> 
> -- 
> 
> --- 
> 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/63559a15-c59e-4792-a3bf-6ee48afca9bfn%40googlegroups.com.


-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YowdcMboBbbdMc4r%40jirafa.cyrius.com.


Re: Setting precision for $

2022-05-22 Thread Martin Michlmayr
* David Glasser  [2022-05-22 18:41]:
> I sold some stock at a price valued in half-cents. I modeled this in ledger
> like
> 
> 2022-05-13 Buyer
>   Bank  $100.50
>   Shares  -100 STOCK @ $1.005
> 
> This means that Ledger now thinks that it should display every $ value with
> three digits of precision

No, it doesn't.  Price info (@ $...) is not used for precision.

I don't get 3 digits with your example.  If you really get 3 digits,
it's because of another reason.  Maybe you specified 3 digits in
another transaction.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Yor3%2BkUIRN66BM/Y%40jirafa.cyrius.com.


Re: Calculate tax owed up to income limit or additional tax after income limit

2022-04-19 Thread Martin Michlmayr
* Gulshan Singh  [2022-04-18 21:57]:
> I can't find anything related to the `account()` function in the
> docs, is it not documented or am I just missing it?

It would be great if someone could add it to the documentation.

https://github.com/ledger/ledger/issues/2099

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Yl5RuarlldK7tEcq%40jirafa.cyrius.com.


Re: Calculate tax owed up to income limit or additional tax after income limit

2022-04-18 Thread Martin Michlmayr
* Gulshan Singh  [2022-04-17 00:06]:
> I've tried something like this for the Medicare example, but it
> doesn't work as abs(O) is dealing with the transaction amount, and
> not the total balance of the account:

There is a syntax to refer to the total of an account:
account("...").total

However, that's not going to work for your cause.  If you go from,
let's say, $180k income to $240k, there's afaik no way to tell ledger
to apply something exactly at $200k.


account Assets:Bank
account Income:Hooli

account Liabilities:Taxes:Medicare
account Liabilities:Taxes:Medicare:Additional

= expr "account =~ /Income:Hooli/ and account('Income:Hooli').total <= -20 
USD"
(Liabilities:Taxes:Medicare:Additional) .009

= expr "account =~ /Income:Hooli/"
(Liabilities:Taxes:Medicare).0145

2022-04-15 * Payroll
Income:Hooli   -150,000 USD
Assets:Bank

2022-04-01 * Payroll
Income:Hooli   -150,000 USD
Assets:Bank

2022-04-01 * Payroll
Income:Hooli       -150,000 USD
Assets:Bank

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Yl32BAzHYxErEudt%40jirafa.cyrius.com.


Re: Check balance of account and all its children

2022-04-14 Thread Martin Michlmayr
* J J  [2022-04-14 15:05]:
> O - The total of all postings seen so far, or the total of an account and 
> all its children.
> 
> So I am trying to write:
> *account Budget*
> *check O >= 0 * 

John, I looked at the source code and 'O' seems to exist, but I also
failed to make it work.  Any insights from you would be welcome.

My first theory was that the problem is that the "Budget" account on
its own was never used, but adding a $1 transaction to that account
didn't help.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YliiGLSRKLWdGAnB%40jirafa.cyrius.com.


Re: Unknown metadata tag

2022-03-14 Thread Martin Michlmayr
* melb...@gmail.com  [2022-03-14 15:21]:
> I am trying to run an old ledger file where I have lots of metadata tags 
> (key/value pairs) and I am getting theses errors.
> 
>  % ledger -f test.ledger bal
> Warning: "test.ledger", line 7: Unknown metadata tag 'MyTag'

You probably have --strict in your ~/.ledgerrc.

The manual says:
If using the --strict or --pedantic options, you must declare this tag to 
avoid warnings and errors.

(This wasn't fully checked in the past due to bugs; they have been
fixed, which is why you see this now and not before.)

> Here's the test file:
> 
> account Cash
> account Expenses

You miss the tag declaration here:

tag MyTag

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Yi/fomdEWOUIyBvn%40jirafa.cyrius.com.


Re: Continuing ledger after a large gap

2022-03-13 Thread Martin Michlmayr
* melb...@gmail.com  [2022-03-13 19:35]:
> Hello I have about 7 years worth of data in a ledger file till
> ~2019. Due to some life events I had to stop updating it and now I
> would like to pick it back up.
> 
> I would really like add to the same file. Is there a good approach
> to do this?

I'd post adjustment entries to bring your balances in sync with what
your bank says.

If your ledger from 2019 says you have 400 EUR in the bank, but the
bank balance is 1000 EUR right now, you could add this entry:

2022-03-14 * Adjust bank balance
Assets:Bank   600.00 EUR = 1000 EUR
Equity:Opening balance

In fact, ledger supports setting a certain balance like this:

2022-03-14 * Adjust
Assets:Bank  = 1000 EUR
Equity:Opening balance

If you later find time to important bank transactions from 2019-2022,
you can always do that.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Yi6t/YPnOO1MoivE%40jirafa.cyrius.com.


Re: get a number/amount only from `ledger balance ...`

2022-02-06 Thread Martin Michlmayr
* Sim Tov  [2022-02-06 12:43]:
> I would like to use the output of `ledger balance ...` in a bash script. I 
> want to get a number/amount only, without all the strings around it... is 
> there a command line option to get amount only (even without 
> commodity/currency sign)?

This gets you the amount (with the commodity):

ledger bal assets:cash --balance-format "%(amount)"

I'm not sure if you can get just the number, but you can just run this
command through sed or perl to remove the commodity.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YgBn3YhG1C3IrRH/%40jirafa.cyrius.com.


Re: Possible bug in --market interaction with --end

2022-01-13 Thread Martin Michlmayr
* Richard M Kreuter  [2022-01-13 08:48]:
> Is the following behavior a bug?

No.

> That is, the --end date appears to act as an upper exclusive bound
> for the purpose of summing postings, but seemingly not as an
> exclusive bound for price db lookup involved in calculating market
> value.

--end stops evaluating transactions, but things are still evaluated as
of the _current_ date, including pricedb entries after the end of
--end.

What you want is --now (maybe in combination with --end) which
specifies when to value things.

(Note that --end is exclusive whereas --now is inclusive, i.e. --end
stops one day before --end; --now is on the date of --now)

I use this command for value my investments at the end of the year:

-p "until 2021-01-01" --now 2020-12-31 bal --price-db pricedb/funds.pricedb -V

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YeC3oXDMZqTUUa9K%40jirafa.cyrius.com.


Re: Transaction balances as unbalanced virtual but doesn't when real

2022-01-04 Thread Martin Michlmayr
* Muke Tever  [2022-01-03 18:54]:
> Oh, I see the problem, and I guess it's a little different than I
> thought.  So amount and market(amount) doesn't 'balance' to zero,
> but they do 'balance' in the sense that ledger doesn't complain
> about it being unbalanced, if they exist as a regular transaction:

> 2022/01/02 Interest
> Assets:OBJ 1 OBJ {$5.00} [2022/01/02]
> Income:OBJs   $-5.00

Yes and no.

The example you give only works because ledger assumes that a
transaction with two commodities balances. (It does an implicit
conversion.  There was some discussion about this recently, in which I
argued that ledger should not do this.)

If you introduce a third commodity in your example it will not
balance:

2022/01/02 Interest
Assets:OBJ 1 OBJ {$5.00} [2022/01/02]
Income:OBJs   $-5.00
A   -10 EUR
B10 EUR

You need the @ on the first posting.

BTW, given 1 OBJ {$5.00} I once argued that the cost should set the
price (i.e. @ $5.00 should be implicit if no other @ is given).
I still think that makes sense but it's not how ledger works.
I think it's this one: https://github.com/ledger/ledger/issues/630

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YdQiLXsNrRjk9Tmy%40jirafa.cyrius.com.


Re: Transaction balances as unbalanced virtual but doesn't when real

2022-01-03 Thread Martin Michlmayr
* Muke Tever  [2022-01-02 21:45]:
> = %/inventory/
> Equity:$account (-amount)
> Equity:USD  (market(amount))

I initially thought it's a bug but after looking at it some more I
think it's not a bug.

amount and market(amount) are not the same.  The amount is $5.00.
market(amount) is 1 OBJ {$5.00} [2022-01-02].

So I think you need to use either:

= %/inventory/
Equity:$account (-amount)
Equity:USD  (amount)

or:

= %/inventory/
Equity:$account (market(-amount))
Equity:USD  (market(amount))

You can run this command to see the difference:
ledger -f d bal --lots equity

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YdOC4Dd28KN731X%2B%40jirafa.cyrius.com.


Re: [Entries that are expressions]

2021-12-31 Thread Martin Michlmayr
* John Wiegley  [2021-12-30 23:25]:
> UB> Does not work!
> 
> I'm not entirely sure why, but Ledger doesn't like the absence of spaces
> around the '-' sign. This does work:
> 
> ((110 - 60)*0.5)

This got fixed recently
https://github.com/ledger/ledger/issues/2001

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Yc78QD/slEqmxEfU%40jirafa.cyrius.com.


Re: [Entries that are expressions] (was: The fair Christmas problem: splitting expenses automatically)

2021-12-29 Thread Martin Michlmayr
* Uwe Brauer  [2021-12-29 19:58]:
>   expenses:User2:User1-Compensation  25.00/2
> 
> The entry 25.00/2 is not interpreted.

You have to this use syntax:

2010/07/23 User2:User1-Compensation
  expenses:User2:User1-Compensation  (25.00/2)
  expenses:User1:User1-Compensation

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YcznwfdoWXlCaluB%40jirafa.cyrius.com.


Re: Using hyphens in commodity names

2021-12-27 Thread Martin Michlmayr
* Yashovardhan  [2021-12-27 11:06]:
> It seems like using hyphens (-) in commodity names causes ledger to
> have problems with limit and other queries.

> For example, ledger reg -l 'commodity == "ABC-Fund"' should output 3 postings 
> but has no output.

In your query, the " quotation mark is used to quote the string.  But
since it's a quoted commodity, you also need to specify the quotes for
the commodity.  Therefore, you need two quotation marks, like this:

ledger -f d reg -l 'commodity == "\"ABC-Fund\""'

> Please let me know if there are any set of valid characters for
> commodity names. Currently, using underscore (_) instead of hyphen
> (-) seems to be a quick fix.

https://www.ledger-cli.org/3.0/doc/ledger3.html#Commoditized-Amounts

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YcpSZB4QYo0LkJvE%40jirafa.cyrius.com.


Re: How to only display subtotals

2021-12-21 Thread Martin Michlmayr
* Marcin Borkowski  [2021-12-22 05:41]:
> What do I tell the `bal` report to display both `Expenses:Life:Food`
> and `Expenses:Life:Phone`, but only the subtotal for
> `Expenses:Hobbies` (without separating `Books` and `Music`)?

I don't think you can do this in a single query.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YcKthmBB05sva0E8%40jirafa.cyrius.com.


Re: Chart of Accounts standards and consistency

2021-12-11 Thread Martin Michlmayr
* POliveira  [2021-12-11 21:05]:
> In addition, there is a 4th Case I forgot to mention, which is cash 
> holdings.
> Do you recommend having a single account Assets:Cash with multiple 
> currencies in it or instead separate accounts as in Assets:Cash:EUR , 
> Assets:Cash:USD etc.? And why?

Personally, I have a single Assets:Cash account.  I prefer a simple
account structure.

If I want to limit my queries to one currency, I can always do:
ledger reg ets:cas -l "commodity == 'PHP'"

Having said that, I can see two arguments for using Assets:Cash:CURRENCY

* `reg cash:php` is easier than `reg ets:cas -l "commodity == 'PHP'"`
* Balance assertions might be easier if there's only one commodity in the 
account (?)

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YbWQZG4paXTxplVi%40jirafa.cyrius.com.


Re: Understanding primary commodities

2021-12-10 Thread Martin Michlmayr
* psionl0  [2021-12-10 00:32]:
> "I thought that by adding the ; [=DATE] in methods 2 and 3 I was recording 
> the day the paypal account was settled, am I wrong?"
> You are putting the date in a comment which means it has no effect on the 
> reports that Ledger generates.

It's actually valid syntax for an aux date on a posting; you have to
use --effective to use the aux date.

# ledger -f e reg payp
2021-05-20 Starbucks   Assets:Paypal-90.00 EUR   -90.00 EUR
   Assets:Paypal 90.00 EUR0
   Assets:Paypal-80.00 GBP   -80.00 GBP
# ledger -f e reg payp --effective
2021-05-22 Starbucks   Assets:Paypal-90.00 EUR   -90.00 EUR
2021-05-31 Starbucks   Assets:Paypal 90.00 EUR0
^^
2021-05-22 Starbucks   Assets:Paypal-80.00 GBP   -80.00 GBP

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YbNcu0sBnLiv91Hk%40jirafa.cyrius.com.


Re: Understanding primary commodities

2021-12-08 Thread Martin Michlmayr
I don't have time to think through your samples right now and I hope
someone else will respond.

However, I wanted to mention Peter Selinger's tutorial on multiple
currency accounting:
https://www.mathstat.dal.ca/~selinger/accounting/tutorial.html

Reading/applying this has been on my TODO list for years, but I'm
being told it's a good way to handle transactions with multiple
currencies.

(If anyone uses this and wants to comment, I'd appreciate it.)

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YbFNgCScR5BNObiV%40jirafa.cyrius.com.


Re: Transaction does not balance

2021-12-08 Thread Martin Michlmayr
* psionl0  [2021-12-07 19:18]:
> Ledger doesn't need to "know" the conversion rate when a transaction
> contains multiple currencies. It just has to "assume" that whatever
> the exchange rate is will balance the transaction (ie assume
> nothing).

Your "assume nothing" is to assume something.

I don't want ledger to make assumptions.  I want ledger to enforce
the balancing requirement.

Personally I don't like that ledger allows implicit conversations
since ledger assumes an exchange rate.  Beancount, for example,
requires an explicit exchange rate when there are only two postings /
two commodities.

Let's do:

2021-12-08 * Test
Assets:A 10.00 EUR
Assets:B -8.52 GBP

If you know roughly the values of EUR and GBP, this transaction
looks obviously correct to you.  But this requires a lot of knowledge
(i.e. assumptions about the world).

Now:

2021-12-08 * Test
Assets:A   1000 EUR ; let's say I forgot the . between the 00s
Assets:B -8.52 GBP

You'd probably agree that this isn't quite right, yet ledger will
happily assume an (incorrect) exchange rate.

Using explicit exchange rates makes ledger enforce the balancing
requirement.

If I had done:

2021-12-08 * Test
Assets:A   1000 EUR @ 0.852 GBP
Assets:B -8.52 GBP

ledger would complain.

You *WANT* ledger to complain.

You don't want ledger to assume.

> The reason why I question this is that ledger could also be used to
> record items of stock in the same way that it records currencies.
> Unfortunately, as it stands, I have to record the purchase or sale
> of each item of stock individually which breaks up the bank
> transaction and makes it more difficult to reconcile with my bank
> statement. Using @ or @@ prevents ledger from displaying the
> individual item totals in the balance report (they have all been
> converted).

Maybe you could give an example, so it's clearer.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YbB7KSmzmRXC9OX7%40jirafa.cyrius.com.


Re: Transaction does not balance

2021-12-07 Thread Martin Michlmayr
* POliveira  [2021-12-07 05:31]:
> I was reading the manual and trying to sort out how to use exchange amounts
> in this case, but without success.
> Can you exemplify how this transaction could be recorded in a single entry
> using explicit exchange rates/amounts?

You can use any of the following 3 transactions:

2021/05/31 * Currency Exchange
Assets:Paypal15.00 EUR @ 1.333 USD
Assets:Paypal   -20.00 USD
Assets:Bank1 10.00 GBP @ 1.5 EUR
Assets:Bank2-15.00 EUR

2021/05/31 * Currency Exchange
Assets:Paypal15.00 EUR @ (1/0.75 USD)
Assets:Paypal   -20.00 USD
Assets:Bank1 10.00 GBP @ 1.5 EUR
Assets:Bank2-15.00 EUR

2021/05/31 * Currency Exchange
Assets:Paypal15.00 EUR @@ 20.00 USD
Assets:Paypal   -20.00 USD
Assets:Bank1 10.00 GBP @@ 15.00 EUR
Assets:Bank2-15.00 EUR

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Ya9z%2BEcP0rhugeFt%40jirafa.cyrius.com.


Re: Transaction does not balance

2021-12-07 Thread Martin Michlmayr
* POliveira  [2021-12-07 01:05]:
> 2021/05/31 * Currency Exchange
> Assets:Paypal15.00 EUR
> Assets:Paypal   -20.00 USD

Typically, you should specify an exchange rate with @ or @@ to make
the relationship between two currencies clear.

However, if there are only two postings, ledger will do an implicit
conversation for you, i.e. it does not require an explicit exchange
rate (@) or exchange amount (@@).

I strongly recommend to always use @ or @@ though since implicit
conversations could lead to problems that are hard to track down
later.

> 2021/05/31 * Currency Exchange
> Assets:Paypal15.00 EUR
> Assets:Paypal   -20.00 USD
> Assets:Bank1   10.00 GBP
> Assets:Bank2  -15.00 EUR

This involves 3 currencies.  How should ledger know the relationship
between these currencies?

It may be obvious to a human what you want in this case, but you'll
have to tell ledger explicitly.  As mentioned above, *explicit* is
good anyway as it helps you avoid mistakes.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/Ya85jec3rtdZIYth%40jirafa.cyrius.com.


Re: How to import "ledger" module in Python

2021-12-02 Thread Martin Michlmayr
* Felipe Micaroni Lalli  [2021-12-02 12:54]:
> I'm trying to execute this example described in ledger doc:
> 
> import ledger

AFAIK you have to run it is "ledger python SCRIPT".

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YalUze2JO4Pa0M%2Bh%40jirafa.cyrius.com.


Re: inconsistent behaviour in equity command

2021-11-05 Thread Martin Michlmayr
* lipp f  [2021-11-05 07:20]:
> Thank you Martin. In another recent discution you are recommandin a "D" 
> record to specify / enforce commodity format. Something like:
> 
> D 1,000.00 AUD
> 
> I have tryied that and it works fine for CAD commodity (CA currency) but 
> not for TDB902 and TDB952. Why is that?

Because actual usage (i.e. input data) trumps the declaration with
"D".

Use this example:

D 1000.00 AUD

2021-02-02 * Foo
 A 1,000.00 AUD
 B

You'll get the comma as the thousand separator.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YYXEgTk4mbMGHGML%40jirafa.cyrius.com.


Re: inconsistent behaviour in equity command

2021-11-05 Thread Martin Michlmayr
* lipp f  [2021-11-05 06:23]:
> You are correct Martin. For TDB902 and TDB952, the jurnal entries are in 
> "commodity amount @ price" format. I got all the records through an export 
> process and changing manually all of them does not seem like an option.
> 
> So, the quetion is the same,  how do I get a consitent equity report?

So it sounds like ledger gives you the correct output for the input
you're feeding it.  The solution then is to fix your input.

Maybe you can pipe your export script into a script that changes
"commodity amount" to "amount commodity".  A small Perl script should
do the trick.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YYUyYt66ZLQ%2Bi6WG%40jirafa.cyrius.com.


Re: inconsistent behaviour in equity command

2021-11-04 Thread Martin Michlmayr
* lipp f  [2021-11-04 13:21]:
> Some rows are account, commodity, amount and others are account,
> amount, commodity. Any options to fix this?

And your input file doesn't use a similarly inconsistent style, or
does it match your input file?

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YYR3OB3w1PgJijDW%40jirafa.cyrius.com.


Re: Formatting commodity output with the format commodity directive

2021-10-31 Thread Martin Michlmayr
* Jasel17212  [2021-10-31 16:22]:
> There may very well be a cleaner way to do this, but this approach
> does seem to effectively work around my initial problem. If you have
> thoughts on a better way to do this, feel free to share your ideas.

Add this to your file:

D 1,000.00 AUD

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YX8mlftOj8N72Tgs%40jirafa.cyrius.com.


Re: Your ingest workflow?

2021-10-19 Thread Martin Michlmayr
* Marvin Ritter  [2021-10-19 00:42]:
> I'm once more troubled by changes in the statements provided by one of my 
> banks. It's probably easy to fix but I thought I use the opportunity to 
> learn what others do.

Just curious because you posted this to the ledger mailing list, talk
about the beancount ingest API and speak about importing into your
"ledger": are you using the beancount ingest API and then produce
ledger entries, or do you use beancount and this should have posted to
the beancount list?

Several aspects you describe (e.g. downloading statements) apply
equally to ledger and beancount but others (creating entries) are
quite different.
-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YW6InDfkQRzi0zbG%40jirafa.cyrius.com.


Re: ledger python module documentation

2021-10-05 Thread Martin Michlmayr
* lipp f  [2021-10-05 16:55]:
> I have seen python/demo.py in the distribution but I am looking for 
> somethin more detaled. Like a standard python module documentation.
> 
> Is it available anywhere? TIA.

Unfortunately not.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YVzmURU3UHLhbrNW%40jirafa.cyrius.com.


Re: Is it possible to abbreviate very large numbers? Using megs (M), kilos (K), etc? (EOM)

2021-09-11 Thread Martin Michlmayr
Not that I'm aware of, but I'm not 100% sure.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YT1OQ7SldiGXI44c%40jirafa.cyrius.com.


Re: Possible bug with payee aliases or am I missing something?

2021-09-11 Thread Martin Michlmayr
* Felipe Mica  [2021-09-11 17:25]:
> line 15: Unknown payee 'BBB'
> line 23: Unknown payee 'DDD'
> line 31: Unknown payee 'FFF'
> 
> Why aren't the aliases working in this case?

They are working.  Run "ledger reg" and you'll see that it's working
as expected.

The "Unknown payee" warnings are wrong.  It's fixed already but we
have to make a new release.

https://github.com/ledger/ledger/commit/5560b0c40f3986704df25095fcc485bcc1de9e5b

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YT1OK7IRIEaMnqut%40jirafa.cyrius.com.


Re: Conversible commodities, how to deal with that?

2021-09-11 Thread Martin Michlmayr
* Felipe Mica  [2021-09-11 17:00]:
> But maybe there is a better way to deal with that?

Typically you'd use "C" for that.

https://www.ledger-cli.org/3.0/doc/ledger3.html#index-C-1

C 100,000,000 SAT = 1 BTC

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YT1ND8P/ogZ/bSUp%40jirafa.cyrius.com.


Re: GitHub workflows for ledger CI - help required

2021-09-04 Thread Martin Michlmayr
* Rahix  [2021-09-04 09:35]:
> Now that GHA seems to be up and running, can you drop Travis from the
> repository?  The checks still show up in each pull-request and make the
> overall status "waiting" because the Travis check never completes.

I removed the Travis hook already but I can't figure out how to remove
the Travis requirement for pull requests.  Do you know how?

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YTQmqBX9x%2B3j9Nz0%40jirafa.cyrius.com.


Re: range error compiler warnings on ARM, comparing char to -1

2021-08-23 Thread Martin Michlmayr
Alan, it would be great if you could submit a pull request through
GitHub.

* Alan Bram  [2021-08-18 12:18]:
> Sorry for the late reply: this was languishing in my "spam" category, which
> I unfortunately do not look at often enough.
> 
> Yes, this occurs on ARM, as I mentioned. I believe it is safe to ignore
> (meaning, I believe it does not lead to incorrect calculations in Ledger),
> but IMHO it should definitely be cleaned up. I offered to fix it, but
> received no response.
> 
> On Mon, Jul 19, 2021 at 4:21 PM Norman Baatz  wrote:
> 
> > I’m getting this too. Is this an issue when running Ledger on ARM?
> >
> > On Wednesday, October 14, 2020 at 11:44:25 PM UTC+2 Alan wrote:
> >
> >> I tried compiling Ledger on an ARM processor, where the bare `char` type
> >> defaults to unsigned. I got warnings at a handful of lines in a couple of
> >> source files:
> >>
> >>- query.cc
> >>- times.cc
> >>- token.cc
> >>
> >> "warning: comparison is always false due to limited range of data type
> >> [-Wtype-limits]"
> >>
> >> The bug is fairly obvious, and I would be happy to contribute a clean-up
> >> fix. But I wanted to ask first whether it would be welcome, because I
> >> assume I couldn't possibly be the first person to have encountered this.
> >>
> >> Actually most, if not all, of the code isn't even really in play, IINM:
> >> it's dead/unreachable and/or redundant/irrelevant. So my proposed fix would
> >> be to just excise it.
> >>
> >> Or am I missing something?
> >>
> > --
> >
> > ---
> > You received this message because you are subscribed to a topic in the
> > Google Groups "Ledger" group.
> > To unsubscribe from this topic, visit
> > https://groups.google.com/d/topic/ledger-cli/bd8v3wiU6oo/unsubscribe.
> > To unsubscribe from this group and all its topics, 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/3adce81c-454d-4279-a9e2-4851cd38ccd8n%40googlegroups.com
> > <https://groups.google.com/d/msgid/ledger-cli/3adce81c-454d-4279-a9e2-4851cd38ccd8n%40googlegroups.com?utm_medium=email_source=footer>
> > .
> >
> 
> -- 
> 
> --- 
> 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/CACHqOS8xmnFyaa8h3OAEFnEbCP9BxDw98EuqEzzmTY9gsHzuMQ%40mail.gmail.com.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YSNcM7lV2utjyYP1%40jirafa.cyrius.com.


Re: Plans for the next release

2021-08-04 Thread Martin Michlmayr
* Martin Michlmayr  [2021-08-04 20:00]:
> There's (at least) one issue I wanted to investigate, though.
> Namely #1952 (which incidentally involves you!).  It wasn't clear to
> me whether the new behaviour was a regression, but it sounds like it's
> an improvement. (In any case, the docs should be updated).

Actually, there's also
https://github.com/ledger/ledger/issues/1020

If this is changed, imho it should be changed before 3.3.

Maybe those using --flat and --depth can comment on this ticket, but
to me it looks like the behaviour should be changed.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YQqEwlPANR%2BWM6r%2B%40jirafa.cyrius.com.


Re: Plans for the next release

2021-08-04 Thread Martin Michlmayr
* Martin Michlmayr  [2021-08-04 20:00]:
> I use GitHub milestones to track outstanding blockers, although
> at the moment none of these are real blockers (I mean, they kinda are,
> but they've been there for a while so we can live with them):
> https://github.com/ledger/ledger/milestones

We have:

CMake warning about deprecated policy related to RPATH
https://github.com/ledger/ledger/issues/1721

If someone who understand this could comment and/or submit a patch,
that would be very welcome.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YQqCCJ1upFc5tQ7t%40jirafa.cyrius.com.


Re: Plans for the next release

2021-08-04 Thread Martin Michlmayr
* Rahix  [2021-08-04 13:42]:
> Ledger version 3.2.1 was released on 2020-05-18 which is well over a
> year ago by now.  There have been a bunch of useful features and bug
> fixes added to the development tree since then.  What's the plan for
> a new release?  Is there anything still blocking it which needs to
> be resolved?

I was planning to coordinate a new release a few months ago but I've
been too busy with other things.

I use GitHub milestones to track outstanding blockers, although
at the moment none of these are real blockers (I mean, they kinda are,
but they've been there for a while so we can live with them):
https://github.com/ledger/ledger/milestones

There's (at least) one issue I wanted to investigate, though.
Namely #1952 (which incidentally involves you!).  It wasn't clear to
me whether the new behaviour was a regression, but it sounds like it's
an improvement. (In any case, the docs should be updated).

> Along the same lines, what do you think about adding a CHANGELOG.md or
> NEWS file where new features & bug fixes since the last release are
> described in a user-friendly format?  If the idea is generally welcome,
> I'd volunteer to start writing it for the next release :)

There's actually doc/NEWS.md.  If you want to update and maybe work
on #1952, I'd definitely appreciate it.

I am not aware of any outstanding blockers.  If anyone does, please
speak up now.
-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YQqBUiQJ0cYD/Yn3%40jirafa.cyrius.com.


GitHub workflows for ledger CI - help required

2021-07-08 Thread Martin Michlmayr
Can someone submit a working GitHub workflows file for ledger CI
to replace Travis.  Bonus points for building on Linux, macOS and
Windows.

(I think testing only Python 3 support is enough.  Travis currently
tests Python 2 and 3)
-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YOak4QA/au76iGHl%40jirafa.cyrius.com.


Re: Wrong entry pointed out in "Too many commas in amount" error message

2021-06-15 Thread Martin Michlmayr
* Perl Ancar  [2021-06-07 04:34]:
> > 2021/01/06 entry4 
> > assets:cash:savings:bca 1 IDR 
> > assets:cash:dana 
> 
> What command do you use to show how Ledger parses a file, like the above?

I'm not sure.  What I meant is to run "ledger reg" on the example I
provided.  It would have shown how it's processed.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YMhZHPQCKuos7AqZ%40jirafa.cyrius.com.


Re: Wrong entry pointed out in "Too many commas in amount" error message

2021-06-04 Thread Martin Michlmayr
* Perl Ancar  [2021-06-04 05:47]:
> ledger points out the wrong entry (probably the next entry with
> multiple commas) when there is a misplaced comma. Example:

Ledger uses the first entry to figure out the format, so if the first
entry is wrong you don't have a guarantee where an error will occur.

Look at the ledger output for these to see how ledger interprets your
format:

2021/01/06 entry1
 assets:cash:savings:bca  200, IDR
 assets:cash:dana

2021/01/06 entry2
 assets:cash:savings:bca  100,000 IDR
 assets:cash:dana

2021/01/06 entry4
 assets:cash:savings:bca  1 IDR
 assets:cash:dana

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/YLosfeoZQ5rbzSg5%40jirafa.cyrius.com.


Re: Trying to understand ledger bal

2021-04-15 Thread Martin Michlmayr
* Oliver Hardy  [2021-04-15 07:37]:
> 2021/01/01 * Opening balance
> Assets:Checking $1,669.73
> Liabilities:Credit_Card -$1,929.46
> Equity:Opening Balance

Postings must have a space at the beginning:

2021/01/01 * Opening balance
  Assets:Checking   $1,669.73
  Liabilities:Credit_Card   -$1,929.46
  Equity:Opening Balance

And account names and amounts need to be separated by either two
spaces (or more) or a tab (or more).

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210415145038.GA20408%40jirafa.cyrius.com.


Re: Trying to understand ledger bal

2021-04-15 Thread Martin Michlmayr
* Oliver Hardy  [2021-04-15 06:25]:
> My ~/ledger.dat file so far:
> Assets:Checking: $1,669.73
> Liabilities:Credit_Card: $1,929.46
> Equity:Opening Balance

This is not valid syntax.  Unfortunately ledger ignores invalid
syntax.

You want:

2021/01/01 * Opening balance
Assets:Checking$1,669.73
Liabilities:Credit_Card   -$1,929.46
Equity:Opening Balance

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210415135344.GC6190%40jirafa.cyrius.com.


ledger2beancount 2.6: ledger-to-beancount converter

2021-04-14 Thread Martin Michlmayr
I released version 2.6 of ledger2beancount, the ledger-to-beancount
converter.

You can get ledger2beancount from GitHub:
https://github.com/beancount/ledger2beancount

Here are the changes in 2.6:

* Round calculated total if needed for `price==cost` comparison
* Add `narration_tag` config variable to set narration from metadata
* Retain unconsummated payee/payer metadata
* Ensure UTF-8 output and assume UTF-8 input
* Document UTF-8 issue on Windows systems
* Add option to move posting-level tags to the transaction itself
* Add support for the `alias` sub-directive of `account` declarations
* Add support for the `payee` sub-directive of `account` declarations
* Support configuration file called `.ledger2beancount.yaml`
* Fix uninitialised value warning in hledger mode
* Print warning if account in assertion has sub-accounts
* Set commodity for commodity-less balance assertion
* Expand path name of `beancount_header` config variable
* Document handling of buckets
* Document pre- and post-processing examples
* Add `Dockerfile` to create Docker image

Thanks to Alexander Baier, Daniele Nicolodi, and GitHub users
bratekarate, faaafo and mefromthepast for various bug reports and
other input.

Thanks to Dennis Lee for adding a Dockerfile and to Vinod Kurup
for fixing a bug.

Thanks to Stefano Zacchiroli for testing.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210415050800.GA17347%40jirafa.cyrius.com.


Re: Getting philosophical: Expenses vs Assets

2021-03-30 Thread Martin Michlmayr
* o1bigtenor  [2021-03-30 15:02]:
> > “Asset is a resource available to a business that gives it some form of 
> > economic benefit in the future.”
...
> There is no way to make money with it, generally, without selling it.
> 
> Not a popular opinion but it does follow that above definition.

I think you're equating "economic benefit" with "income".

You *do* get an economic benefit from a house -- you get a place to
stay which would normally cost $$$ to rent.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210331020112.GA23995%40jirafa.cyrius.com.


Re: prioritize pricedb over last purchase price?

2021-03-24 Thread Martin Michlmayr
* Jim Robinson  [2021-03-24 06:26]:
> Is there a way for us to tell ledger to prefer the pricedb value
> over the @@ purchase value in an entry?

No, but you could turn the @@ purchase value into a (@@) virtual cost,
which means it won't be entered into the pricedb.

https://www.ledger-cli.org/3.0/doc/ledger3.html#Virtual-posting-costs

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210324135941.GC6255%40jirafa.cyrius.com.


Re: Monthly investment report

2021-03-04 Thread Martin Michlmayr
* Dániel Fancsali  [2021-03-03 15:02]:
> I managed to get ledger to group the register by month, but cannot
> get it to do "balance at the end of the month for the months from X
> to Y"
> 
> Am I doing something wrong, or is this something that's not possible
> with ledger atm?

I'm not sure, but is there a reason you can't call ledger several
times, e.g.

ledger bal -p "until 2021-02-01"
ledger bal -p "until 2021-03-01"
ledger bal -p "until 2021-04-01"
...

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210304091014.GB17214%40jirafa.cyrius.com.


Re: Summable account balances

2021-02-22 Thread Martin Michlmayr
* Dan Sladden  [2021-02-22 05:36]:
> But with --flat --no-total I get this:
>$-150  Assets:Cash
> $150  Assets:One
>  $50  Assets:One:Two
> which doesn't because the balance for Assets:One includes that of
> Assets:One:Two.

This is imho a bug in --flat.  I ran into this recently and opened
this issue:
https://github.com/ledger/ledger/issues/1987

As a workaround, you could run multiple ledger bal commands
and combine the output into one file.  You would run:
  ledger bal ACCOUNT$
The $ indicating end of string, i.e. without subaccounts.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210223013501.GD3650%40jirafa.cyrius.com.


Re: print a tag value

2021-02-09 Thread Martin Michlmayr
* acer  [2021-02-09 18:50]:
> How do I print the value of num in the report?  When trying
> 
> reg --format " %(num) \\n"

reg --format " %(tag('num')) \\n"

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210210030954.GA4568%40jirafa.cyrius.com.


Re: Arithmetic

2021-02-08 Thread Martin Michlmayr
* Richard Lawrence  [2021-02-08 09:39]:
> Dan, what version are you running? Can anyone test on a more recent version?

It's a confirmed bug.

> It's also strange that ledger does not throw an error or complain or
> anything about the second transaction. It's as if it's simply blind to
> it.

The subtraction is incorrectly calculated as 0, so there's no error,
but since the transaction is 0 it's not shown.  You can add --empty
to see it.

https://github.com/ledger/ledger/issues/2001
which as it turns out was reported back in 2019:
https://github.com/ledger/ledger/issues/1809

If someone wants to submit a fix, that'd be great!
-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210208092756.GJ9486%40jirafa.cyrius.com.


Re: Arithmetic

2021-02-07 Thread Martin Michlmayr
* Dan Sladden  [2021-02-07 05:03]:
> but this (without the space before the minus sign) doesn't:
> 
> 2020/01/01 Doesn't work
> Assets:Cash(£10*(3-1))
> Equity

Sounds like a parsing issue.  What's particularly bad is that the
transaction is silenty ignored.

Please file an issue at https://github.com/ledger/ledger/issues/

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210208015756.GC24709%40jirafa.cyrius.com.


Re: Matching trades with complex tax rules

2021-02-07 Thread Martin Michlmayr
* Dan Sladden  [2021-02-07 04:59]:
> 2019/03/01 Sell
> Assets:Investments-8 AAA ; @ £15.00

This is wrong already.  Unfortunately, you'll have to specify the
exact lot; run
ledger bal Assets:Investments --lots
on your example to see the problem -- you shouldn't have any lots
in red.

Unfortunately, I'm not aware of any way to automate it in ledger
and you'll have to specify the right lots manually.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210208015554.GB24709%40jirafa.cyrius.com.


Re: Did not get the correct result, bal -e

2021-02-03 Thread Martin Michlmayr
* 老革命  [2021-02-03 00:05]:
> bal Stock -X $ -e 01/03
> The result is $4.00
> Not the expected result $10.00
> 
> -e Limit the processing to transactions before 01/03,is 01/02
> but price on 01/03

You need:
-e 2021/01/03 --now 2021/01/02

--end/-e only limits when transactions end, but pricedb entries from
later transactions are still evaluated and you need --now to value
at that day rather than now.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210204012037.GA23576%40jirafa.cyrius.com.


Planning new ledger release

2021-02-02 Thread Martin Michlmayr
I think it's time to make a new ledger release as there have been
a number of fixes and features since 3.2.1.

If anyone has outstanding patches or is aware of any show stoppers,
please speak up now.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210202103001.GB16736%40jirafa.cyrius.com.


Re: Comprehension Question price-db

2021-01-26 Thread Martin Michlmayr
* henry atts  [2021-01-26 23:56]:
> Later on with changed stock values set in the price-db file the
> output of `ledger bal assets' balances only to zero with the -B or
> -H option, otherwise there will always be a remainder.

That's normal.  Only -B is supposed to be zero.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210127075801.GC633%40jirafa.cyrius.com.


Re: price-db overwrites stock price set with @

2021-01-23 Thread Martin Michlmayr
* Remco Rijnders  [2021-01-23 05:42]:
> Do you get the expected result with a booking more like this?:
> 
> 2021/01/20 stocks
> Assets:Bank:Checking  €3000.00
> Assets:Brokerage  -30 "XXX" @  €100.00

Note that when selling, you should also specify the cost base (and
probably the date) of what you're selling.

In the example:

2020/08/08 Buy stocks
Assets:Brokerage   30 "XXX" @  €80.00
Assets:Bank:Checking-€2400.00

2021/01/20 Sell stocks
Assets:Bank:Checking  €3000.00
Assets:Brokerage-30 "XXX" {€80.00} [2020-08-08] @  €100.00
Income:Capital gains -€600

You can do:
ledger bal Assets:Brokerage --lots
If you see something in red, you know there's a problem.

With the original example:

$ ledger -f d bal broker --empty
   0  Assets:Brokerage
$ ledger -f d bal broker --lots
30 XXX {€80.00} [2020-08-08]
-30 XXX {€100.00} [2021-01-20]  Assets:Brokerage

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210124054222.GP5139%40jirafa.cyrius.com.


Re: Using the --strict option

2021-01-01 Thread Martin Michlmayr
* Oliver Hardy  [2021-01-01 14:21]:
> I have a file ~/.ledgerrc:
> --file /home/ohardy/.ledger.dat
> --file /home/ohardy/Accounts

Files are included in the order given, so you have to specify the
file with the account definitions first.

> I have an alias set up in ~/.aliases:
> alias ledger='ledger -i ~/.ledgerrc

This is redundant since ledger looks for ~/.ledgerrc automatically.

> and that '$' is an unknown commodity.

You have to declare it with:

commodity $

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20210102010450.GA29099%40jirafa.cyrius.com.


Re: Filter transactions based on auxdate but display normal date

2020-12-30 Thread Martin Michlmayr
* Shredder  [2020-12-30 10:23]:
> I'm still getting problems as not all of my transactions contain aux_dates, 
> which results in this error:
> 
> While comparing if  is less than 2020/12/22:

Oh yes, interesting.

This seems to work:

ledger -f d reg -l "(aux_date or date) >= [2020-10-11]"

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20201231023734.GA23198%40jirafa.cyrius.com.


Re: Filter for transactions/postings that are cleared OR pending

2020-12-29 Thread Martin Michlmayr
* Shredder  [2020-12-29 09:30]:
> For a report use case, however, I would like to filter in a way that
> transactions/postings that are cleared (*) or pending (!) are
> considered and only transactions that are neither ( ) are discarded.
> Is there a way to achieve that?

-l "not cleared and not pending"

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20201230033824.GC20423%40jirafa.cyrius.com.


Re: Filter transactions based on auxdate but display normal date

2020-12-29 Thread Martin Michlmayr
* Shredder  [2020-12-29 09:43]:
> I would like to filter transactions based on the auxdate (effective
> date), i.e. use something equivalent to -b [Date] and -e [Date], but
> for the auxdate. I am not using the --aux-date/--effective option
> because I would still like to display the normal date in the report
> output. Do you have any ideas what would be the best way to achieve
> this?

ledger -f d reg -l "aux_date >= [2020-10-02]"

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20201230033451.GB20423%40jirafa.cyrius.com.


Re: How could you calculate tax in your transaction?

2020-12-29 Thread Martin Michlmayr
* Yuri Khan  [2020-12-30 02:26]:
> Then maybe round first, negate second?
> 
> = /^Pizza:/
> Pizza:Taxes  (roundto(amount * 0.0775, 2))
> CreditCard  (-roundto(amount * 0.0775, 2))

Good idea!

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20201230033225.GA20423%40jirafa.cyrius.com.


Re: Filter by acount and related account

2020-12-29 Thread Martin Michlmayr
* Martin Michlmayr  [2020-12-29 21:09]:
> reg Expenses:Entertainment:Streaming -l "any(account =~ /Liabilities:Credit 
> Card:VISA/)"
> 
> > I tried using the -r and --limit option, but it did not work.
> 
> No, you need: any(account =~ /.../)

Just to make this clearer.  Let's say you have a transaction with two
postings, accounts A and B.

reg A --related/-r *shows* the other account (B), but the query is on A

with any(), you query on A (reg A), but you can additionally require
that at least one account in the transaction involves B.

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20201229132533.GD17251%40jirafa.cyrius.com.


Re: How could you calculate tax in your transaction?

2020-12-29 Thread Martin Michlmayr
* Martin Michlmayr  [2020-12-24 13:43]:
> = /^Pizza:/
> Pizza:Taxes   (roundto(amount * 0.0775, 2))
> CreditCard(roundto(-amount * 0.0775, 2))
> 
> This does what you want.

> Unfortunately, it leads to an error due to a bug, but if you e.g.
> change the tax rate from 0.0775 to 0.0774 it works.

I've now reported that issue:
https://github.com/ledger/ledger/issues/1983
-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20201229131843.GC17251%40jirafa.cyrius.com.


Re: Error: Automated transaction's posting has no amount

2020-12-29 Thread Martin Michlmayr
* Ismael Bouya  [2020-12-29 12:56]:
> This will only solve part of the issue. There are other issues that
> will come then. If I take a relevant part:

Yes, I was only addressing the problematic part.

It should be:

= /Expenses:Grocery/ and %split_mate
  $account (amount * -0.5)
  Assets:Mate  (amount * 0.5)

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
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/20201229131316.GB17251%40jirafa.cyrius.com.


  1   2   3   4   5   >