Re: How to record and keep track of stock share ?

2014-06-20 Thread Jostein Berntsen


On Thursday, June 19, 2014 12:30:37 AM UTC+2, Jostein Berntsen wrote:

 On 11.06.14,22:10, Christophe Schockaert wrote: 
  Hi all, 
  

  

  
  So, what's the status for this question ? 
  
   2) The left-over for Share B shows 260€, which does not render the 
 fact that 
  I still have 3 plain stocks, which would at least value 300€ (from 
 their 
  initial value), or 360€ for the current value. 
  
  In the documentation example, everything was sold at one time, so we are 
 not in 
  the same situation. 
  
   3) I would like to have a view of the left-over value of the stocks, at 
 time 
  t. In case A, the total still show 800€ which is the initial 
 value, 
  and in case B, I see 560€, which reflects the 800€-240€, but not 
 the 
  sum of the 10 ShareA and the 3 remaining ShareB. 
  
  I understand that it shows what it has to show, but I would like to know 
 how to 
  set things up, so that I can see what I described there. 
  
  I also tried to play with lines like: 
  P 2014-01-01 00:00:00   ShareB 100€ 
  P 2014-04-01 00:00:00   ShareB 120€ 
  
  In that case, I can toggle the display of share or values with the 
 option -V, 
  which gets close to what I want. 
  
  However, I run into other issues, mainly that it only uses the last 
 value, even 
  for the initial value, and if I mix the notation in plain shares (-2 
 ShareB) 
  and the notation with attributed values (-2 ShareB {100€} @ 120€), they 
 don't 
  get along very well. 
  
  So, I prefered to narrow things down and start with my first two 
 examples. 
  
  Thank you for having the patience to read that all way through. 
  
  Do you have any clues or advices so I can get a clear view of stocks in 
 my 
  files, in accountancy terms, and with ledger in particular ? 
  
  Any help will be appreciated, 
  Thanks in advance, 
  
  Christophe S. 

 Can you try this way to do it? 

 dat file: 

 ; Initial openings at 2014/01/012014-01-01 Opening Balance 
   Assets:Bank:Check Account  5000,00 € 
   Equity:Opening Balance 


 ; Details of shares at 2014/01/01 
 ;P 2014-01-01 00:00:00   ShareA 20€ 
 ;P 2014-01-01 00:00:00   ShareB 100€ 
 2014-01-01 Details for shares 
   Equity:Opening Balance:Initial Investments 
   Assets:Investments:Stocks:ShareA15 ShareA @ 20€ 
   Assets:Investments:Stocks:ShareB5 ShareB @ 100€ 

 ; Selling 2 ShareB at 2014/04/01 
 2014-04-01 Selling 2 ShareB 
   Assets:Investments:Stocks:ShareB -2 ShareB @ 100€ 
   Assets:SoldStocks:SoldB2 ShareB @ 120€ 
  Income:Investment Gains 

 ; Selling 2 ShareB at 2014/04/01 
 2014-04-02 Selling 4 ShareA 
   Assets:Investments:Stocks:ShareA -4 ShareA @ 20€ 
   Assets:SoldStocks:SoldA4 ShareA @ 30€ 
  Income:Investment Gains 

 Output: 

 jostein:~/Documents/Finans/ledger/testing$ ledger -B bal -f testshares.dat 
5880,00 €  Assets 
5000,00 €Bank:Check Account 
 520,00 €Investments:Stocks 
 220,00 €  ShareA 
 300,00 €  ShareB 
 360,00 €SoldStocks 
 120,00 €  SoldA 
 240,00 €  SoldB 
   -5800,00 €  Equity:Opening Balance 
-800,00 €Initial Investments 
 -80,00 €  Income:Investment Gains 
  
0 

 jostein:~/Documents/Finans/ledger/testing$ ledger -V bal -f testshares.dat 
6050,00 €  Assets 
5000,00 €Bank:Check Account 
 690,00 €Investments:Stocks 
 330,00 €  ShareA 
 360,00 €  ShareB 
 360,00 €SoldStocks 
 120,00 €  SoldA 
 240,00 €  SoldB 
   -5800,00 €  Equity:Opening Balance 
-800,00 €Initial Investments 
 -80,00 €  Income:Investment Gains 
  
 170,00 € 




Martin: Does this seem right for you?

Jostein 

-- 

--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: How to record and keep track of stock share ?

2014-06-20 Thread Martin Michlmayr
* Jostein Berntsen jber...@broadpark.no [2014-06-20 04:26]:
  ; Selling 2 ShareB at 2014/04/01 
  2014-04-01 Selling 2 ShareB 
Assets:Investments:Stocks:ShareB -2 ShareB @ 100€ 
Assets:SoldStocks:SoldB2 ShareB @ 120€ 
   Income:Investment Gains 
 
 Martin: Does this seem right for you?

I'm not sure what Assets:SoldStocks:SoldB is for.  If you're selling
two stocks for cash, you get cash; but in your example, you still have
those 2 stocks as an asset:

