Re: [Entries that are expressions]

2021-12-29 Thread Yuri Khan
On Thu, 30 Dec 2021 at 14:20, Uwe Brauer  wrote:

>   expenses:User2:User1-Compensation  ((110/2)-(60/2))
>
> Works
> But
>
>   expenses:User2:User1-Compensation  ((110-60)*0.5))
>
> Does not, a bit strange

You should probably balance the parentheses :)

-- 

--- 
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/CAP_d_8XsVwQhZC54UzXDi2S2DOcebgH47DWGN70bW3C6-%2B5-Og%40mail.gmail.com.


Re: The fair Christmas problem: splitting expenses automatically

2021-12-29 Thread Uwe Brauer
>>> "TP" == Tobias Pfeiffer  writes:

> Hi,
> Am Mittwoch, den 29.12.2021, 17:41 +0100 schrieb Uwe Brauer:
>> The question is can this be done automatically?
>> 
>> By this I mean
>> can
>> 2010/07/23 User2:User1-Compensation
>> expenses:User2:User1-Compensation  25.00
>> expenses:User1:User1-Compensation
>> 
>> Somehow be generated automatically?

> For a similar use case I use automated transactions
>  https://www.ledger-cli.org/3.0/doc/ledger3.html#Automated-Transactions
> that split every transaction in two parts, like

> ```
> = expr account =~ /Liabilities:[a-zA-z0-9]*$/ and aux_date >= [2020/05]
>   $account-1.0
>   $account:from User1(roundto(0.6*amount, 0))
>   $account:from User2(amount-roundto(0.6*amount, 0))
> ```

That looks very interesting and I will try it out later.

thanks

-- 

--- 
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/87czleeex6.fsf%40mat.ucm.es.


smime.p7s
Description: S/MIME cryptographic signature


Re: [Entries that are expressions]

2021-12-29 Thread Uwe Brauer
>>> "MM" == Martin Michlmayr  
>>> writes:

Thanks


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

Well 25 is already the result it should have been 50/2

I also found out that 

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


Works

But 

2010/07/23 User2:User1-Compensation
  expenses:User2:User1-Compensation  ((110-60)*0.5))
  expenses:User1:User1-Compensation


Does not, a bit strange

-- 

--- 
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/87ilv6eeys.fsf%40mat.ucm.es.


smime.p7s
Description: S/MIME cryptographic signature


Re: currency trading accounts

2021-12-29 Thread John Wiegley
> "PB" == Pierre Bastoul  writes:

PB> I'm working on tracking my cryptocurrencies trades with ledger-cli as
PB> described in the "Multiple currencies with currency trading accounts "
PB> wiki page.

I'd like to note that my trade-journal project:

  https://github.com/jwiegley/trade-journal

Is aiming at providing good support for crypto transactions, including
taxation laws for different countries (it will be a modular system). The first
version will work on CSV exports of Coinbase fills, and so far only support
staking operation for one crypto (ICP). But again, it's meant to be fully
modular.

The idea is to take data from a crypto exchange, apply know-how in terms of
staking taxation events and local tax laws, and then to output a Ledger file
that allows you to do your year-end and performance reporting.

John

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/m2czlevaso.fsf%40newartisans.com.


Re: The fair Christmas problem: splitting expenses automatically

2021-12-29 Thread Tobias Pfeiffer
Hi,

Am Mittwoch, den 29.12.2021, 17:41 +0100 schrieb Uwe Brauer:
> The question is can this be done automatically?
> 
> By this I mean
> can
> 2010/07/23 User2:User1-Compensation
>   expenses:User2:User1-Compensation  25.00
>   expenses:User1:User1-Compensation
> 
> Somehow be generated automatically?

For a similar use case I use automated transactions
 https://www.ledger-cli.org/3.0/doc/ledger3.html#Automated-Transactions
that split every transaction in two parts, like

```
= expr account =~ /Liabilities:[a-zA-z0-9]*$/ and aux_date >= [2020/05]
  $account-1.0
  $account:from User1(roundto(0.6*amount, 0))
  $account:from User2(amount-roundto(0.6*amount, 0))
```

where the 0.6 means that User1 should cover 60% of the costs and User2
only 40%. If the two should pay the same then just use 0.5. Also, if
your currency uses fractional parts (as in your example) then the
second parameter to `roundto()` should not be 0, probably 2.

Then if all your transactions look like

```
2021-12-03=2021-12-05 Amazon
  Expenses:Presents2000 JPY
  Liabilities:User1

2021-12-05=2021-12-07 eBay
  Expenses:Presents3000 JPY
  Liabilities:User2
```

then you get a balance such as

```
5000 JPY  Expenses:Presents
   -5000 JPY  Liabilities
   -2000 JPYUser1
   -1200 JPY  from User1
-800 JPY  from User2
   -3000 JPYUser2
   -1800 JPY  from User1
   -1200 JPY  from User2

   0
```

and then you can look at the minimum of "User1:from User2" and
"User2:from User1" and compute the reimbursement account.

I guess this is more complicated than what you need for your use case,
but it served me well because it generalizes well to non-equal
contributions, and also I can have a User3 make some purchases that
will then be reimbursed by User1 and User2 in the same ratio as
everything else.

Hope it helps
Tobias

-- 

--- 
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/55691047f01e58c2784854ec6ccba70001fc5ff3.camel%40web.de.


signature.asc
Description: This is a digitally signed message part


Re: currency trading accounts

2021-12-29 Thread Pierre
oh, I'm sorry but what  the "tax man" has to do here? I've  poorly 
explained, but my point is not to hide something. In the country I live, 
I'm not supposed to provide a book of records to the "tax man", it is not 
mandatory for personal finance.

I probably do not understand your answer. 

I just want to use Ledger mainly because I suppose it can help me see 
clearly what my money does, and answer very precisely what are my 
loss/gains, expenses/incomes...
Buying some BTC with USDT is not a strange operation nowadays, after 2 or 3 
trades of this kind, getting loss or gains is not so trivial, I hoped that 
Ledger could help me on that. Even if that kind of transaction does not 
involve or is linked to my own home currencies. We can probably think of 
that as a trade made directly between apples and oranges, does it change 
something if we call them cryptocurrencies?

As I understand the -X operator for ledger,  will give me a full report in 
the home currency if I want it.

 




On Wednesday, December 29, 2021 at 10:47:30 PM UTC+1 Ajoeibin wrote:

