On Fri, Sep 30, 2016 at 11:56 AM, Ratish Punnoose <rat...@gmail.com> wrote:Hi Martin,I am doing the accounting for a school festival and was scoping out your project, beancount. It looks very cool. Thanks for developing it.Thanks!In your comparison document (with ledger + others), you mention that beancount only has a resolution of a single day. Do you have any future plans to provide time resolution?No.A while back I decided it was out of scope and this would keep the code simpler. So far it seems like it was a good decision. If you need something like that - e.g. for intra-day trading with 100+ trades, or for managing a large sales operation - I figure more specialized software is in order anyhow.In my use case, a festival spans multiple days but it is extremely useful for us to get reports hour-by-hour for many booths. We currently do this with spreadsheets. This is needed for us to make a lot of decisions, checking trends, comparing historical performance, and correlating with other events that are happening. I can also imagine other use cases, where accounting reports are done per multi-hour shifts.It would be quite useful for beancount to provide at least a one-hour resolution.If you don't have plans to support this, could you provide some advice on what modifications would have to be made to support this. For a start, we wouldn't need to report across timezones. Does that make it simpler? If it is not a huge endeavor, I would like to see if I can contribute on this front.Hmm, let's see. I think you could actually do this with the current system with pretty minimal changes.First, let me explain how sorting works, which is the key subject here when we think about time. One important invariant Beancount ensures is that the order of your input is not relevant. All directives - of all types, Transaction and others, like Balance - are sorted in data order, and then by type. If on the same date, Open directives always come first, then Balance directives (thus they apply at the beginning of a day), then the Transactions and everything else, and finally, Close directives. The code that expresses this rule is here:Note also that the line number is included in the sort-key, but none of the calculations anywhere do anything special within a day, so it doesn't matter. It's only there to ensure a "stable" sorting order (meaning every time you sort you obtain the exact same result), which helps when writing tests.Adding storage is trivial; ideally one would include that in the grammar, but that would be a pretty invasive change. I think you could start by adding some metadata field, e.g. "time", and pulling it in the sort-key, it it's present, e.g.2016-10-01 * "Sale #1"time: "04:05"...and monkey-patching data.entry_sortkey() like this:def entry_sortkey(entry):return (entry.date, SORT_ORDER.get(type(entry), entry.meta.get('time', None), entry.meta['lineno'])Note a few things:- I'm placing the sort order in front of the time here; I'm assuming you don't need Balance check within the day. If you do, you could make those respect time and change the field order. I'm not sure if everything else keeps working - you'd have to try it out - but I suspect it will.- I'm using .get() instead of [] on "meta" so that you may leave the field as absent. This means that for transactions with no time, they'll appear before the other entries with time. You could provide a default value for time of your own choice if you'd want to do differently.- The meta-data value in my example is a string. You might want to implement a plugin that verifies that the input syntax is correct if those are manually entered, e.g. "\d\d:\d\d".Based on this, you could then use the SQL shell to extract the time and do run some aggregations. I think you'd want to add a few custom functions to the bean-query environment, in here:I'm thinking of some functions to get the time metadata (META() can do that, but you might want to add a virtual "time" column which would look nicer), and some functions to round your time strings to e.g. hours.So essentially, I just fleshed out how to add time to Beancount. If- doing this doesn't add significant processing time,- adding this time metadata is optional- we wrote a lot of unit tests,I'd consider adding this to the default branch.As always, the problem with these things is all the unintended consequences down the road, and the devil is always in the details.I hope this helps, please do let us know if you give this a shot.ThanksRatish Punnoose
Hi Ratish & Martin,Is there any time support implemented?
What about time zone support? This is very useful for frequent international travelers. If I fly eastbound trans-pacific flight, for example, Tokyo to San Francisco, the date will be the same but the local time will backtrack.
My proposal is to make the date fully ISO 8601, like 2018-03-30T08:34:43+09:00, instead of just 2018-03-30.
What do you think?
Thanks,Carbo
--
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+unsubscribe@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/04d4d242-81d5-4926-a06f-e3b4ec9ba83a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
What about time zone support? This is very useful for frequent international travelers. If I fly eastbound trans-pacific flight, for example, Tokyo to San Francisco, the date will be the same but the local time will backtrack.That would be a very rare occurrence not worth optimizing for, and besides, the date you should record is the date of the place where the transaction occurred (for the corresponding institution). It's not designed to take into account time, and some small amount of fuzziness is considered okay.
You'd need to do something like have a default timezone per account but allow overrides and....this is how scope creep happens.
--
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+unsubscribe@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/c6e95a02-44ca-4b3e-9c2d-662f0c8afbf8%40googlegroups.com.
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.
Also, using date/time + tz opens up a rabbit hole of issues... when you sort, what do you display? If you display the local dates, it won't look like a list of sorted dates if you have txns from multple accounts. Do we always convert all the input dates to UTC and then convert back out when rendering the reports? That could get confusing if you compare with your institution's statement (the dates won't match). e.g., when looking at a journal listing, you'd have to make sure to render the dates based on the timezone associated with that particular account. And what happens if you look at a group of accounts?
2014-07-09 price HOOL 579.18 USD
Hi Martin,I'd like to throw in my two cents as well... I'm learning Beancount anew (coming over from Ledger) and so far I think it's great so far and I'm digging deeper. Thank you for the well written documents that are helping me learn so far.I'm not sure I understand the argument that ISO 8601 support would introduce too much complexity. Isn't it just a matter of more granular timing/ordering of transactions?
Why would being able to optionally post the specific ISO 8601 time of transactions introduce any change in Beancount functionality whatsoever? It should behave exactly the same way.
I'm surprised to see that Beancount does not support ISO 8601 (when it says that it does in the documentation).
I fully expected to be able to use more precise date syntax such as "2018-03-30T08:34:43+00:00", or even the syntax that Ledger supports. I have assets in accounts that are in different timezones and the corresponding institutions usually present their records in UTC. Since Beancount does not support this it means I have to manually do timezone calculations to figure out what day a given transaction took place...
"Was it late in the night on Dec 31, or was it early morning Jan 1? Is it in 2015 or 2016?" ... "Was it daylight savings or not?". Like I said, I'm very surprised to see a lack of support for precise ordering of transactions and do not really understand why that would be undesirable especially in accounting where tax liabilities of great legal importance. I fully expected to be able to provide a precise date that comes directly from my records without manual modification, and that the software would easily be able to know whether the transaction should be included in the 2015 report vs the 2016 report based on the current local timezone (or specific default timezone or UTC), or that the software would be able to do the timestamp apples to apples calculations to know whether two transactions are one year and one day apart for long term capital gains calculations. The fact that I have to look out for manual calculations like this seems not in line with the awesome automation ethos of the Beancount project that you've articulated in the docs so far.
To put it succinctly I see these issues with no ISO 8601 support:- Grabbing a timestamp from a record can result in a tx being put in the wrong day and even year.
- Manually altering every timestamp from disparate records in different timezones does not seem reasonable.
- Calculating long term capital gains (hold asset for one year and one day) is not guaranteed to be accurate.
- A Tx that happens on the year change boundary could be ambiguous as to what year the taxes are owed.- Txs can appear to be out of order. Tx1 appears to come after tx2 simply because its record is from a different timezone.
I respectfully ask you to reconsider support for ISO 8601 precise time and timezone.
Best regards and thanks again for your great documentation,Mac
On Friday, August 31, 2018 at 4:30:52 PM UTC-6, mrcyb...@gmail.com wrote:Also, using date/time + tz opens up a rabbit hole of issues... when you sort, what do you display? If you display the local dates, it won't look like a list of sorted dates if you have txns from multple accounts. Do we always convert all the input dates to UTC and then convert back out when rendering the reports? That could get confusing if you compare with your institution's statement (the dates won't match). e.g., when looking at a journal listing, you'd have to make sure to render the dates based on the timezone associated with that particular account. And what happens if you look at a group of accounts?An approach that makes sense to me would be the following:1. Within the text file, all transactions simply have a true ISO 8601 timestamp. They match the timestamp as presented in original records from any institution so there is no confusion when reading over the actual text data or record data.2. When Beancount runs, all transactions are first normalized to the desired timezone IN MEMORY.3. Now reports should be generated only after all transactions are normalized to timezone.
- Preferred timezone can be specified in an option to override DEFAULT to local timezone.
- A date like "2018-10-10" should assume current local timezone as known by Python unless overridden.
- A date like "2018-10-10T10:10:10" should assume current local timezone unless overridden.
- A timestamp like "2018-01-01T05:10:10-00:00" should be converted into "2017-12-31T22:10:10-07:00" (for Mountain time for example)
- Notice how this transaction will now be reported on for 2017, not 2018, as it should be for someone in Mountain time.
Libraries like moment.js make it easy to manage timing. https://github.com/zachwill/moment <-- this a python library inspired by moment.js.
Another place where I feel this limited timestamping doesn't work is in price directives:2014-07-09 price HOOL 579.18 USD
Assets/commodities change price, sometimes drastically, intraday. It shouldn't be the prerogative of accounting software to limit that a user cannot have two transactions in the same day that involve the same asset/commodity. We need the ability to specify the exact time of an asset/commodity intraday.
--
You received this message because you are subscribed to a topic in the Google Groups "Beancount" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beancount/zZiFBPU1V8Y/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAK21%2BhP5C%2BF6eyVf_enqMh6qSS-ic%3D2gPMdUA4t8AwDv4j6DmA%40mail.gmail.com.
It shouldn't be the prerogative of accounting software to limit that a user cannot have two transactions in the same day that involve the same asset/commodity.
Thanks for the replies.Basically I have two needs that I'm trying to understand if Beancount can handle. I've read through the docs and cookbook but it looks like it might not be able to handle it:1. Trading currencies while tracking lot pricing in dollars (I'm not a daytrader doing 100s of txs per day, but in principle I don't feel that should matter).
For example trade JPY for CAD while the cost basis of lot JPY is tracked in USD and the capital gains are calculated in USD.
2. If there is a day where the above JPY is sold in two batches where the JPY/CAD price has changed, can Beancount handle that?
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/CAAO-ndPYq1PGPNwc6evzR_MtUwocx3amcV3s_X1rZSTNou825g%40mail.gmail.com.
Here's what I could do for you, with relatively little investment in complexity:- Modify the parser to support parsing a full ISO8601 datetime, as you suggest. You get your input syntax.- When parsing, I ignore the time portion and just use the date as-is, but I attach the full parsed date/time object as metadata for you.- The rest of the codebase isn't modified to depend on time anywhere.- Then you build a plugin that will translate things as you see fit from the metadata field.Would that be a good first step?From my perspective, I'm providing you with the syntax to build what you want, but I'm not committing to entering the time-consuming domain of dealing with timezone issues and tickets (not supported as a core feature). This is a bit similar to how Python3's grammar supports type annotations but doesn't do anything with them nor mandate how you use them otherwise (except they happen to provide a special "typing" module).
--
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/d6a65c2c-3ee2-4d69-b3e2-b5c94be62645%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/d83aad63-140a-434c-8bec-8a81e3ca2304n%40googlegroups.com.