ledger -f qq bal Assets:SoldStocks:SoldB
2 ShareB  Assets:SoldStocks:SoldB

What you want is this:

; Initial openings at 2014/01/01
2014-01-01 Opening Balance
  Assets:Bank:Check Account  5000,00 €
  Equity:Opening Balance

; Details of shares at 2014/01/01
;P 2014-01-01 00:00:00   ShareA 20€
;P 2014-01-01 00:00:00   ShareB 100€
2014-01-01 Details for shares
  Equity:Opening Balance:Initial Investments
  Assets:Investments:Stocks:ShareA15 ShareA @ 20€
  Assets:Investments:Stocks:ShareB5 ShareB @ 100€

; Selling 2 ShareB at 2014/04/01
2014-04-01 Selling 2 ShareB
  Assets:Investments:Stocks:ShareB -2 ShareB {100€} @ 120€
  Assets:Cash   240€
  Income:Investment Gains   -40€

; Selling 2 ShareB at 2014/04/01
2014-04-02 Selling 4 ShareA
  Assets:Investments:Stocks:ShareA -4 ShareA {20€} @ 30€
  Assets:Cash   120€
  Income:Investment Gains   -40€

-- 
Martin Michlmayr
http://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.
For more options, visit https://groups.google.com/d/optout.


Re: xact doesn't return anything?

2014-06-20 Thread Martin Michlmayr
* Eric Abrahamsen e...@ericabrahamsen.net [2014-06-19 22:05]:
 ledger --sort=d --cleared xact starbucks
 
 Gives me the blank line. Is this because of the particular flags I've
 got in my config file, or because xact isn't meant to take any
 command-line flags?

The problem is that the transaction generated by xact is not cleared
but you specify --cleared, which means that uncleared transactions are
not shown.

Maybe xact should ignore --cleared.  Doesn't seem to make much sense,
but who knows.
-- 
Martin Michlmayr
http://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.
For more options, visit https://groups.google.com/d/optout.


Re: How to add new command line option to ledger?

2014-06-20 Thread tripun goel


On Thursday, 19 June 2014 17:43:30 UTC+5:30, Martin Michlmayr wrote:

 * Martin Michlmayr t...@cyrius.com javascript: [2014-06-18 20:57]: 
  I don't know, and maybe this is the right place to implement it... but 
  I'm wondering if the rounding shouldn't take place somewhere in 
  src/amount.cc. 

 Now that I think about it some more, aren't all rounding problems 
 we've encountered so far related to valuing one commodity in terms of 
 another?  If so, you'd need to find where this is done and implement 
 rounding there. 



I am debugging using code amount. The amount is converted to rational after 
parsing. No case of rounding.  All calculations performed likewise, 
changing this is very radical. I will follow up with this and post more 
information on this.


 -- 
 Martin Michlmayr 
 http://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.
For more options, visit https://groups.google.com/d/optout.


Re: fixed price commodity value conversion

2014-06-20 Thread Martin Michlmayr
* 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/

-- 

--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: fixed price commodity value conversion

2014-06-20 Thread tripun goel
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:Brokerage10 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+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 

--- 
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.
For more options, visit https://groups.google.com/d/optout.


cc1plus: error: unrecognized command line option ‘-std=c++11’

2014-06-20 Thread Héctor A . Abreu
Hi,

I'm trying to install Ledger on a Raspberry Pi. I'm following instructions 
from https://github.com/ledger/ledger/ , installed dependencies for Debian 
Wheezy, but running ./acprep update will give me the following message:

[  1%] Generating ../system.hh.gch
cc1plus: error: unrecognized command line option ‘-std=c++11’
make[2]: *** [system.hh.gch] Error 1
make[1]: *** [src/CMakeFiles/libledger.dir/all] Error 2
make: *** [all] Error 2
acprep: ERROR: Execution failed: make

I googled the message and read that it's probably related to the GCC, that 
it must be 4.7, but I think Debian Wheezy has 4.6. I also read that 
-std=c++11 can be replaced for something else to make it work. I am not 
sure of anything of this, please help.

Thank you in advance.

-- 

--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: cc1plus: error: unrecognized command line option ‘-std=c++11’

2014-06-20 Thread Johann Klähn
You could try -std=c++0x or -std=gnu++0x
On Jun 20, 2014 6:11 PM, Héctor A. Abreu 
hector.ab...@spanishconnector.com wrote:

 Hi,

 I'm trying to install Ledger on a Raspberry Pi. I'm following instructions
 from https://github.com/ledger/ledger/ , installed dependencies for
 Debian Wheezy, but running ./acprep update will give me the following
 message:

 [  1%] Generating ../system.hh.gch
 cc1plus: error: unrecognized command line option ‘-std=c++11’
 make[2]: *** [system.hh.gch] Error 1
 make[1]: *** [src/CMakeFiles/libledger.dir/all] Error 2
 make: *** [all] Error 2
 acprep: ERROR: Execution failed: make

 I googled the message and read that it's probably related to the GCC, that
 it must be 4.7, but I think Debian Wheezy has 4.6. I also read that
 -std=c++11 can be replaced for something else to make it work. I am not
 sure of anything of this, please help.

 Thank you in advance.

 --

 ---
 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.
 For more options, visit https://groups.google.com/d/optout.