> On Wed, Dec 29, 2021 at 11:51 AM Pierre Bastoul  wrote:
> >
> > Hello,
> >
> > I'm working on tracking my cryptocurrencies trades with ledger-cli as 
> described in the "Multiple currencies with currency trading accounts" wiki 
> page.
> >
> > My first idea is not to have a default Fiat, I prefer not having a local 
> currency point of view. I want to be able to track trades for all pairs 
> like BTC to USDT, then BTC to ETH, the ETH to USD, and be able to do 
> "swaps" in all available possible combinations.
> >
> > So I started with only one trading account, expressed in many currencies:
> > Equity:Trading:USD
> > Equity:Trading:ETH
> > Equity:Trading:BTC
> > Equity:Trading:JPY
> > 
> >
>
> Greetings
>
> Hmm - - - well - - - most of us keep our records (record keeping -
> - - -most
> commonly called accounting) as much for the tax man (the man) as we do
> to manage
> our businesses or our finances.
>
> The requirement for 'books' for the taxman is that 'everything' is in
> ONE currency.
> If other currencies are used everything is linked back to that 'home' 
> currency.
>
> The tax man really doesn't care about your costs or what you're spending 
> money
> on or most of any other details. They're looking to see that your income is
> reported accurately and that you're not trying to 'fiddle the books' by 
> either
> misreporting income or expenses.
> So if you're insisting that any currency goes - - - - well - - - I hope you
> really never get audited. My guess is that that process would be very
> very painful.
>
> Haven't had the joy myself but I've heard that they use a fine toothed
> comb to make sure that not one hair is out of place on your hemorrhoids.
>
> I'm trying to come up with a way to use ledger for invoicing which
> would be hugely useful for business purposes. I would suggest that
> what you're looking for would be fine if you do it for just you but I
> wouldn't suggest that a any currency goes in a general ledger be
> a normal thing. (And yes, right now I'm usually only using 3 currencies
> so I'm not just using a 'home' currency.) Just because one can
> do something doesn't mean that you 'should' do it.
>
> Regards
>

-- 

--- 
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/96da0384-f186-4a37-b60a-81b8da5094bfn%40googlegroups.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: currency trading accounts

2021-12-29 Thread o1bigtenor
On Wed, Dec 29, 2021 at 11:51 AM Pierre Bastoul  wrote:
>
> Hello,
>
> I'm working on tracking my cryptocurrencies trades with ledger-cli as 
> described in the "Multiple currencies with currency trading accounts" wiki 
> page.
>
> My first idea is not to have a default Fiat, I prefer not having a local 
> currency point of view. I want to be able to track trades for all pairs like 
> BTC to USDT, then BTC to ETH, the ETH to USD, and be able to do "swaps" in 
> all available possible combinations.
>
> So I started with only one trading account, expressed in many currencies:
> Equity:Trading:USD
> Equity:Trading:ETH
> Equity:Trading:BTC
> Equity:Trading:JPY
> 
>

Greetings

Hmm - - - well - - - most of us keep our records (record keeping -
- - -most
commonly called accounting) as much for the tax man (the man) as we do
to manage
our businesses or our finances.

The requirement for 'books' for the taxman is that 'everything' is in
ONE currency.
If other currencies are used everything is linked back to that 'home' currency.

The tax man really doesn't care about your costs or what you're spending money
on or most of any other details. They're looking to see that your income is
reported accurately and that you're not trying to 'fiddle the books' by either
misreporting income or expenses.
So if you're insisting that any currency goes - - - - well - - - I hope you
really never get audited. My guess is that that process would be very
very painful.

Haven't had the joy myself but I've heard that they use a fine toothed
comb to make sure that not one hair is out of place on your hemorrhoids.

I'm trying to come up with a way to use ledger for invoicing which
would be hugely useful for business purposes. I would suggest that
what you're looking for would be fine if you do it for just you but I
wouldn't suggest that a any currency goes in a general ledger be
a normal thing. (And yes, right now I'm usually only using 3 currencies
so I'm not just using a 'home' currency.) Just because one can
do something doesn't mean that you 'should' do it.

Regards

-- 

--- 
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/CAPpdf58Ccv2m5-7WUtL9va4jbrwCTaA6UgkR3njU-sMuocGKtQ%40mail.gmail.com.


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

2021-12-29 Thread Uwe Brauer
>>> "UB" == Uwe Brauer  writes:

I realized that in gnucash I can have entries that are simple
operations, like 100/5 or something like this.

That seems not to work in ledger please see the last entry

#+name: compensated
#+begin_src ledger   


2010/01/01 * Starting balance
  assets:bank:savings  0
  income:starting balances
2021/12/01 User1:Jacket
  expenses:User1:Jacket  80
  income:User1:creditcard1
2010/07/24 User1:Pajama
  expenses:User1:Pajama  30
  income:User1:creditcard1
2010/07/23 User2:Flowers
  expenses:User2:Flowers  20
  income:User2:creditcard2
2010/07/23 User2:ChristmasTree
  expenses:User2:ChristmasTree  40.00
  income:User2:creditcard2
2010/07/23 User2:User1-Compensation
  expenses:User2:User1-Compensation  25.00/2
  expenses:User1:User1-Compensation
#+end_src

The entry 25.00/2 is not interpreted. 

Anyway to achieve that?

-- 

--- 
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/87o84zdyqw.fsf%40mat.ucm.es.


smime.p7s
Description: S/MIME cryptographic signature


currency trading accounts

2021-12-29 Thread Pierre Bastoul
Hello,

I'm working on tracking my cryptocurrencies trades with ledger-cli as 
described in the "Multiple currencies with currency trading accounts 
"
 wiki 
page.

My first idea is not to have a default Fiat, I prefer not having a local 
currency point of view. I want to be able to track trades for all pairs 
like BTC to USDT, then BTC to ETH, the ETH to USD, and be able to do 
"swaps" in all available possible combinations.

So I started with only one trading account, expressed in many currencies:
Equity:Trading:USD
Equity:Trading:ETH
Equity:Trading:BTC
Equity:Trading:JPY


Then I made a trading account per currency, with multiple currencies in 
each:
Equity:Trading:ETH:USD
Equity:Trading:ETH:JPY
Equity:Trading:ETH:BTC
Equity:Trading:BTC:USD
Equity:Trading:BTC:JPY
because I want to be able to calculate Gain/loss for each currencies.

And then, discovered another chart naming model in the recent update in the 
wiki page:
Equity:Trading:ETH-BTC:USD
Equity:Trading:ETH-BTC:JPY
Equity:Trading:ETH-BTC:BTC
Equity:Trading:ETH-BTC:ETH

Do someone, or the author itself can explain the reason why accounts names 
were converted from AUD:EUR to AUD-EUR:EUR and AUD-EUR:AUD? Why this 
revision was made? for what usage?

I'm not able to calculate Cost  of a trade. But it seems feasible as 
described in point 5.3 
https://www.mathstat.dal.ca/~selinger/accounting/tutorial.html#4 









-- 

--- 
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/9a99c842-3c0c-4253-b247-2a860054e81cn%40googlegroups.com.


Re: Invoicing (feature request??)

2021-12-29 Thread Yashovardhan
I am kinda interested since I am writing python scripts for ledger in my 
free time right now. What kind of invoices are you looking for? And how 
would the entries in your journal look like? If you can share some example 
data, I would be willing to give it a shot (no guarantees though :)

On Wednesday, 29 December 2021 at 16:29:00 UTC+5:30 Ajoeibin wrote:

> On Tue, Dec 28, 2021 at 5:40 PM John Wiegley  wrote:
> >
> > > "o" == o1bigtenor  writes:
> >
> > o> Maybe I'm just slow but I can't think of how to write things so that 
> I can
> > o> do all the things I need to do to an invoice. (tracking, aging, 
> closing,
> > o> etc etc) in ledger. There may be some way but I'm not seeing it.
> >
> > o> Maybe trying to add this to ledger would stretch it out of shape? I 
> hope
> > o> not - - - I like the way it works. Just need to be able to do AR. 
> Ledger
> > o> does AP very very well so how do I bend my brain to get AR thinking
> > o> working?
> >
> > Sometimes, rather than fitting the idea into ledger, it's better to fit 
> ledger
> > into the idea. Imagine what higher level syntax would be best to express
> > invoicing, and then write a tool to publish a Ledger file from this 
> syntax for
> > your reporting needs. I'm doing that right now for stock trades, which 
> are
> > possible to track in Ledger but far too verbose, yet it's not too hard to
> > imagine a convenient syntax plus some extra math that wouldn't be right 
> to add
> > directly into Ledger itself.
> >
>
> H - - - - now if I only knew my butt from a hole in the ground
> when it comes to programming - - - - well then I'd be doing something.
> Sadly - - - that's not presently in my skill set.
> Which is why I posted here.
>
> Talked to a friend - - - he had been managing a small services company.
> They invoice in one program and then do their accounting in another.
> Sounds like a possibility for errors - - - like your idea of something 
> parked
> on top of or working with ledger.
>
> Anyone out there interested in creating something for invoicing?
>
> Please?
>
> Pretty please??
>
> (LOL)
>
> TIA
>

-- 

--- 
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/49e97365-3ca5-4253-a351-f71811cc4853n%40googlegroups.com.


The fair Christmas problem: splitting expenses automatically

2021-12-29 Thread Uwe Brauer
Hi 

I am not sure whether this is the right place to ask this, but anyhow.
I don't really use ledger, I use emacs org mode, that allows me via its
babel extension to connect to ledger and perform certain very simple
operations. 

Be it as it may, I have a conceptual question, that I explain using the
following example.

Suppose two friends want to buy Christmas presents, but when they have
finished, they want to have spent the same amount of money. If they
don't a compensation must be transferred.

Here is an example

** Start

#+name: presents
#+begin_src ledger   

2010/01/01 * Starting balance
  assets:bank:savings  0
  income:starting balances
2021/12/01 User1:Jacket
  expenses:User1:Jacket  80
  income:User1:creditcard1
2010/07/24 User1:Pajama
  expenses:User1:Pajama  30
  income:User1:creditcard1
2010/07/23 User2:Flowers
  expenses:User2:Flowers  20
  income:User2:creditcard2
2010/07/23 User2:ChristmasTree
  expenses:User2:ChristmasTree  40.00
  income:User2:creditcard2
#+end_src

#+RESULTS: presents
#+begin_example

 170  expenses
 110User1
  80  Jacket
  30  Pajama
  60User2
  40  ChristmasTree
  20  Flowers
-170  income
-110User1:creditcard1
 -60User2:creditcard2

   0
#+end_example

So user1 spent 110, while  user2 spent 60

** Compensation manually
So the compensation is (trivally)
that is org's version of a spreadsheet.

| User1 | User2 | User2-->Uwer1 |
|---+---+---|
|   110 |60 |   -25 |

#+TBLFM: $3=($2-$1)/2;f2

Leading to 

#+name: compensated
#+begin_src ledger   

2010/01/01 * Starting balance
  assets:bank:savings  0
  income:starting balances
2021/12/01 User1:Jacket
  expenses:User1:Jacket  80
  income:User1:creditcard1
2010/07/24 User1:Pajama
  expenses:User1:Pajama  30
  income:User1:creditcard1
2010/07/23 User2:Flowers
  expenses:User2:Flowers  20
  income:User2:creditcard2
2010/07/23 User2:ChristmasTree
  expenses:User2:ChristmasTree  40.00
  income:User2:creditcard2
2010/07/23 User2:User1-Compensation
  expenses:User2:User1-Compensation  25.00
  expenses:User1:User1-Compensation
#+end_src

#+RESULTS: compensated
#+begin_example

 170  expenses
  85User1
  80  Jacket
  30  Pajama
 -25  User1-Compensation
  85User2
  40  ChristmasTree
  20  Flowers
  25  User1-Compensation
-170  income
-110User1:creditcard1
 -60User2:creditcard2

   0
#+end_example




The question is can this be done automatically?

By this I mean
can
2010/07/23 User2:User1-Compensation
  expenses:User2:User1-Compensation  25.00
  expenses:User1:User1-Compensation

Somehow be generated automatically?

Regards

Uwe Brauer 


-- 

--- 
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/875yr7fjo5.fsf%40mat.ucm.es.


Re: Invoicing (feature request??)

2021-12-29 Thread o1bigtenor
On Tue, Dec 28, 2021 at 5:40 PM John Wiegley  wrote:
>
> > "o" == o1bigtenor   writes:
>
> o> Maybe I'm just slow but I can't think of how to write things so that I can
> o> do all the things I need to do to an invoice. (tracking, aging, closing,
> o> etc etc) in ledger. There may be some way but I'm not seeing it.
>
> o> Maybe trying to add this to ledger would stretch it out of shape? I hope
> o> not - - - I like the way it works. Just need to be able to do AR. Ledger
> o> does AP very very well so how do I bend my brain to get AR thinking
> o> working?
>
> Sometimes, rather than fitting the idea into ledger, it's better to fit ledger
> into the idea. Imagine what higher level syntax would be best to express
> invoicing, and then write a tool to publish a Ledger file from this syntax for
> your reporting needs. I'm doing that right now for stock trades, which are
> possible to track in Ledger but far too verbose, yet it's not too hard to
> imagine a convenient syntax plus some extra math that wouldn't be right to add
> directly into Ledger itself.
>

H - - - - now if I only knew my butt from a hole in the ground
when it comes to programming - - - - well then I'd be doing something.
Sadly - - - that's not presently in my skill set.
Which is why I posted here.

Talked to a friend - - - he had been managing a small services company.
They invoice in one program and then do their accounting in another.
Sounds like a possibility for errors - - - like your idea of something parked
on top of or working with ledger.

Anyone out there interested in creating something for invoicing?

Please?

Pretty please??

(LOL)

TIA

-- 

--- 
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/CAPpdf58%3D2YmjDOMRwYd0v17A%2BpY%3Dw-7i4BvY_hTKZJvfm-p1aw%40mail.gmail.com.