Closed rossdargan closed 7 years ago
Yes indeed, the amounts are stored in the internal database as whole integers. this custom type. I would have thought this query would scale the value and give you back a normal value (in dollars), apparently not. The simplest solution is to scale the value yourself, divide by 1000 and this gives you the good value :-)
Once it's been placed into that custom type I don't think there is much I can do - I've tried dividing it by 1000 but the loss of precision is just maintained. I might be missing something!
>>> ynab_client.budget.be_transactions[6].amount/1000
-0.014
>>> ynab_client.budget.be_transactions[6].amount
-14.0
Normally it should be transparent, the amount field should contain the actual dollar values. What is the amount displayed in YNAB website for this transaction ?
£13.03 :)
yeah, that's an unacceptable rounding ! I can confirm the error, just replicated! Why that hasnt been caught by anyone else is remarkably horrible
I think that's a python incompatibility. Are you using python 2 ?
can you try latest master 7af5f1d ? I added a float(x) to handle how python 2.x does divisions involving integers.
Yup, that solves it - cheers!
All of the Transaction.amounts that I check are whole integers... Adding them all up using a sql query: session.query(func.sum(Transaction.amount)).scalar()
gives a whole number, and checking many transactions results in the same thing.