Re: shortcuts for entering dates in emacs?

2017-08-03 Thread Yuri Khan
On Fri, Aug 4, 2017 at 1:55 AM, Marcin Borkowski  wrote:

>> - making it faster in emacs to enter dates (other than today, I already
>> have an insert current date keybinding)?
>
> How about org-read-date?

It’s a good facility, however, from its docstring:

Furthermore, the command prefers the future,
so if you are giving a date where the year is not given, and the day-month
combination is already past in the current year, it will assume you
mean next year.

This makes sense when planning future events as might be the primary
use case with org-mode; but my gut feeling is that in ledger-mode one
normally records past events, so the opposite logic should apply.

-- 

--- 
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.


How do I obtain the "lot price"?

2017-08-03 Thread Bob Hossley
Thanks for any help you can give me.



*Question about Report Format String*The "lot price" (the price of one 
share) is shown in curly braces by the format string parameter %(amount).  
But I have been unable to obtain just the "lot price" using a format string 
parameter.  I suspect that %(price) was intended to be the "lot price" and 
that it is a bug that it displays the %(cost) instead.

*Question about the Ledger Python Extension*

How do you obtain the "lot price" using the Ledger Python Extension?

I suspect that either post.price or post.amount.price should be the "lot 
price" and that it is a bug that neither exists.



*File lots.ledger*Attached is lots.ledger, a small test journal that shows 
the problem:

2008-02-19 (0) SPDR Lehman Int'l  Tres. Bond ETF - Buy 100 shares
> Assets:Vanguard Trust Account:Vanguard Investments: Bonds:Taxable:SPDR 
> Barclays Int'l Bond ETF  BWX 200. @ $27.25
> Expenses:Investment Expenses:Commissions:Vanguard $2.18
> * Assets:Vanguard Trust Account:Cash - Vanguard California Tax-Free 
> MMF$-5,452.18
>
> 2008-02-19 (1) SPDR Lehman Int'l  Tres. Bond ETF - Buy 117 shares
> Assets:Vanguard Trust Account:Vanguard Investments: Bonds:Taxable:SPDR 
> Barclays Int'l Bond ETF  BWX 234. @ $27.24995726
> Expenses:Investment Expenses:Commissions:Vanguard $2.56
> * Assets:Vanguard Trust Account:Cash - Vanguard California Tax-Free 
> MMF$-6,379.05
>
> 2008-02-19 (2) SPDR Lehman Int'l  Tres. Bond ETF - Buy 700 shares
> Assets:Vanguard Trust Account:Vanguard Investments: Bonds:Taxable:SPDR 
> Barclays Int'l Bond ETF  BWX 1400. @ $27.25
> Expenses:Investment Expenses:Commissions:Vanguard$15.26
> * Assets:Vanguard Trust Account:Cash - Vanguard California Tax-Free 
> MMF   $-38,165.26
>
> 2017-06-23 (1to15) SPDR Lehman Int'l  Tres. Bond ETF - Sell 3229.1222 
> shares
> Assets:Vanguard Trust Account:Vanguard Federal Money Market Fund
> $50,736.76
> Expenses:Investment Expenses:Commissions:Vanguard $1.95
> Assets:Vanguard Trust Account:Vanguard Investments: Bonds:Taxable:SPDR 
> Barclays Int'l Bond ETF  BWX -200. @ $27.6656  ; Sold all of lot 0
> Assets:Vanguard Trust Account:Vanguard Investments: Bonds:Taxable:SPDR 
> Barclays Int'l Bond ETF  BWX -1400. @ $27.6656  ; Sold all of lot 2
> Assets:Vanguard Trust Account:Vanguard Investments: Bonds:Taxable:SPDR 
> Barclays Int'l Bond ETF  BWX -234. @ $27.66559829  ; Sold all of lot 1
>
>


*Showing the Reports Problem*Here is a report format that shows the problem 
when run on lots.ledger:

ledger -f lots.ledger reg --no-revalued --format 'code=%C 
> amount="%(amount)" quantity=%(quantity(amount)) cost=%(cost) 
> price=%(price)\n'
>

2017-08-02 15:34:43 /pri/git/Ledger4/bugs
> $ ledger -f lots.ledger reg --no-revalued --format 'code=%C 
> amount="%(amount)" quantity=%(quantity(amount)) cost=%(cost) 
> price=%(price)\n'
> code=(0)  amount="BWX 200. {$27.25} [08-Feb-19]" quantity=200 
> cost=$5,450.00 price=$5,450.00
> code=(0)  amount="$2.18" quantity=2.18 cost=$2.18 price=$2.18
> code=(0)  amount="$-5,452.18" quantity=-5452.18 cost=$-5,452.18 
> price=$-5,452.18
> code=(1)  amount="BWX 234. {$27.24995726} [08-Feb-19]" quantity=234 
> cost=$6,376.48999884 price=$6,376.48999884
> code=(1)  amount="$2.56" quantity=2.56 cost=$2.56 price=$2.56
> code=(1)  amount="$-6,379.05" quantity=-6379.05 cost=$-6,379.05 
> price=$-6,379.05
> code=(2)  amount="BWX 1400. {$27.25} [08-Feb-19]" quantity=1400 
> cost=$38,150.00 price=$38,150.00
> code=(2)  amount="$15.26" quantity=15.26 cost=$15.26 price=$15.26
> code=(2)  amount="$-38,165.26" quantity=-38165.26 cost=$-38,165.26 
> price=$-38,165.26
> code=(1to15)  amount="$50,736.76" quantity=50736.76 cost=$50,736.76 
> price=$50,736.76
> code=(1to15)  amount="$1.95" quantity=1.95 cost=$1.95 price=$1.95
> code=(1to15)  amount="BWX -200. {$27.6656} [17-Jun-23]" quantity=-200 
> cost=$-5,533.12 price=$-5,533.12
> code=(1to15)  amount="BWX -1400. {$27.6656} [17-Jun-23]" 
> quantity=-1400 cost=$-38,731.84 price=$-38,731.84
> code=(1to15)  amount="BWX -234. {$27.66559829} [17-Jun-23]" 
> quantity=-234 cost=$-6,473.7486 price=$-6,473.7486
> 2017-08-02 15:35:22 /pri/git/Ledger4/bugs
>
>


*File costPrice.py*Attached is costPrice.py, a Python script that shows the 
problem when run on lots.ledger.

Here is the print statement that generates the output:

print('code={code} amount="{amt}" quantity={qt} cost={cost} 
> price={price} amount.price={aprice}'.format(
> code=xact.code, amt=post.amount, qt=post.amount.number(),
> cost=post.cost, price=hasattr(post, 'price'),
> aprice=hasattr(post.amount.price, 'price')))
>


2017-08-02 16:00:18 /pri/git/Ledger4/bugs/price
> $ python2 costPrice.py lots.ledger
> code=0 amount="BWX 200. {$27.25} [08-Feb-19]" quantity=200 
> cost=$5,450.00 price=False 

Re: shortcuts for entering dates in emacs?

2017-08-03 Thread Marcin Borkowski

On 2017-08-02, at 00:18, David Glasser  wrote:

> - making it faster in emacs to enter dates (other than today, I already
> have an insert current date keybinding)?

How about org-read-date?

> --dave

Hth,

-- 
Marcin Borkowski

-- 

--- 
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.