fixed price commodity value conversion

48 views
Skip to first unread message

tripun goel

unread,
Jun 20, 2014, 10:09:50 AM6/20/14
to ledge...@googlegroups.com
This works perfectly. 

2014-06-18
  A        -1 EUR  @ $1.00
  A        -1 CAD  @ $1.00
  C        $2.00

for -V bal
              $-2.00  A
               $2.00  C
--------------------
                   0

but when I use fixed price I get an error
2014-06-18
  A        -1 EUR  {=$1.00}
  A        -1 CAD  {=$1.00}
  C        $2.00
 
 
 
for -V bal or simply bal

While parsing file "test.txt", line 5:
While balancing transaction from "test.txt", lines 1-5:
> 2014-06-18
>   A           -1 EUR  {=$1.00}
>   A           -1 CAD  {=$1.00}
>   C           $2.00
>  
Unbalanced remainder is:
               $2.00
     -1 CAD {=$1.00}
     -1 EUR {=$1.00}
Amount to balance against:
               $2.00
Error: Transaction does not balance
 
A bug (992) is already opened  but that is another issue or may be arising of this. When I debug both cases using code amount. the parsing is fine but when I use code commodity,price.  the value conversion is working fine for market price but there is not even a single debug message in case of fixed price and it simply fails.
debug text : https://gitorious.org/ledger/npo-ledger-cli/source/5037c020666a099131a7464bb07549199fad78da:rounding/bug_reports/992_debug.txt

Error also occur for this
2014-06-18
  A        -1 EUR  {=$1.00}
  A        -1 CAD  {=$1.00}
  C        -1 EUR  @ $1.00
  C        -1 CAD  @ $1.00
 
The point is when value conversion is accepted for market price then it should work in case of fixed price too. There is no precision problem here. Is it something I am missing?


 
 

Martin Michlmayr

unread,
Jun 20, 2014, 10:18:46 AM6/20/14
to ledge...@googlegroups.com
* tripun goel <tri...@gmail.com> [2014-06-20 07:09]:
> 2014-06-18
> A -1 EUR @ $1.00
> A -1 CAD @ $1.00

Here you specify @

> but when I use fixed price I get an error
> 2014-06-18
> A -1 EUR {=$1.00}
> A -1 CAD {=$1.00}

... here you don't. If you add @ $1.00, then it'll work.

> The point is when value conversion is accepted for market price then
> it should work in case of fixed price too. There is no precision
> problem here. Is it something I am missing?

This was brought up before and John seemed to agree that something
like
-1 CAD {=$1.00}
should be treated as
-1 CAD {=$1.00} @ $1.00

There are two bugs open about this issue:

http://bugs.ledger-cli.org/show_bug.cgi?id=630
http://bugs.ledger-cli.org/show_bug.cgi?id=1021

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

tripun goel

unread,
Jun 20, 2014, 10:37:00 AM6/20/14
to ledge...@googlegroups.com
On Fri, Jun 20, 2014 at 7:48 PM, Martin Michlmayr <t...@cyrius.com> wrote:


> but when I use fixed price I get an error
> 2014-06-18
>   A        -1 EUR  {=$1.00}
>   A        -1 CAD  {=$1.00}

... here you don't.  If you add @ $1.00, then it'll work.

I know , but this is a work around.
Even there is an example on documentation page that fails !
2012-04-10 My Broker
    Assets:Brokerage            10 AAPL {=$50.00}
    Assets:Brokerage:Cash       $750.00


> The point is when value conversion is accepted for market price then
> it should work in case of fixed price too. There is no precision
> problem here.  Is it something I am missing?

This was brought up before and John seemed to agree that something
like
 -1 CAD  {=$1.00}
should be treated as
 -1 CAD  {=$1.00} @ $1.00

There are two bugs open about this issue:

http://bugs.ledger-cli.org/show_bug.cgi?id=630
http://bugs.ledger-cli.org/show_bug.cgi?id=1021
 Yes these bugs point it out. But I feel it is crashing altogether. '=' sign should update price db if @ lot price is not mentioned.  It does not reach the commodity price tag while debugging.

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

--

---
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/FNDxZWk7lTU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ledger-cli+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages