Here's what I'm using
data.Balance( data.new_metadata(myFile, myLine),
myDate,
myAccount,
amount.Amount(D(myAmount), myCurrency),
None,
None,
)
* How do the parameters diff_amount and tolerance reflect in the produced statements? The balance statement does not seem to have these fields.
* What is the meaning of the diff_amount?
* And finally: Is there something I don't understand regarding beancount's API? So far, it feels a bit unpythonic.
Thanks a lot,
Florian
--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/f2123ceb-8a2a-40ca-ae56-f7b0527e413b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hello,
I would like to create a balance assertion
YYYY-MM-DD balance Account Amount
program,atically: https://aumayr.github.io/beancount-docs-static/api_reference/beancount.core.html#beancount.core.data.Balance
The parameter description in the API docs is only "Alias for field X". The source code reveals some more information:
# Attributes:
# meta: See above.
# date: See above.
# account: A string, the account whose balance to check at the given date.
# amount: An Amount, the number of units of the given currency you're
# expecting 'account' to have at this date.
# diff_amount: None if the balance check succeeds. This value is set to
# an Amount instance if the balance fails, the amount of the difference.
# tolerance: A Decimal object, the amount of tolerance to use in the
# verification.
Balance = new_directive('Balance', [
('account', Account),
('amount', Amount),
('tolerance', Optional[Decimal]),
('diff_amount', Optional[Amount])])
Just omitting the optional arguments doesn't work and gives a TypeError.
* How do the parameters diff_amount and tolerance reflect in the produced statements? The balance statement does not seem to have these fields.
* What is the meaning of the diff_amount?
* And finally: Is there something I don't understand regarding beancount's API? So far, it feels a bit unpythonic.
On Sat, May 4, 2019, at 15:00, Stefano Zacchiroli wrote:
> Python data classes might come in handy here:
> https://docs.python.org/3/library/dataclasses.html
I like dataclasses. It has the same usage interface and repr as namedtuples, but with the flexibility of classes. There will be no more awkward `txn = txn._replace(narration='foo')`, just `txn.narration = `foo`.
The only problem is that it's in Python 3.7. AFAIK some distros are stuck with Python 3.6...
--
Zhuoyun Wei
--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/cb585c68-84d0-4f3c-be43-f2deb65f5493%40www.fastmail.com.