-- 

--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: cc1plus: error: unrecognized command line option ‘-std=c++11’

2014-06-20 Thread Martin Michlmayr
* Héctor A. Abreu hector.ab...@spanishconnector.com [2014-06-19 15:24]:
 [  1%] Generating ../system.hh.gch
 cc1plus: error: unrecognized command line option ‘-std=c++11’
 make[2]: *** [system.hh.gch] Error 1
 make[1]: *** [src/CMakeFiles/libledger.dir/all] Error 2
 make: *** [all] Error 2
 acprep: ERROR: Execution failed: make
 
 I googled the message and read that it's probably related to the GCC, that 
 it must be 4.7, but I think Debian Wheezy has 4.6. I also read that 
 -std=c++11 can be replaced for something else to make it work. I am not 
 sure of anything of this, please help.

FWIW, it works for me on Debian wheezy but I'm on amd64 which has GCC 4.7.
I see you're on ARM which has 4.6:

4:4.7.2-1: amd64 i386 kfreebsd-amd64 kfreebsd-i386
4:4.6.3-8: armel armhf ia64 mips mipsel powerpc s390 s390x sparc

-- 
Martin Michlmayr
http://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.
For more options, visit https://groups.google.com/d/optout.


Re: xact doesn't return anything?

2014-06-20 Thread Eric Abrahamsen
Martin Michlmayr t...@cyrius.com writes:

 * Eric Abrahamsen e...@ericabrahamsen.net [2014-06-19 22:05]:
 ledger --sort=d --cleared xact starbucks
 
 Gives me the blank line. Is this because of the particular flags I've
 got in my config file, or because xact isn't meant to take any
 command-line flags?

 The problem is that the transaction generated by xact is not cleared
 but you specify --cleared, which means that uncleared transactions are
 not shown.

 Maybe xact should ignore --cleared.  Doesn't seem to make much sense,
 but who knows.

Aha! Thanks for that. Specifying -U or --uncleared for the ledger xact
command, with my rc file in place, still doesn't give me any results --
I would have expected the command-line switch to override the rc file
directive. Anyway, at least I know what the problem is, thank you! I'll
remove --cleared from the rc file for now: it was only a minor
convenience anyway.

E

-- 

--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: How to record and keep track of stock share ?

2014-06-20 Thread Martin Blais
On Fri, Jun 20, 2014 at 8:50 AM, Martin Michlmayr t...@cyrius.com wrote:

 * Jostein Berntsen jber...@broadpark.no [2014-06-20 04:26]:
   ; Selling 2 ShareB at 2014/04/01
   2014-04-01 Selling 2 ShareB
 Assets:Investments:Stocks:ShareB -2 ShareB @ 100€
 Assets:SoldStocks:SoldB2 ShareB @ 120€
Income:Investment Gains
  
  Martin: Does this seem right for you?

 I'm not sure what Assets:SoldStocks:SoldB is for.  If you're selling
 two stocks for cash, you get cash; but in your example, you still have
 those 2 stocks as an asset:

 ledger -f qq bal Assets:SoldStocks:SoldB
 2 ShareB  Assets:SoldStocks:SoldB


That's indeed incorrect.
You don't have the assets anymore, you surely don't want them to show up on
the balance sheet.



What you want is this:

 ; Initial openings at 2014/01/01
 2014-01-01 Opening Balance
   Assets:Bank:Check Account  5000,00 €
   Equity:Opening Balance

 ; Details of shares at 2014/01/01
 ;P 2014-01-01 00:00:00   ShareA 20€
 ;P 2014-01-01 00:00:00   ShareB 100€
 2014-01-01 Details for shares
   Equity:Opening Balance:Initial Investments
   Assets:Investments:Stocks:ShareA15 ShareA @ 20€
   Assets:Investments:Stocks:ShareB5 ShareB @ 100€

 ; Selling 2 ShareB at 2014/04/01
 2014-04-01 Selling 2 ShareB
   Assets:Investments:Stocks:ShareB -2 ShareB {100€} @ 120€
   Assets:Cash   240€
   Income:Investment Gains   -40€

 ; Selling 2 ShareB at 2014/04/01
 2014-04-02 Selling 4 ShareA
   Assets:Investments:Stocks:ShareA -4 ShareA {20€} @ 30€
   Assets:Cash   120€
   Income:Investment Gains   -40€


What I think has been confusing some people is that the 120E and 30E values
above are [correctly] ignored (with your patch).

They are going to be ignored, other than for adding an entry to the price
DB, right?
If not, how are they going to be used?

-- 

--- 
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.
For more options, visit https://groups.google.com/d/optout.