Re: beancount.prices.sources.iex.IEXError: Invalid response (403): Forbidden

2019-06-19 Thread Zhuoyun Wei
It seems that IEX stopped prividing non-IEX data:


https://iextrading.com/developer/docs/

https://iextrading.com/developer/#sunset-schedule

-- 
Zhuoyun Wei

On Tue, Jun 18, 2019, at 02:01, matthew.piz...@gmail.com wrote:
> I think something is wrong with the IEX asset pricing source.
> 
> Something like this:
> `
> 2018-09-15 commodity UBER
>  price: "USD:iex/UBER"
> `
> 
> Results in something like this:
> `
> Traceback (most recent call last):
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/shelve.py",
>  line 111, in __getitem__
>  value = self.cache[key]
> KeyError: '5f40c1783265eb0919e27627aed4d146'
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/site-packages/beancount/prices/price.py",
>  line 84, in fetch_cached_price
>  timestamp_created, result_naive = _CACHE[key]
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/shelve.py",
>  line 113, in __getitem__
>  f = BytesIO(self.dict[key.encode(self.keyencoding)])
> KeyError: b'5f40c1783265eb0919e27627aed4d146'
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
> File 
> "/nix/store/h5bpd5swkwcgxhz05aaj430qja3v04js-python3.7-beancount-2.2.1/bin/.bean-price-wrapped",
>  line 5, in 
> from beancount.prices.price import main; main()
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/site-packages/beancount/prices/price.py",
>  line 369, in main
>  price_entries = sorted(price_entries, key=lambda e: e.currency)
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/concurrent/futures/_base.py",
>  line 586, in result_iterator
> yield fs.pop().result()
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/concurrent/futures/_base.py",
>  line 432, in result
> return self.__get_result()
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/concurrent/futures/_base.py",
>  line 384, in __get_result
> raise self._exception
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/concurrent/futures/thread.py",
>  line 57, in run
>  result = self.fn(*self.args, **self.kwargs)
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/site-packages/beancount/prices/price.py",
>  line 159, in fetch_price
>  srcprice = fetch_cached_price(source, psource.symbol, dprice.date)
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/site-packages/beancount/prices/price.py",
>  line 100, in fetch_cached_price
> if time is None else
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/site-packages/beancount/prices/sources/iex.py",
>  line 49, in get_latest_price
> return fetch_quote(ticker)
> File 
> "/nix/store/bmq1vsmckm7vrfg4z0yyqb9jpddv6p6p-python3-3.7.3-env/lib/python3.7/site-packages/beancount/prices/sources/iex.py",
>  line 30, in fetch_quote
>  response.text))
> beancount.prices.sources.iex.IEXError: Invalid response (403): Forbidden
> `
> 
> What's the go-to price sources these days? I'm guessing that Yahoo and 
> Google sources don't work anymore. What should I migrate to?
> 
>  -- 
>  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+unsubscr...@googlegroups.com.
>  To post to this group, send email to beancount@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/33b31600-3304-405b-8eb1-9f983890caac%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beancount/33b31600-3304-405b-8eb1-9f983890caac%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/4a44cd23-e246-4cb5-b925-f16b22e3fca8%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to split expenses on a regular basis

2019-05-22 Thread Zhuoyun Wei
I do this for shared expenses:


2019-01-01 * "Rent"
  Liabilities:Bank:CreditCards -8000.00 CNY
  Expenses:Household:Rent8000.00 / 2 CNY
  Equity:ARAP:JohnDoe 8000.00 / 2 CNY


With some importer and editor tricks, you can somehow automate this.


-- 
Zhuoyun Wei

On Wed, May 22, 2019, at 11:43, freak.f...@gmail.com wrote:
> 
> Hi,
> 
> I'm new to beancount and currently assessing whether I can switch from 
> ledger-cli in order to make use of the web interface fava. 
> 
> I'm interested in ways on how to split expenses in beancount: I share a 
> household with my partner and for many expenses I'd like to register 
> only half the debit as a personal expense whereas the other half should 
> be registered as an asset (something that my partner owes me).
> 
> I currently use ledger-cli and make heavy of the following automatic 
> transaction to split transactions with my partner:
> `
> = tag("With") =~ "Susa"
>  $account -0.5
> Assets:Receivable:Susa 0.5
> `
> 
> Shared expenses are then recorded like this:
> `
> 2019/05/22 * Bakery
> Expenses:Food 10.00 EUR ; With: Susa
> Assets:Cash
> `
> 
> This results in a credit of 5.00 EUR to Expenses:Food and 
> Assets:Receivable:Susa each. I find this quite comfortable and want to 
> know if there is something similar in beancount. (I've already learned 
> that there are no automatic transactions in beancount)
> 
> I skimmed the documentation of beancount for sharing expenses and what 
> I found <http://furius.ca/beancount/doc/shared> seems to involve 
> "special" accounts (e.g. Expenses:Food:Fred & Expenses:Food:Susa) in 
> order to split transactions using a plugin 
> ("beancount.plugins.split_expenses") -- is this correct?
> 
> Does the mentioned plugin work in way like the automatic transaction in 
> ledger-cli does, i.e. does running beancount automatically split the 
> written amount in the journal file or does the workflow involve running 
> a command that results in hard-coded input text that replaces the 
> original input data?
> 
> More generally: How do beancount users normally record regular shared 
> expenses?
> 
> Thanks and regards,
> Fred
> 
>  -- 
>  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+unsubscr...@googlegroups.com.
>  To post to this group, send email to beancount@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/e413816b-57be-439b-ae24-fd33efbbaf8a%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beancount/e413816b-57be-439b-ae24-fd33efbbaf8a%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/29ee15e5-3f6b-4ca6-9a92-883e35902fed%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fix the income statement so that incomes are positive and expenses are negative?

2019-05-09 Thread Zhuoyun Wei
https://github.com/beancount/fava/issues/920

-- 
Zhuoyun Wei

On Thu, May 9, 2019, at 05:18, Stefano Zacchiroli wrote:
> On Thu, May 09, 2019 at 04:51:15AM -0400, Zhuoyun Wei wrote:
> > Perhaps Fava could provide a fava-option that flips the signs to
> > generate a "traditional" Income Statement and Balance Sheet?
> 
> There are indeed two different aspects here that have been conflated in
> this thread.
> 
> One is what Beancount internally uses --- and I'm pretty sure that's not
> gonna change.
> 
> One is how Fava shows (or not) signs to users. I agree it would make a
> sense to have a UI option in Fava that make signs more "standard" and
> less puzzling for traditional debit/credit double-entry accounting
> users. This is a question for the Fava devs though, that usually react
> quickly to this kind of suggestions via the GitHub issue tracker
> https://github.com/beancount/fava
> 
> Cheers
> -- 
> Stefano Zacchiroli . z...@upsilon.cc . upsilon.cc/zack . . o . . . o . o
> Computer Science Professor . CTO Software Heritage . . . . . o . . . o o
> Former Debian Project Leader & OSI Board Director  . . . o o o . . . o .
> « the first rule of tautology club is the first rule of tautology club »
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/20190509091837.ut5jm6vm2gelcev3%40upsilon.cc.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/a527cce2-8670-48b2-b4c2-e6f4bf623e16%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fix the income statement so that incomes are positive and expenses are negative?

2019-05-09 Thread Zhuoyun Wei
I understand you.

The problem here is that Beancount does not use traditional double-entry terms 
like "credit" and "debit" for different types of accounts. It uses signs. It 
uses this modified account equation:

(Income + Liabilities) + (Assets + Expenses) + Equity = 0

So, in most cases, Income and Liabilities are negative, while Assets and 
Expenses are positive.

I have been using Beancount for more than 3 years, so I am already attuned to 
its usage of negative and positive signs. But your post reminds me that if a 
user has used tranditonal double-booking method before, they may feel confused 
facing the Income Statement in Beancount.

Perhaps Fava could provide a fava-option that flips the signs to generate a 
"traditional" Income Statement and Balance Sheet?

-- 
Zhuoyun Wei

On Thu, May 9, 2019, at 02:44, John Mee wrote:
> 
> Perhaps this is an issue of fava, I'm sure you'll redirect me if so... 
> my problem is that fava's balance sheet shows assets as positive values 
> and equity as negative (which is also odd, imho both sides should be 
> positive values?) thence the income Statement shows income as negative 
> and expenses as positives.
> 
> I started mucking around with code to try and flip all my beancount 
> text file entries from positives to negatives but, given that is "work, 
> (eg: got so far as to be searching for routine in beancount.data that 
> outputs Transaction instance as beancount text?), that now I'm 
> reconsidering my approach. Even if I do flip it all successfully my 
> balance sheet will show assets as negatives, equity as positives, 
> income as positive and expenses as negative: better but still not 
> "right" imho (please correct me as appropriate).
> 
> Ultimately I (think I) would like fava's income statement to list 
> income in positive values; expenses can be either positive or negative 
> I don't particularly care, but it would be nice if both sides of the 
> balance sheet were positive although I can live with whatever I get on 
> that. 
> 
> (First) Question is perhaps: Should I proceed to invert every entry in 
> beancount, or focus on "fixing" fava?
> 
> thanks.
> 
>  -- 
>  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+unsubscr...@googlegroups.com.
>  To post to this group, send email to beancount@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/a06f3d41-4aa9-4a92-87b3-1efd16ff1c49%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beancount/a06f3d41-4aa9-4a92-87b3-1efd16ff1c49%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/b0b68380-ad4d-4927-bfe0-7dc304093698%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: bean-bake export from linux to mac or windows

2019-05-08 Thread Zhuoyun Wei
I heard that recent versions of macOS use a newer filesystem named APFS. 
Perhaps you could try to open the file in a newer macOS?

Again, I am not a macOS user so I cannot try that out... Good luck!

-- 
Zhuoyun Wei

On Wed, May 8, 2019, at 19:59, richard gott wrote:
> Many thanks for this. I presume that means I can't do it.
> Richard
> 
> Prof R Gott
> 
> 
> > Sent: Wednesday, May 08, 2019 at 10:51 AM
> > From: "Zhuoyun Wei" 
> > To: Beancount 
> > Subject: Re: bean-bake export from linux to mac or windows
> >
> > I've never used bean-bake before. I just tried it.
> >
> > Some of the output filenames contain colons, for example "Assets:Cash.html".
> >
> > Some filesystem and/or OS cannot handle colons in paths. Linux allows 
> > colons in paths, while Windows does not.
> >
> > For example, if you mount an NTFS filesystem in Linux, and create a file 
> > called "foo:bar.txt" in it before mounting this NTFS filesystem in Windows, 
> > you cannot open / rename / move /delete the file in Windows. In this case, 
> > NTFS allows colons, but Windows does not support it.
> >
> > I don't use macOS, but I guess it's something similar. A quick Google 
> > search reveals that the HFS filesystem used by previous versions of macOS 
> > does not allow colons in filenames.
> >
> > --
> > Zhuoyun Wei
> >
> > On Tue, May 7, 2019, at 10:28, richard gott wrote:
> > > Hello
> > > I am the treasurer of a small charity. I have recently switched from
> > > ledger. One of the main reasons was to make use of bean-bake to share
> > > full accounts adn reports with the other trustees.
> > > When I run bean-bake I get the folder as predictied whcih works fine -
> > > linux (arch adn ubuntu - both ok - ext4).
> > > BUT:
> > >  * try to copy to USB, fails with 'cannot copy files'
> > >  * zip and send to mac, unzip OR
> > >  * upload to google drive adn download to mac* index opens fine,
> > > structure is intact
> > >* top level accounts open ok
> > >* anything below that is empty
> > > It behaves as if the apple file system can't cope with the folder depth
> > > of the lower level files in the bean-bake folder. But I am not a
> > > computer expert adn that may be complete rubbish.
> > > I would be most grateful for any help that can be offered
> > > Thanks
> > > Richard
> > >
> > >  --
> > >  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+unsubscr...@googlegroups.com.
> > >  To post to this group, send email to beancount@googlegroups.com.
> > >  To view this discussion on the web visit
> > > https://groups.google.com/d/msgid/beancount/trinity-703d58fc-e627-4414-9191-c4b76b7cbc2b-1557148626744%403c-app-mailcom-bs06
> > >  
> > > <https://groups.google.com/d/msgid/beancount/trinity-703d58fc-e627-4414-9191-c4b76b7cbc2b-1557148626744%403c-app-mailcom-bs06?utm_medium=email&utm_source=footer>.
> > >  For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > 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+unsubscr...@googlegroups.com.
> > To post to this group, send email to beancount@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/beancount/2de489f9-3a19-4a09-bbe8-ae9e4d856f38%40www.fastmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/trinity-3638278d-4e8c-469e-b577-c6361bcf40c9-1557316786738%403c-app-mailcom-bs13.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/5c8bd647-56cd-4c83-9824-9ede91ee2d91%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: bean-bake export from linux to mac or windows

2019-05-08 Thread Zhuoyun Wei
I've never used bean-bake before. I just tried it.

Some of the output filenames contain colons, for example "Assets:Cash.html".

Some filesystem and/or OS cannot handle colons in paths. Linux allows colons in 
paths, while Windows does not.

For example, if you mount an NTFS filesystem in Linux, and create a file called 
"foo:bar.txt" in it before mounting this NTFS filesystem in Windows, you cannot 
open / rename / move /delete the file in Windows. In this case, NTFS allows 
colons, but Windows does not support it.

I don't use macOS, but I guess it's something similar. A quick Google search 
reveals that the HFS filesystem used by previous versions of macOS does not 
allow colons in filenames.

-- 
Zhuoyun Wei

On Tue, May 7, 2019, at 10:28, richard gott wrote:
> Hello
> I am the treasurer of a small charity. I have recently switched from 
> ledger. One of the main reasons was to make use of bean-bake to share 
> full accounts adn reports with the other trustees.
> When I run bean-bake I get the folder as predictied whcih works fine - 
> linux (arch adn ubuntu - both ok - ext4).
> BUT:
>  * try to copy to USB, fails with 'cannot copy files'
>  * zip and send to mac, unzip OR
>  * upload to google drive adn download to mac* index opens fine, 
> structure is intact
>* top level accounts open ok
>* anything below that is empty
> It behaves as if the apple file system can't cope with the folder depth 
> of the lower level files in the bean-bake folder. But I am not a 
> computer expert adn that may be complete rubbish.
> I would be most grateful for any help that can be offered
> Thanks
> Richard
> 
>  -- 
>  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+unsubscr...@googlegroups.com.
>  To post to this group, send email to beancount@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/trinity-703d58fc-e627-4414-9191-c4b76b7cbc2b-1557148626744%403c-app-mailcom-bs06
>  
> <https://groups.google.com/d/msgid/beancount/trinity-703d58fc-e627-4414-9191-c4b76b7cbc2b-1557148626744%403c-app-mailcom-bs06?utm_medium=email&utm_source=footer>.
>  For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/2de489f9-3a19-4a09-bbe8-ae9e4d856f38%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Bitbucket] Issue #392: Booking method not applied when used in included file (blais/beancount)

2019-05-05 Thread Zhuoyun Wei
On Sun, May 5, 2019, at 20:51, francois PEGORY wrote:
> According me , I think either :
> 1) it is possible anywhere and it work as it was put in the main file.
> Easy to explain , hard to implement.
> 
> 2) if you put it in a file included, it raise a error.
> The only question is which directive are reserved for the main file. 
> First thought , include and options
> 
> What do you think ? 
> 

I'm with the second approach. Raising an error if any option directives are 
detected in included files is better than sliently ignoring the options and 
confusing (new) users.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/42a9180e-d023-46f4-be0e-c8a66993b5b1%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create a balance from the API

2019-05-04 Thread Zhuoyun Wei
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@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.
For more options, visit https://groups.google.com/d/optout.


Re: Moving assets with cost basis

2019-05-02 Thread Zhuoyun Wei
In case anyone encounters the same problem: one can edit the cost basis of 
transferred positions:

https://www.interactivebrokers.com/en/software/am/am/reports/positiontransferbasis.htm

-- 
Zhuoyun Wei

On Thu, May 2, 2019, at 01:39, Zhuoyun Wei wrote:
> I just run a custom report. Indeed the lot information is lost. The 
> purchase date and cost basis are both wrong. I'll contact IB custom 
> support to fix that...
> 
> -- 
> Zhuoyun Wei
> 
> On Wed, May 1, 2019, at 22:06, Justus Pendleton wrote:
> > On Thursday, May 2, 2019 at 12:48:34 AM UTC+7, Zhuoyun Wei wrote:
> > > One thing surprises me is that the receiving broker (InteractiveBrokers, 
> > > to be exact) does not preserve the cost basis. In its PDF statement and 
> > > the TWS, the cost basis of the inbound positions is the price when IBKR 
> > > receives the positions. It's my first time doing ACATS, so I have no idea 
> > > if this is a normal thing. 
> > 
> > I have done an ACATS to Interactive Brokers and it preserved my cost 
> > basis & the date of acquisition.
> > 
> > I would double check that the cost basis is actually gone. IB makes 
> > this surprisingly hard to verify. You need to create a custom report to 
> > see lots. Go to Statements, click the gear icon in Custom Statements on 
> > the right, click the + to create a new statement, and select "Open 
> > Positions" in the Sections. Then run that report and you can see all of 
> > your lots, with their date of acquisition and cost basis.
> > 
> > If it is wrong, I'd contact IB support and tell them to fix it. From 
> > what I gather, brokers are generally happy to put whatever you tell 
> > them in the cost basis data. After all, if it is wrong, they don't get 
> > in trouble with the tax authoritiesyou do.
> > 
> >  -- 
> >  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+unsubscr...@googlegroups.com.
> >  To post to this group, send email to beancount@googlegroups.com.
> >  To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/beancount/884c28a7-3deb-4301-bbc5-156d66aff085%40googlegroups.com
> >  
> > <https://groups.google.com/d/msgid/beancount/884c28a7-3deb-4301-bbc5-156d66aff085%40googlegroups.com?utm_medium=email&utm_source=footer>.
> >  For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/023a08bd-3a0a-4aff-b5a5-a162171600f5%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Moving assets with cost basis

2019-05-01 Thread Zhuoyun Wei
I just run a custom report. Indeed the lot information is lost. The purchase 
date and cost basis are both wrong. I'll contact IB custom support to fix 
that...

-- 
Zhuoyun Wei

On Wed, May 1, 2019, at 22:06, Justus Pendleton wrote:
> On Thursday, May 2, 2019 at 12:48:34 AM UTC+7, Zhuoyun Wei wrote:
> > One thing surprises me is that the receiving broker (InteractiveBrokers, to 
> > be exact) does not preserve the cost basis. In its PDF statement and the 
> > TWS, the cost basis of the inbound positions is the price when IBKR 
> > receives the positions. It's my first time doing ACATS, so I have no idea 
> > if this is a normal thing. 
> 
> I have done an ACATS to Interactive Brokers and it preserved my cost 
> basis & the date of acquisition.
> 
> I would double check that the cost basis is actually gone. IB makes 
> this surprisingly hard to verify. You need to create a custom report to 
> see lots. Go to Statements, click the gear icon in Custom Statements on 
> the right, click the + to create a new statement, and select "Open 
> Positions" in the Sections. Then run that report and you can see all of 
> your lots, with their date of acquisition and cost basis.
> 
> If it is wrong, I'd contact IB support and tell them to fix it. From 
> what I gather, brokers are generally happy to put whatever you tell 
> them in the cost basis data. After all, if it is wrong, they don't get 
> in trouble with the tax authoritiesyou do.
> 
>  -- 
>  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+unsubscr...@googlegroups.com.
>  To post to this group, send email to beancount@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/884c28a7-3deb-4301-bbc5-156d66aff085%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beancount/884c28a7-3deb-4301-bbc5-156d66aff085%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/95ebf171-25b6-485e-865f-c36a77268e61%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Moving assets with cost basis

2019-05-01 Thread Zhuoyun Wei
Thank you Justus! This is exactly what I want. Listing every lot is a bit 
verbose, but it's a once-in-a-while thing, so I am okay with it.

One thing surprises me is that the receiving broker (InteractiveBrokers, to be 
exact) does not preserve the cost basis. In its PDF statement and the TWS, the 
cost basis of the inbound positions is the price when IBKR receives the 
positions. It's my first time doing ACATS, so I have no idea if this is a 
normal thing.

Anyway, I am satifsfied that Beancount is able to keep the lots info (cost 
basis, date) even when the broker is unable to :-)

-- 
Zhuoyun Wei

On Wed, May 1, 2019, at 23:22, Justus Pendleton wrote:
> 
> On Wednesday, May 1, 2019 at 4:16:48 PM UTC+7, Zhuoyun Wei wrote:
> > 2019-01-01 * "ACATS" 
> >  Assets:BrokerA:Positions -10 ADSK {100.00 USD, 2017-02-01} 
> >  Assets:BrokerA:Positions -20 ADSK {110.00 USD, 2017-03-01} 
> >  Assets:BrokerB:Positions 30 ADSK {170.00 USD, 2019-01-01} 
> >  Income:PnL -1900.00 USD
> 
> If all you did is an in-kind transfer, there should be no alternation 
> to PnL, yeah? The way you've done this also throws away lot 
> information, which seems like something you probably want to keep.
> 
> The way I've done this is:
> 
> 2019-01-01 * "ACATS" 
>  Assets:BrokerA:Positions -10 ADSK {100.00 USD, 2017-02-01} 
>  Assets:BrokerA:Positions -20 ADSK {110.00 USD, 2017-03-01} 
>  Assets:BrokerB:Positions 10 ADSK {100.00 USD, 2017-02-01}
>  Assets:BrokerB:Positions 20 ADSK {110.00 USD, 2017-03-21}
> 
> 
>  -- 
>  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+unsubscr...@googlegroups.com.
>  To post to this group, send email to beancount@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/401d7fb5-8a20--b31c-0ede49724557%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beancount/401d7fb5-8a20--b31c-0ede49724557%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/b3191f48-94dd-464c-81b8-7a977d8c6a3c%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Moving assets with cost basis

2019-05-01 Thread Zhuoyun Wei
I kind of figured it out - one has to specify another cost basis and use PnL 
account to "absord" the difference:


2019-01-01 * "ACATS"
  Assets:BrokerA:Positions-30 ADSK {}
  Assets:BrokerB:Positions 30 ADSK {170.00 USD}
  Income:PnL


This becomes:


2019-01-01 * "ACATS"
  Assets:BrokerA:Positions   -10 ADSK {100.00 USD, 2017-02-01}
  Assets:BrokerA:Positions   -20 ADSK {110.00 USD, 2017-03-01}
  Assets:BrokerB:Positions30 ADSK {170.00 USD, 2019-01-01}
  Income:PnL-1900.00 USD  


This essentially liquidates and re-purchases all the stocks. I am not aware if 
there is another way that preserves the original cost basis. But I'm okay with 
this method now.

-- 
Zhuoyun Wei

On Wed, May 1, 2019, at 04:30, Zhuoyun Wei wrote:
> Hi,
> 
> I am trying to move my stocks to another broker with ACATS. The 
> transfer was a success, but I do not know how to record it in 
> Beancount. Here is a minimal bean file:
> 
> 
> option "operating_currency" "USD"
> 1970-01-01 open Assets:Bank:Checking
> 1970-01-01 open Assets:BrokerA:Cash
> 1970-01-01 open Assets:BrokerA:Positions "FIFO"
> 1970-01-01 open Assets:BrokerB:Cash
> 1970-01-01 open Assets:BrokerB:Positions "FIFO"
> 1970-01-01 open Equity:Transfers
> 
> 2017-01-01 * "ACH transfer to BrokerA"
>   Assets:Bank:Checking -1.00 USD
>   Equity:Transfers
> 
> 2017-01-05 * "Incoming ACH transfer"
>   Equity:Transfers
>   Assets:BrokerA:Cash   1.00 USD
> 
> 2017-02-01 * "Buy 10 ADSK"
>   Assets:BrokerA:Cash
>   Assets:BrokerA:Positions 10 ADSK {100.00 USD}
> 
> 2017-03-01 * "Buy 20 ADSK"
>   Assets:BrokerA:Cash
>   Assets:BrokerA:Positions 20 ADSK {110.00 USD}
> 
> 2019-01-01 price ADSK 170.00 USD
> 
> 2019-01-01 * "ACATS out"
>   Assets:BrokerA:Positions-30 ADSK {}
>   Assets:BrokerA:Cash  -13200.00 USD
>   Equity:Transfers
> 
> 2019-01-05 * "ACATS in"
>   Equity:Transfers
>   Assets:BrokerB:Positions   30 ADSK {}
>   Assets:BrokerB:Cash   13200.00 USD
> 
> 
> I realize the "ACATS in" transaction may be incorrect, but even the 
> "ACATS out" transaction raises an error:
> 
> acats.bean:33:  Too many missing numbers for currency group 'USD'
> 
> I have tried various ways to amend the transaction with no success. 
> Even if I tried to move only the positions directly to another broker, 
> it does not work:
> 
> 2019-01-01 * "ACATS out"
>   Assets:BrokerA:Positions-30 ADSK {}
>   Assets:BrokerB:Positions
> 
> ^ this raises a "Too many missing numbers for currency group 'USD'" error.
> 
> Another attempt was:
> 
> 2019-01-01 * "ACATS out"
>   Assets:BrokerA:Positions-30 ADSK {}
>   Assets:BrokerB:Positions 30 ADSK {}
> 
> ^ this raises two errors:
> 
> acats.bean:29:  Failed to categorize posting 2
> acats.bean:32:  Too many missing numbers for currency group 'USD'
> 
> 
> Could anyone tell me the proper way to move positions, please?
> 
> -- 
> 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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/ad1182d8-948d-4b45-9984-423ec9f98792%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Moving assets with cost basis

2019-05-01 Thread Zhuoyun Wei
Hi,

I am trying to move my stocks to another broker with ACATS. The transfer was a 
success, but I do not know how to record it in Beancount. Here is a minimal 
bean file:


option "operating_currency" "USD"
1970-01-01 open Assets:Bank:Checking
1970-01-01 open Assets:BrokerA:Cash
1970-01-01 open Assets:BrokerA:Positions "FIFO"
1970-01-01 open Assets:BrokerB:Cash
1970-01-01 open Assets:BrokerB:Positions "FIFO"
1970-01-01 open Equity:Transfers

2017-01-01 * "ACH transfer to BrokerA"
  Assets:Bank:Checking -1.00 USD
  Equity:Transfers

2017-01-05 * "Incoming ACH transfer"
  Equity:Transfers
  Assets:BrokerA:Cash   1.00 USD

2017-02-01 * "Buy 10 ADSK"
  Assets:BrokerA:Cash
  Assets:BrokerA:Positions 10 ADSK {100.00 USD}

2017-03-01 * "Buy 20 ADSK"
  Assets:BrokerA:Cash
  Assets:BrokerA:Positions 20 ADSK {110.00 USD}

2019-01-01 price ADSK 170.00 USD

2019-01-01 * "ACATS out"
  Assets:BrokerA:Positions-30 ADSK {}
  Assets:BrokerA:Cash  -13200.00 USD
  Equity:Transfers

2019-01-05 * "ACATS in"
  Equity:Transfers
  Assets:BrokerB:Positions   30 ADSK {}
  Assets:BrokerB:Cash   13200.00 USD


I realize the "ACATS in" transaction may be incorrect, but even the "ACATS out" 
transaction raises an error:

acats.bean:33:  Too many missing numbers for currency group 'USD'

I have tried various ways to amend the transaction with no success. Even if I 
tried to move only the positions directly to another broker, it does not work:

2019-01-01 * "ACATS out"
  Assets:BrokerA:Positions-30 ADSK {}
  Assets:BrokerB:Positions

^ this raises a "Too many missing numbers for currency group 'USD'" error.

Another attempt was:

2019-01-01 * "ACATS out"
  Assets:BrokerA:Positions-30 ADSK {}
  Assets:BrokerB:Positions 30 ADSK {}

^ this raises two errors:

acats.bean:29:  Failed to categorize posting 2
acats.bean:32:  Too many missing numbers for currency group 'USD'


Could anyone tell me the proper way to move positions, please?

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/bd491d0d-f6ec-43f4-b3ff-f9b2ec517953%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Auto assign to account / rename payees

2019-04-30 Thread Zhuoyun Wei
On Sat, Apr 27, 2019, at 18:28, Florian Lindner wrote:
> + How can I detect duplicates when I try to import the same transaction twice?

You should try zerosum plugin [1], possibly with my patch [2].

I used to do de-dup by add `__duplicate__` meta key to the transaction by 
matching narrations when importing. However, zerosum plugin provides a much 
simpler way: Just posting each duplicating transaction to a "ZeroSumAccount", 
and the plugin will match them for you. This way, you do not need to do de-dup 
at all.

Another good thing about using zerosum is that you do not have to "smudge" the 
date of one transaction while doing non-instantaneous transactions (e.g. from 
your checking account to your credit card).


[1] https://github.com/redstreet/beancount_plugins_redstreet/tree/master/zerosum
[2] https://github.com/redstreet/beancount_plugins_redstreet/pull/2

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/7db0ff4e-9761-4723-b006-7c1a0be47069%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is best way to track not only food item, but also how much it costed per pound.

2019-04-15 Thread Zhuoyun Wei
The proper way to do this is to use price notation "@" and "@@". But that may 
be an overkill since you may have many different items to track.

Another method would be to write the information you would like to keep in the 
metadata.

-- 
Zhuoyun Wei

On Tue, Apr 16, 2019, at 05:04, mplo...@gmail.com wrote:
> Guys hi,
> 
> Before i was tracking food in 1 single account
> 
> Expenses:Personal:Food
> 
> But than i tried to split them in particular food categories
> 
> Expenses:Personal:Food:Fruit:Apples
> Expenses:Personal:Food:Meat:Beef
> etc
> 
> And found out that this way i can see much more clear picture and that 
> i started to care how much i actually paid per pound.
> i've found out that often price on same food item can very greatly 
> (apples can cost 0.99lb, 1.49lb and 1.99lb for same variety even in 
> same market)
> 
> What's the best way to track it?
> 
> Let's say now i have
> 
> 2019-03-01 * "Key Foods"
>  Expenses:Personal:Food:Fruit:Apples 4.17 USD
>  Assets:Cash 
> 
> 2019-03-15 * "Key Foods"
>  Expenses:Personal:Food:Fruit:Apples 6.44 USD
>  Assets:Cash 
> 
> 2019-04-01 * "Key Foods"
>  Expenses:Personal:Food:Fruit:Apples 8.01 USD
>  Assets:Cash 
> 
> And there is no way to tell which of these transactions were a good buy 
> (for 0.99lb), and which were a more careless buy (for 1.99lb).
> 
>  -- 
>  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+unsubscr...@googlegroups.com.
>  To post to this group, send email to beancount@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/1f04b82a-f4b1-49c9-a08d-c032aec888ed%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beancount/1f04b82a-f4b1-49c9-a08d-c032aec888ed%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/a18ff2ab-5e9d-4793-a231-77e54fcb9716%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: LWN reviews beancount

2019-04-13 Thread Zhuoyun Wei
On Sun, Apr 14, 2019, at 06:09, rse...@gmail.com wrote:
> Rather than booking outstanding checks as an asset under 
> "Assets:Chase:Checking:Payable", you could track them under 
> Liabilities. Here's how I handle checks:
> 
> 2019-03-01 * "My Building" "March 2019 Rent" #rent
>  Liabilities:AccountsPayable 1000.00 USD
>  Assets:Checking:Chase
> 
> 2019-03-10 * "My Building" "Check #12345" #rent
>  Liabilities:AccountsPayable -1000.00 USD
>  Expenses:Rent:MyAddress
> 
> This way, the money "leaves" your checking account as soon as you write 
> the check, but it is still tracked as an outstanding liability. When 
> the check is cached, it gets booked under the appropriate expense 
> account.

I also considered booking the outstanding checkings in another account, like 
Liabilities or Equities, but the problem with this is that the balance of your 
checking account in Beancount is different than the balance in your bank, so 
that you cannot use "balance" directive to assert the balance.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/78518727-8986-4dce-b3a4-4b3f826966cf%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: LWN reviews beancount

2019-04-13 Thread Zhuoyun Wei
On Sun, Apr 14, 2019, at 02:11, Aamer Abbas wrote:

> In this case, the hierarchy does matter since the balance directive 
> will sum up to the parent account. Similarly, Fava's UI seems to also 
> indicate that hierarchy is important.

Fava does quite a nice job handling this:

- if the parent account has no balance, the UI shows a grey number (the sum of 
all child accounts);
- if the parent account has balance, the UI shows a black number (the balance 
of the parent account);
- if you fold the parent account tree, the UI always shows a grey number (the 
sum of all child accounts).

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/73183454-a1d9-4292-ba50-a14c040aee53%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: LWN reviews beancount

2019-04-13 Thread Zhuoyun Wei
One thing that surprises me (I noticed this just now, when writing the last 
reply) is that Beancount "balance" directive computes the balance of the parant 
account along with all child accounts.

Say you have 1000.00 USD in the checking account, and you write a check of 
100.00 USD to your friend. Now you have 900.00 USD in the parent account alone 
and 100.00 USD in the child / leaf ":Payable" account. And the assertion:

20XX-XX-XX balance Assets:Bank:Checking 1000.00 USD

passes. This very behavior makes it easy for you to compare the balance in 
Beancount with the balance in your bank. At the same time, you could know how 
many money you could spend (without overdraft) by manually subtract the amount 
in ":Payable" from the parent tree.

-- 
Zhuoyun Wei

On Sat, Apr 13, 2019, at 20:44, Zhuoyun Wei wrote:
> In the case of writing checks, my approach is to use two transactions:
> 
> 
> 2019-01-01 * "John Doe" "Settle up Splitwise" #check ^check123
>   Assets:Chase:Checking   -100.00 USD
>   Assets:Chase:Checking:Payable
> 
> 2019-02-01 * "CHECK 123" ^check123
>   document: "2019-02-01.check-123.pdf"
>   Assets:Chase:Checking:Payable -100.00 USD
>   Equity:ARAP:JohnDoe
> 
> 
> The first trasnaction is entered manually by me, on the day of writing 
> the check, in a separate file ("checks.bean"). The second transaction 
> is imported by "bean-extract" from the CSV my bank provides, at the end 
> of each month (along with the image of the check).
> 
> Sometimes it takes quite a while for your checks to clear, so using two 
> transactions is essential. This way, you can easily determine how many 
> checks and money are not cleared by examing the transactions in the 
> ":Payable" account, and also avoid blank checks / NSF by examing the 
> balance of the parant account (excluding the leaf account). The bonus 
> touch is, the two transactions are linked ("^check123"), so in Fava you 
> could click the link to show corresponding trasactions, no matter how 
> many days they are apart.
> 
> I remember someone in the mailing list wrote a plugin called 
> ZeroSumAccounts, which did similar things.
> 
> 
> -- 
> Zhuoyun Wei
> 
> On Sat, Apr 13, 2019, at 12:43, Martin Michlmayr wrote:
> > * Zhuoyun Wei  [2019-04-12 23:27]:
> > > > For example, there is no way in the base format to note whether a 
> > > > transaction has been reconciled or not.
> > > By "reconciled", I am assuming the LWN editor is refer to the difference 
> > > between "*" and "!" transactions?
> > 
> > I'm not sure what his process is exactly.  Using flags might be part
> > of it.
> > 
> > But it might also be things like: when you write a check, you create a
> > transaction for the check (normally you record the money as leaving
> > your bank account when you write the check and not when the person
> > deposits the check, but in reality the money is on your bank account
> > until it gets deposited by the other person).  So you may have to
> > reconcile why your bank account balance is different to what your
> > books say by looking at a list of uncashed checks.
> > 
> > That kind of things.  Basically, your books won't always show bank
> > account balances all the time.
> > 
> > -- 
> > Martin Michlmayr
> > https://www.cyrius.com/
> >

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/360165f8-609c-4c84-a66b-77fe80458421%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: LWN reviews beancount

2019-04-13 Thread Zhuoyun Wei
In the case of writing checks, my approach is to use two transactions:


2019-01-01 * "John Doe" "Settle up Splitwise" #check ^check123
  Assets:Chase:Checking   -100.00 USD
  Assets:Chase:Checking:Payable

2019-02-01 * "CHECK 123" ^check123
  document: "2019-02-01.check-123.pdf"
  Assets:Chase:Checking:Payable -100.00 USD
  Equity:ARAP:JohnDoe


The first trasnaction is entered manually by me, on the day of writing the 
check, in a separate file ("checks.bean"). The second transaction is imported 
by "bean-extract" from the CSV my bank provides, at the end of each month 
(along with the image of the check).

Sometimes it takes quite a while for your checks to clear, so using two 
transactions is essential. This way, you can easily determine how many checks 
and money are not cleared by examing the transactions in the ":Payable" 
account, and also avoid blank checks / NSF by examing the balance of the parant 
account (excluding the leaf account). The bonus touch is, the two transactions 
are linked ("^check123"), so in Fava you could click the link to show 
corresponding trasactions, no matter how many days they are apart.

I remember someone in the mailing list wrote a plugin called ZeroSumAccounts, 
which did similar things.


-- 
Zhuoyun Wei

On Sat, Apr 13, 2019, at 12:43, Martin Michlmayr wrote:
> * Zhuoyun Wei  [2019-04-12 23:27]:
> > > For example, there is no way in the base format to note whether a 
> > > transaction has been reconciled or not.
> > By "reconciled", I am assuming the LWN editor is refer to the difference 
> > between "*" and "!" transactions?
> 
> I'm not sure what his process is exactly.  Using flags might be part
> of it.
> 
> But it might also be things like: when you write a check, you create a
> transaction for the check (normally you record the money as leaving
> your bank account when you write the check and not when the person
> deposits the check, but in reality the money is on your bank account
> until it gets deposited by the other person).  So you may have to
> reconcile why your bank account balance is different to what your
> books say by looking at a list of uncashed checks.
> 
> That kind of things.  Basically, your books won't always show bank
> account balances all the time.
> 
> -- 
> Martin Michlmayr
> https://www.cyrius.com/
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/f3e75f53-e59e-4b50-8a56-14f11b24a650%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: LWN reviews beancount

2019-04-12 Thread Zhuoyun Wei
> For example, there is no way in the base format to note whether a transaction 
> has been reconciled or not.

By "reconciled", I am assuming the LWN editor is refer to the difference 
between "*" and "!" transactions?

-- 
Zhuoyun Wei

On Fri, Apr 12, 2019, at 13:42, Martin Michlmayr wrote:
> LWN has reviewed beancount to see if it would fit their needs:
> 
> https://lwn.net/SubscriberLink/785553/39167e23980e7e4c/
> 
> -- 
> Martin Michlmayr
> https://www.cyrius.com/
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/20190412054207.GF1719%40jirafa.cyrius.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/e6130a1a-c680-46b1-a9ff-23b2b3c4fea2%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Matching account by filename

2019-04-05 Thread Zhuoyun Wei
Thanks. My current workflow is to use "bean-extract" to extract transactions 
from multiple CSV files downloaded from different institutions. I have been 
using this workflow for a few years, until recently I opened a savings account.

I will look into how to use the importer directly, instead of using 
"bean-extract".

-- 
Zhuoyun Wei

On Thu, Apr 4, 2019, at 11:38, Aamer Abbas wrote:
> By the way, just wanted to note this is for extraction purposes since 
> you need to use a different account based on the file name. If it's 
> only for identification purposes, the identifier mixin already supports 
> matching on the file name 
> (https://bitbucket.org/blais/beancount/src/fa1edde3bcd02a277fac193f460a39c9a1461161/beancount/ingest/importers/mixins/identifier.py?at=default&fileviewer=file-view-default#identifier.py-32)
> 
> On Thu, Apr 4, 2019 at 6:35 PM Aamer Abbas  wrote:
> > You can't do it with the CSV importer the way it's currently written. You 
> > will need to write your own importer. 
> > 
> > Something like this, but obviously refactored in a nicer way.
> > 
> >  def extract(self, file):
> >  file_name = path.basename(file.name)
> > 
> >  if file_name == "something.csv":
> >  account = "Assets:US:Something"
> >  elif file_name == "something_else.csv"
> >  account = "Assets:US:SomethingElse"
> > 
> > On Thu, Apr 4, 2019 at 11:33 AM Zhuoyun Wei  wrote:
> >> Hi,
> >> 
> >>  the CSV importer determines the account to use by "regexps" parameter. I 
> >> have two accounts from the same bank (one checking and one savings), and 
> >> the CSV files of both are of the same format. There isn't anything in the 
> >> file content that could tell the two accounts apart. The only difference 
> >> is the file name (e.g. "Chase.csv" for checking, "Chase.csv" for 
> >> savings).
> >> 
> >>  Under this circumstance, "regexps" parameter does not work. How could I 
> >> import different files into different accounts?
> >> 
> >>  -- 
> >>  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+unsubscr...@googlegroups.com 
> >> <mailto:beancount%2bunsubscr...@googlegroups.com>.
> >>  To post to this group, send email to beancount@googlegroups.com.
> >>  To view this discussion on the web visit 
> >> https://groups.google.com/d/msgid/beancount/17beda3b-4862-44e8-b839-51aaf6d573f8%40www.fastmail.com.
> >>  For more options, visit https://groups.google.com/d/optout.
> 
>  -- 
>  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+unsubscr...@googlegroups.com.
>  To post to this group, send email to beancount@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/CAOHSxbnuC06TGuyP9C2a_1dZM_znUYfHuJMhSRNqjPByHc%3D7Lw%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/beancount/CAOHSxbnuC06TGuyP9C2a_1dZM_znUYfHuJMhSRNqjPByHc%3D7Lw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>  For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/3f414514-d832-407b-954a-2bc55be4a842%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Matching account by filename

2019-04-04 Thread Zhuoyun Wei
Hi,

the CSV importer determines the account to use by "regexps" parameter. I have 
two accounts from the same bank (one checking and one savings), and the CSV 
files of both are of the same format. There isn't anything in the file content 
that could tell the two accounts apart. The only difference is the file name 
(e.g. "Chase.csv" for checking, "Chase.csv" for savings).

Under this circumstance, "regexps" parameter does not work. How could I import 
different files into different accounts?

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/17beda3b-4862-44e8-b839-51aaf6d573f8%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can i distribute amounts between several accounts based on set % or ratio?

2018-12-01 Thread Zhuoyun Wei
2018-12-01 20:43:39 Martin Blais :
> On Sat, Dec 1, 2018 at 11:23 AM Zhuoyun Wei  wrote:
> 
> 2018-11-29 21:38:57 Justus Pendleton :
> > On Friday, November 30, 2018 at 7:27:11 AM UTC+7, mpl...@gmail.com 
> wrote:
> >
> >     Let say i have transactions going into account Expenses:Rent, and i 
> would like 60% of total go to
> >     Expenses:Rent:Personal and 40% to Expenses:Rent:Business,
> >     what's the best way to do it?
> >
> >
> > I think the best way is to just be explicit and write: $600 to one and 
> $400 to the other. 
> >
> > If you really want to though, beancount supports simple math 
> expressions so you can write:
> >
> > Expenses:Rent:Personal (1,000 * 0.6) USD
> > Expenses:Rent:Business (1,000 * 0.4) USD
> >
> TIL Beancount supports basic math expressions!
> 
> I have quite a lot of transactions that need to be split by ratio
> (shared expenses with roommates). Each time I have to calculate the
> shares myself and fill in the result. This is lifesaver!
> 
> 
> If you have a really specific need you could also write a plugin.
> I do that for sharing expenses, e.g. I trigger filling off of a tag.
> IIRC Ledger supports % as amounts, but I've never looked at how it actually 
> works.
> One way it could make sense would be to sum up the postings with non-% 
> amounts, and fill in - like when you omit the
> amount - with the % of the remainder. We'd have to also check that the 
> amounts sum up to 100% (or rely on the balance
> to fail).
> Anyhow, I don't think it's a super common usage, and using ratios as you 
> suggested works well.
> 

I had always thinking about writing my own plugins. But I prefer to
keep my repo in a self-contained way. That is to say, I do not want to
modify PYTHONPATH each time I run bean-* commands / fava, nor do I want
to put my plugin outside the repo. So I am counting on this issue to be
resolved: 
https://bitbucket.org/blais/beancount/issues/214/add-top-level-directory-to-syspath
(I may try to be helpful if possible).

Currently the new discovery of math expressions in Amount helps a lot. I
can now just append "/ 2" to those expenses that shared with my
roommate, instead of caculating the shares myself.
> 
>  
> 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20181202025039.GA4698%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: How can i distribute amounts between several accounts based on set % or ratio?

2018-12-01 Thread Zhuoyun Wei
2018-11-29 21:38:57 Justus Pendleton :
> On Friday, November 30, 2018 at 7:27:11 AM UTC+7, mpl...@gmail.com wrote:
> 
> Let say i have transactions going into account Expenses:Rent, and i would 
> like 60% of total go to
> Expenses:Rent:Personal and 40% to Expenses:Rent:Business,
> what's the best way to do it?
> 
> 
> I think the best way is to just be explicit and write: $600 to one and $400 
> to the other. 
> 
> If you really want to though, beancount supports simple math expressions so 
> you can write:
> 
> Expenses:Rent:Personal (1,000 * 0.6) USD
> Expenses:Rent:Business (1,000 * 0.4) USD
> 
TIL Beancount supports basic math expressions!

I have quite a lot of transactions that need to be split by ratio
(shared expenses with roommates). Each time I have to calculate the
shares myself and fill in the result. This is lifesaver!
> 
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> 6b3aedf9-1da8-4983-94f1-4cb3b502f7f8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20181201162321.GA9380%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Sorting of bean-extract output

2018-11-29 Thread Zhuoyun Wei
2018-11-29 14:14:44 Oon-Ee Ng :
> On Thu, Nov 29, 2018 at 2:06 PM Daniele Nicolodi  wrote:
> 
> On 28/11/2018 20:53, Martin Blais wrote:
> >     The current source file for importing that I'm working on lists
> >     transaction in reverse chronological order (I want chronological, in
> >     this case) but also has a reference number that is monotonically
> >     increasing. So my current hack is to set line number for the
> >     transactions to be that reference number.
> >
> >
> > That seems not unlike the idea of storing the time in metadata -
> > discussed in a prior thread but not yet implemented - and to use that as
> > a secondary sort key. Maybe I can generalize this idea of a secondary
> > sort key to let users put whatever they want in there (as long as the
> > type is comparable, for sorting).
> 
> Aren't directives written in the order in which they are returned by the
> importer?  I didn't see any mention of the fact that bean-extract does
> any sorting on its own in the documentation, but I may have missed it.
> 
> Cheers,
> Dan
> 
> 
> That was my impression as well, but after testing it out I found this was not 
> the case. The returned ordered list of
> transactions is then sorted by date and line number. 
> 

I was once troubled by this sorting behaviour as well. Intra-day
transactions are sorted reverse-chronologically (newer to older) in the
CSV file exported from my bank. My importer parses the entries in
reversed order, returning a correctly ordered list of transactions
(older to newer). However, Beancount will again sort the list returned
by importer, shuffling the intra-day transactions:

https://github.com/beancount/beancount/blob/fb2d29eed89a8e15f1635847beba0e5598c0ea06/beancount/ingest/extract.py#L73-L74

I had once submitted a pull request to disable this behaviour, it was
merged but later reverted by Martin.

So I came up with a workaround:

```
# Re-generate "lineno" to force sorting
for lineno, entry in enumerate(entries, start=1):
entry.meta['lineno'] = lineno
```

Just generate artificial "lineno" keys and insert them into the
transactions before returning them to Beancount. This way I can preserve
the order.

A possible approach to make both parties happy would be to add a new
parameter to "extract_from_file()" function, allowing importers to
disable the sorting behaviour in post-processings.


> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> CAGQ70esZ%2BSFkn4VcaG1dh%2BP1i%3DNgQ9rHvSdx-_8eVKvJ1%3DcRMg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20181129151330.GA28669%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: [v2.1.3] Path should be absolute in order to guarantee a single call.

2018-10-17 Thread Zhuoyun Wei
I encountered this as well.

Prepending $(pwd) to the shell call does solve the problem but renders
shell auto-completion useless.

For now, I just added "filename = os.path.abspath(filename)" to the
assert statement where the exception raises.


2018-10-14 20:29:31 shreedharhardi...@gmail.com :
> Hi, 
> 
> In beancount version 2.1.3, bean-identify (and bean-extract) now needs the 
> input directory to be specified with it's
> full absolute path, or else it gives an error:
> 
> 
> $ bean-identify  config.py input/
>  input/History.csv
> Traceback (most recent call last):
>   File "/usr/local/bin/bean-identify", line 4, in 
>     from beancount.ingest.identify import main; main()
>   File "/usr/local/lib/python3.7/site-packages/beancount/ingest/identify.py", 
> line 104, in main
>     return scripts_utils.trampoline_to_ingest(sys.modules[__name__])
>   File 
> "/usr/local/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", 
> line 132, in trampoline_to_ingest
>     return run_import_script_and_ingest(parser)
>   File 
> "/usr/local/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", 
> line 202, in
> run_import_script_and_ingest
>     return ingest(importers_list, abs_downloads)
>   File 
> "/usr/local/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", 
> line 102, in ingest
>     args.command(args, parser, importers_list, args.downloads)
>   File "/usr/local/lib/python3.7/site-packages/beancount/ingest/identify.py", 
> line 100, in run
>     return identify(importers_list, files_or_directories)
>   File "/usr/local/lib/python3.7/site-packages/beancount/ingest/identify.py", 
> line 83, in identify
>     logfile=logfile):
>   File "/usr/local/lib/python3.7/site-packages/beancount/ingest/identify.py", 
> line 60, in find_imports
>     file = cache.get_file(filename)
>   File "/usr/local/lib/python3.7/site-packages/beancount/ingest/cache.py", 
> line 132, in get_file
>     "Path should be absolute in order to guarantee a single call.")
> AssertionError: Path should be absolute in order to guarantee a single call.
> 
> This issue is not present in beancount version 2.1.2.
> 
> I feel like the bug stems from recent changes in this commit. The full path 
> is compute in scripts_utils.py:202, but
> then is replaced in the final call in scripts_utils.py:102 by args.download 
> which doesn't have the full path. (Also
> strangely the function at line 102, expects its second argument as 
> "detect_duplicates_func", and not a string (or list
> of strings) with file path(s)). Anyway, I hope this helps diagnose it.
> 
> I'm not sure of the complexity of the fix, though. A work around is to call 
> the scripts like follows:
> 
> $ bean-identify  config.py $(pwd)/input/
> 
> 
> Thanks,
> Shreedhar
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> 709141d5-88a4-444a-acef-94bf43a9b388%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20181017080205.GA29643%40herus.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: How showing fava statements decimal?

2018-05-18 Thread Zhuoyun Wei
I believe this may have something to do with the precision of inferred
numbers. Try padding every number in your file to 2 decimal digits:

95 CNY -> 95.00 CNY
0.2 CNY -> 0.20 CNY

... and see if that solves your issue.


2018-05-18 00:35:39 pannaimage...@gmail.com :
> I'm writen in .beancount file transactions with decimal.but assets of balance 
> sheet showing integer look:
> 
> [ScreenClip]
> 
> [ScreenClip]
> 
> 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180518160928.GA26303%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Beancount 2.1.0 release

2018-05-13 Thread Zhuoyun Wei
Oh sorry. I did not see the other thread. The issue is already fixed.

-- 
Zhuoyun Wei

On Sun, May 13, 2018, at 15:57, Zhuoyun Wei wrote:
> Congratulations!
> 
> I'm trying to update the AUR package of beancount but encountered the
> following error when running setup.py:
> 
> 
> ==> Starting package()...
> Traceback (most recent call last):
>   File "setup.py", line 172, in 
> shell=False)
>   File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
> **kwargs).stdout
>   File "/usr/lib/python3.6/subprocess.py", line 403, in run
> with Popen(*popenargs, **kwargs) as process:
>   File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
> restore_signals, start_new_session)
>   File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
> raise child_exception_type(errno_num, err_msg, err_filename)
> FileNotFoundError: [Errno 2] No such file or directory: 'hg': 'hg'
> ==> ERROR: A failure occurred in package().
> Aborting...
> 
> 
> I do not have Mercury installed. It seems to my the setup.py is trying
> to invoke `hg` even if it is not avaiable[sic].
> 
> If I am not mistaken, this is not the intended behaviour:
> 
> 
> 2018-05-06
>   - Changes to support git versioning if hg versioning is not available.
> 
> 
> Looking into setup.py, the try-except clause only catches
> subprocess.CalledProcessError but not FileNotFoundError.
> 
> 
> 
> 2018-05-12 00:51:21 Martin Blais :
> > Releasing 2.1.0.
> > This release focused on merging various long-standing pull requests adding 
> > features desired by users.
> > 
> > - UTF8 support
> > - Support for transaction tags and links in indented postings block in 
> > grammar
> > - CI build setup (Bitbucket Pipelines and Travis-CI on github)
> > - Performance improvements from dict implementation changes
> > - Globbing patterns in include statements
> > - Patches to fix specific SQL bugs encountered by users (and new functions 
> > added)
> > - Updated price source importers (Yahoo), added IEX & Quandl, deleted 
> > Google Finance
> > - Clarified timezone usage in price source importers
> > - Removed dependency on "zip" UNIX tool for Windows support, added 
> > dependency on "requests" package
> > 
> > Thanks to Martin Michlmayr, Ethan Glasser-Camp, Jakob Schnitzer, Adrian 
> > Medrano Calvo, Johannes Harms, Patrick
> > Ruckstuhl, Hugo Ideler for pull requests merged in this release.
> > Full changelog below.
> > 
> > 
> > 
> > 
> > * Version: 2.1.0
> > 
> > 2018-05-12
> > 
> > - Added back lexer test from Adrian Medrano Calvo's UTF8 changes to head.
> > 
> > 
> > 2018-05-08
> > 
> > - Fixed #287: In the price fetcher, store the datetime instances as
> > naive-in-UTC in order to avoid a serialization problem with older Python
> > versions.
> > 
> > 
> > 2018-05-06
> > 
> > - Changes to support git versioning if hg versioning is not available.
> > 
> > 
> > 2018-05-05
> > 
> > - Fixed #289: Add option to find beancount version. All scripts now support
> > --version.
> > 
> > - Amended PR64 to remove the need for __getitem__(). Clarified docstring.
> > 
> > - Merged PR64 from Jakob Schnitzer: Inventory: use dict instead of list as a
> > base.
> > 
> > 
> > 2018-05-04
> > 
> > - Fixed #290: Validation of account name components was incorrectly swapped.
> > 
> > 
> > 2018-05-03
> > 
> > - Amended PR74: Adding a new unit test, fail if tags / link appear after the
> > first posting. Performance amendment to tags/links and clarification to the
> > freezing of tags & links and their default values.
> > 
> > - Merged PR74 / Fixed #99: Allow tags and links to be spread over several
> > lines.
> > 
> > - Amended PR14: added simple unit testing for regexp, changes in parsing 
> > UTF-8
> > account type to match changes in Beancount head.
> > 
> > - Merged PR14 by Adrian Medrano Calvo: Support account names to consist of
> > Unicode letters and numbers.
> > 
> > 2018-05-02
> > 
> > - Removed a few accidental __author__ metadatas from files, normalized to
> > __copyright__ as all other files.
> > 
> > 
> > 2018-05-01
> > 
> > - Added patch for clean build for lexer. 2.6.1 results in a build warning.
> > 
> > - Merged PR73 (Ethan Glasser-Camp) - Cleanups to lexer and more restrictive
> &

Re: Beancount 2.1.0 release

2018-05-13 Thread Zhuoyun Wei
ons to also accept a RowContext object, as
> the simple functions may be called in either entry or posting context.
> 
> (The SQL shell remains the part of Beancount which is severely undertested
> and wading into that code once again has convinced me I need to rewrite the
> shell from scratch, it'll be simpler and better. The distinction between
> entry and posting context will go away in the next version.)
> 
> - Fixed #120: Documents directive with a trailing slash fails.
> 
> 
> 2018-03-28
> 
> - Fixed failing test in amount_test probably due to some recent merges.
> 
> 
> 2018-03-27
> 
> - Completed PR #59 which adds support for globbing patterns in includes,
> inserting a chdir() around glob.glob() to handle expansion of relative
> filenames. (Credits to Martin Michlmayr for submitting the patch in the
> first place.)
> 
> 
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> CAK21%2BhMA_Vc%2ByRSmBcZPHWUVDjvpk-Wp5toE8LtEWqsg4gixNQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180513075731.GA27520%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Issue #292: bean-report networth does not show all operating currencies (blais/beancount)

2018-05-09 Thread Zhuoyun Wei
New issue 292: bean-report networth does not show all operating currencies
https://bitbucket.org/blais/beancount/issues/292/bean-report-networth-does-not-show-all

Zhuoyun Wei:

Hi,

from the code in `reports/holdings_reports.py`, the `bean-report foo.bean 
networth` command should show all the defined operating currencies. But it 
shows only the first only.

Here is a minimal example:

```
option "operating_currency" "CNY"
option "operating_currency" "USD"

1970-01-01 open Income:Salary
1970-01-01 open Assets:Checking

2018-05-01 * "Salary 1"
  Income:Salary-1.00 CNY
  Assets:Checking

2018-05-02 * "Salary 2"
  Income:Salary -5000.00 USD
  Assets:Checking
```

```
$ bean-report networth.bean networth
Currency  Net Worth
  -
CNY   10,000.00
  -
```

There are two operating currencies defined, CNY and USD, and only CNY is shown. 
If I swap the place, put USD before CNY:

```
option "operating_currency" "USD"
option "operating_currency" "CNY"
```

... then only USD is shown, and CNY is missing this time.

I am using tagged 2.0.0 release.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180510050705.29299.18710%40celery-worker-105.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.


Re: smart_importer

2018-04-18 Thread Zhuoyun Wei
I got it working, as well. Currently I am using (hard-coded) Python
dict to add a second posting to an newly extracted transaction based on
Trasaction.narration.

This ML is the far more advanced technology!

(There is a bug: If there is a Balance entry, or any other
non-Trasaction entry in the entries returned by the importer, the ML
crashes with a cryptic traceback.)


2018-04-17 20:11:50 Martin Blais :
> Works great on my credit card account!
> https://github.com/johannesjh/smart_importer
> 
> Another way I'm finding I'd like to invoke this is by invocation of an Emacs 
> binding to auto-complete one particular
> transaction based on a stored model.
> Basically put the cursor over an incomplete transaction and have it be 
> completed by the ML classification.
> Just an idea.
> 
> Awesome work! :-)
> 
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> CAK21%2BhM-FDXwjM%2BtwCDDZUWpFyeFLBJpdtbVjbiF9VmqFT%2BD9A%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180418113832.GA15981%40herus.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Implicit rounding of inferred numbers

2018-04-04 Thread Zhuoyun Wei
2018-04-04 02:51:03 Martin Blais :
> 
> I believe you may have misunderstood my explanation.
> The interpolated number for cash /does/ use the inferred tolerance from this 
> transaction to round it to a reasonable
> value.
> 
> 
Oh, okay. This is surprising indeed. I thought Beancount is very strict
on internal calculation so the rounding only occurs when the result is
for human eyes (e.g. PRINT). I never though Beancount does implicit
rounding for non-human-readable things...

Is there a reason for such a design? The product of two
two-decimal-digit numbers is only a four-decimal-digit number. It is
even not bad for human eyes IMHO.

> 
> Is there a way to turn off the implicit rounding without padding 0.1 USD
> to 0.1000 USD?
> 
> 
> Not at the moment, no.
> 
> What you could do is ensure your importer always formats those floating-point 
> numbers with two digits of precision.
> 

Thanks. I'll take care of the decimal digits in the importer in the
future.

> (I'm wondering if, in addition to 
> - the tolerance and 
> - the rendering precision, 
> we should be able to set 
> - the rounding resolution
> in those new options I'll add to override all the inferred values.)
> 
> 

Sounds like a good idea! For the pedant and the OCD, turning of rounding
all entirely is a good choice :-)

> 
> 
> 2018-04-04 01:53:19 Martin Blais :
> > This is correct.
> >
> > First, the PRINT command of the shell (which is what I believe you're 
> using) will render the numbers at their
> stored
> > precision:
> > 
> https://bitbucket.org/blais/beancount/src/4a3995617e7df5ffa3377711382c7ad2f9d8935b/beancount/query/
> query_execute.py?at=
> > default&fileviewer=file-view-default#query_execute.py-92
> >
> > I kept it this way originally because PRINT was intended for debugging, 
> so rounding using the most common
> precision
> > seen in the file seemed it would create problems with interpreting the 
> data.  I'm not 100% this was the right
> choice.
> >
> > Second, about rounding: by default the tolerance used is that which is 
> inferred on the transaction:
> > 
> https://bitbucket.org/blais/beancount/src/4a3995617e7df5ffa3377711382c7ad2f9d8935b/beancount/core/interpolate.py?
> at=
> > default&fileviewer=file-view-default#interpolate.py-324
> >
> > The comment you're referring to applies to the case where a tolerance 
> cannot be inferred at all (like in the
> first
> > example in that section). In that case, no rounding occurs. I'll 
> clarify the docs.
> >
> > (This hurts my head too.)
> >
> >
> >
> >
> > On Sun, Apr 1, 2018 at 5:13 AM, Zhuoyun Wei  wrote:
> >
> >     Hi Martin,
> >
> >     Beancount seems to round inferred numbers by default:
> >
> >     1970-01-01 open Assets:Cash
> >     1970-01-01 open Assets:Positions
> >     1970-01-01 open Expenses:Financial:Commissions
> >
> >     2018-03-29 * "Buy 10 BILI"
> >       Assets:Cash
> >       Assets:Positions                 10 BILI {11.4899 USD, 
> 2018-03-29} @ 11.4899 USD
> >       Expenses:Financial:Commissions  0.1 USD
> >
> >     turns into:
> >
> >     2018-03-29 * "Buy 10 BILI"
> >       Assets:Cash                     -115.0 USD
> >       Assets:Positions                    10 BILI {11.4899 USD, 
> 2018-03-29} @ 11.4899 USD
> >       Expenses:Financial:Commissions     0.1 USD
> >
> >     The full-precision number for Assets:Cash should be -114.9990 USD, 
> but
> >     it was incorrectly rounded to -115.0 USD.
> >
> >     In the documentation
> >     
> https://docs.google.com/document/d/1lgHxUUEY-UVEgoF6cupz2f_7v7vEF7fiJyiSlYYlhOo/
> >     section "Precision of Inferred Numbers":
> >
> >     > If the default tolerance is not overridden in the input file—and
> >     > therefore is zero—the full precision will be used; no rounding 
> occurs.
> >
> >     In the minimal example above, the precision seems to be inferred 
> from
> >     0.1 USD commission. If I change the input file, changing commission 
> from
> >     0.1 USD to 0.1000 USD, the output is correct:
> >
> >     2018-03-29 * "Buy 10 BILI"
> >       Assets:Cash                     -114.9990 USD
> >       Assets:Positions        

Re: Implicit rounding of inferred numbers

2018-04-03 Thread Zhuoyun Wei
Thanks for explaination.

It seems that the implicit rounding occurs not only in "PRINT", but also
has effect on balance calculation:


1970-01-01 open Assets:Cash
1970-01-01 open Assets:Positions
1970-01-01 open Expenses:Financial:Commissions

2018-03-29 * "Buy 10 BILI"
  Assets:Cash
  Assets:Positions 10 BILI {11.4899 USD, 2018-03-29} @ 11.4899 
USD
  Expenses:Financial:Commissions  0.1 USD

2018-04-01 balance Assets:Cash -114.9990 USD


The last balance assertion fails:


Balance failed for 'Assets:Cash': expected -114.9990 USD != accumulated -115.0 
USD (0.0010 too little)


Is there a way to turn off the implicit rounding without padding 0.1 USD
to 0.1000 USD?




2018-04-04 01:53:19 Martin Blais :
> This is correct.
> 
> First, the PRINT command of the shell (which is what I believe you're using) 
> will render the numbers at their stored
> precision:
> https://bitbucket.org/blais/beancount/src/4a3995617e7df5ffa3377711382c7ad2f9d8935b/beancount/query/query_execute.py?at=
> default&fileviewer=file-view-default#query_execute.py-92
> 
> I kept it this way originally because PRINT was intended for debugging, so 
> rounding using the most common precision
> seen in the file seemed it would create problems with interpreting the data.  
> I'm not 100% this was the right choice.
> 
> Second, about rounding: by default the tolerance used is that which is 
> inferred on the transaction:
> https://bitbucket.org/blais/beancount/src/4a3995617e7df5ffa3377711382c7ad2f9d8935b/beancount/core/interpolate.py?at=
> default&fileviewer=file-view-default#interpolate.py-324
> 
> The comment you're referring to applies to the case where a tolerance cannot 
> be inferred at all (like in the first
> example in that section). In that case, no rounding occurs. I'll clarify the 
> docs.
> 
> (This hurts my head too.)
> 
> 
> 
> 
> On Sun, Apr 1, 2018 at 5:13 AM, Zhuoyun Wei  wrote:
> 
> Hi Martin,
> 
> Beancount seems to round inferred numbers by default:
> 
> 1970-01-01 open Assets:Cash
> 1970-01-01 open Assets:Positions
> 1970-01-01 open Expenses:Financial:Commissions
> 
> 2018-03-29 * "Buy 10 BILI"
>   Assets:Cash
>   Assets:Positions                 10 BILI {11.4899 USD, 2018-03-29} @ 
> 11.4899 USD
>   Expenses:Financial:Commissions  0.1 USD
> 
> turns into:
> 
> 2018-03-29 * "Buy 10 BILI"
>   Assets:Cash                     -115.0 USD
>   Assets:Positions                    10 BILI {11.4899 USD, 2018-03-29} @ 
> 11.4899 USD
>   Expenses:Financial:Commissions     0.1 USD
> 
> The full-precision number for Assets:Cash should be -114.9990 USD, but
> it was incorrectly rounded to -115.0 USD.
> 
> In the documentation
> 
> https://docs.google.com/document/d/1lgHxUUEY-UVEgoF6cupz2f_7v7vEF7fiJyiSlYYlhOo/
> section "Precision of Inferred Numbers":
> 
> > If the default tolerance is not overridden in the input file—and
> > therefore is zero—the full precision will be used; no rounding occurs.
> 
> In the minimal example above, the precision seems to be inferred from
> 0.1 USD commission. If I change the input file, changing commission from
> 0.1 USD to 0.1000 USD, the output is correct:
> 
> 2018-03-29 * "Buy 10 BILI"
>   Assets:Cash                     -114.9990 USD
>   Assets:Positions                       10 BILI {11.4899 USD, 
> 2018-03-29} @ 11.4899 USD
>   Expenses:Financial:Commissions     0.1000 USD
> 
> My broker-dealer returns the commission as 0.1 USD because it is a
> floating point number in JSON (you cannot end numbers with zeros). But
> behind the scenes it calculates the cash balance with the full-precision
> numbers (e.g. 0.1000 USD). After a few transactions, the balance of
> Assets:Cash has a difference of more than 0.005 USD with the
> broker-dealer and thus fails the balance assertion.
> 
> Is there a way to turn off the implicit rounding without padding 0.1 USD
> to 0.1000 USD in the input file?
> 
> I am using tagged release 2.0.0.
>
> 
> --
> 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+unsubscribe@
> googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/20180401091341.GA26139%
> 40tarball.wzyboy.org.
> For

Re: Resetting cash assets (recommendations welcome)

2018-04-03 Thread Zhuoyun Wei
Hi,

I would recommend this:

1. Make a transfer from Assets:Bank to Assets:Cash every time you
withdraw from ATM;
2. Count your money in you wallet from time to time (say, monthly) and
use "balance" directive to assert how many money in your wallet;
3. Insert a "pad" directive one day before the "balance" directive to
automatically generate a transfer from your wallet to your designated
account (e.g. Expenses:RandomStuff) to make the next balance assertion
pass.

I use the similar procedure for a bank investment account which accrues
interest every day. But I don't want to duplicate every interest income
in that account because there are no script-friendly way to export data
from that bank. So I just assert the balance monthly and pad the
difference to "Income:Interest" or something like that.


2018-04-02 21:26:12 Mattijs Hoitink :
> Hi,
> 
> In my ledger I have an asset account for cash set up, used for when I 
> withdraw from an ATM machine for example. However
> I do not keep track of what I spent that money on exactly, I just assume that 
> when it enters the account (my wallet) it
> is spent (from a ledger perspective).
> 
> I'm not interested in keeping track of what I spent it on (I might give some 
> to my wife etc) so I'm looking for ways to
> reset the asset account to empty, otherwise it keeps accumulating. Does 
> anyone have any recommendations for doing this,
> or a particular process?
> 
> Any ideas are welcome!
> 
> cheers,
> mattijs
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> 1f644a87-adf7-4b2e-b098-b06b46de6077%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180403070625.GA17161%40herus.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Implicit rounding of inferred numbers

2018-04-01 Thread Zhuoyun Wei
Hi Martin,

Beancount seems to round inferred numbers by default:

1970-01-01 open Assets:Cash
1970-01-01 open Assets:Positions
1970-01-01 open Expenses:Financial:Commissions

2018-03-29 * "Buy 10 BILI"
  Assets:Cash
  Assets:Positions 10 BILI {11.4899 USD, 2018-03-29} @ 11.4899 
USD
  Expenses:Financial:Commissions  0.1 USD

turns into:

2018-03-29 * "Buy 10 BILI"
  Assets:Cash -115.0 USD
  Assets:Positions10 BILI {11.4899 USD, 2018-03-29} @ 
11.4899 USD
  Expenses:Financial:Commissions 0.1 USD

The full-precision number for Assets:Cash should be -114.9990 USD, but
it was incorrectly rounded to -115.0 USD.

In the documentation
https://docs.google.com/document/d/1lgHxUUEY-UVEgoF6cupz2f_7v7vEF7fiJyiSlYYlhOo/
section "Precision of Inferred Numbers":

> If the default tolerance is not overridden in the input file—and
> therefore is zero—the full precision will be used; no rounding occurs.

In the minimal example above, the precision seems to be inferred from
0.1 USD commission. If I change the input file, changing commission from
0.1 USD to 0.1000 USD, the output is correct:

2018-03-29 * "Buy 10 BILI"
  Assets:Cash -114.9990 USD
  Assets:Positions   10 BILI {11.4899 USD, 2018-03-29} @ 
11.4899 USD
  Expenses:Financial:Commissions 0.1000 USD

My broker-dealer returns the commission as 0.1 USD because it is a
floating point number in JSON (you cannot end numbers with zeros). But
behind the scenes it calculates the cash balance with the full-precision
numbers (e.g. 0.1000 USD). After a few transactions, the balance of
Assets:Cash has a difference of more than 0.005 USD with the
broker-dealer and thus fails the balance assertion.

Is there a way to turn off the implicit rounding without padding 0.1 USD
to 0.1000 USD in the input file?

I am using tagged release 2.0.0.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180401091341.GA26139%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: moving to GitHub?

2018-03-28 Thread Zhuoyun Wei
2018-03-28 09:59:48 Stefano Zacchiroli :
> I'm happily using git-remote-hg locally anyway

I never knew something like this is possible. I tried the project -- it
works like a charm.

https://github.com/felipec/git-remote-hg

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180328082913.GA30938%40herus.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Beancount 2.0.0

2018-03-27 Thread Zhuoyun Wei
2018-03-27 21:55:46 Martin Blais :
> Released 2.0.0. Today we're starting versioning Beancount. Many people have
> been waiting for this in order to manage their dependencies (e.g. Fava
> users).
> 

Congratulations!

I updated the aur/beancount right away: 
https://aur.archlinux.org/packages/beancount/


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180328023756.GB4815%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: moving to GitHub?

2018-03-27 Thread Zhuoyun Wei
2018-03-27 20:52:48 Martin Blais :
> That's unfair. The fact that you're unfamiliar with it doesn't mean it's a 
> pain.
> Perhaps it's a pain for you now, but imagine the pains of a Mercurial user 
> wrangling some of the crazy problems which
> occur frequently with Git (much worse).
> 
> I'm not going to once again go over the technical reasons for this, but 
> Mercurial is in many ways a success over Git,
> which is why some of the larger integrations have chosen it over Git (e.g. 
> look at what Facebook has done, and I'm
> aware of other such large integrations and have discussed the details with 
> some of the developers carrying them out at
> a conference, they're convincing technical reasons). Don't let your OSS 
> perspective skew your vision. Github might be
> more popular, but so was VHS.

I am not trying to start a flame war, but I would like to point out that
choosing a popular tool/platform attracts more developers.

A friend of mine lives in Canada and often jokes about the mandatory
French usage in Canada when chatting with me. Say, if the lead developer
of an OSS is from Québec and believes that French is better than
English when coding, writing commit messages and discussing in mailing
list -- this project may not get as much contributors as another project
which chooses English as the main language.

I am not judging which language (English vs. French) is better, nor am I
going to say Git is better than Mercurial. I just would like to point
out: **if** we move the project to a popular tool/platform, the project
may attract more contributors. Even if the tool/platform may be
obsolete like VHS in the future, it is popular right now, isn't it?

Just my humble 0.02 Canadian Dollars.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180328023034.GA4815%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Beancount on PyPi

2018-03-24 Thread Zhuoyun Wei
2018-03-24 06:46:31 Stefano Zacchiroli :
> On Sat, Mar 24, 2018 at 01:30:09AM -0400, Martin Blais wrote:
> > How would you feel about me baking an official 2.0 stamp on the
> > current tip?  I was waiting to finish the doc integration to do this
> > and adopt semantic versioning.
> > 
> > I don't think I will wait to close all the tickets before I make
> > numbered releases.  It's been pretty stable and I don't have enough
> > bandwidth these days.
> 
> The current version feels indeed stable enough to be stamped 2.0. But.
> Pushing a new release to PyPi will probably make the tip version (as
> opposed to the last rc1) get some more exposure from users that are not
> using tip. So it might make sense to release current tip as rc2 to PyPi,
> wait 2 weeks (to see if anything important shows up), then stamp 2.0.
> 
> 

I agree with Stefano. We have so many changes since RC1, we should stamp
another "release candidate" before 2.0.

If Martin is okay with moving the repository to GitHub, as Dominik and
many others suggest, we could release RC2 directly to GitHub. This could
greatly speed up the progress towards 2.0 because of more contributors.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180325031409.GA9669%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Issue #223: Cost of the same currency (blais/beancount)

2018-03-01 Thread Zhuoyun Wei
New issue 223: Cost of the same currency
https://bitbucket.org/blais/beancount/issues/223/cost-of-the-same-currency

Zhuoyun Wei:

Hi,

I am not sure if this is a bug or this is by design.

I try to use a special approach to record my gift card transactions. Here is a 
minimal bean file:

```
1970-01-01 open Assets:Cash
1970-01-01 open Assets:GiftCards
1970-01-01 open Income:SomeIncome
1970-01-01 open Expenses:Music
1970-01-01 open Expenses:Apps

2018-01-01 * "Some income"
  Income:SomeIncome -1000.00 USD
  Assets:Cash   +1000.00 USD

2018-02-01 * "Buy 100 USD gift card with 50% discount"
  Assets:Cash -50.00 USD
  Assets:GiftCards   +100.00 USD { 0.50 USD }

2018-02-02 * "Buy some music with gift cards"
  Assets:GiftCards-10.00 USD { 0.50 USD }
  Expenses:Music   +5.00 USD
```

The idea is, I am tagging lots in "Assets:GiftCards" with a cost, but the cost 
is of the same currency. I put 100 USD (which I "bought" with 50 USD) into 
GiftCards, then buy music with 10 USD (which I "bought" with 5 USD) in the gift 
card.

The balance looks good (but the cost tag is already missing)
```
# bean-report
Assets:Cash   950.00 USD
Assets:GiftCards   90.00 USD
Equity
Expenses:Apps
Expenses:Music  5.00 USD
Income:SomeIncome   -1000.00 USD
Liabilities
```

However, if I forget to attach a cost, things went wrong:

```
2018-02-02 * "Buy some apps with gift cards"
  Assets:GiftCards-20.00 USD
  Expenses:Apps

# bean-report
Assets:Cash   950.00 USD
Assets:GiftCards   70.00 USD
Equity
Expenses:Apps  20.00 USD
Expenses:Music  5.00 USD
Income:SomeIncome   -1000.00 USD
Liabilities
```

At this time the "Assets:GiftCards" account should be a mixed inventory, with 
two lots: 90 "discounted USD" and -20 "normal USD". But no, Beancount does not 
distinguish a "discounted USD" (i.e. USD with a cost) and a "normal USD", 
instead if merges the two lots together into a 70 USD lot.

This is quite an edge case. I remember someone in the mailing list recommended 
creating a new commodity GUSD (gift card USD) for gift card balances. But if I 
have gift cards of different currencies, creating gift card counterpart for 
each one of them seems cumbersome.

So may I ask if distinguishing between "currency with cost of the same currency 
(e.g. 100 USD { 0.50 USD })" and "normal currency (e.g. 100 USD)" is trivial to 
implement? If the "feature" is implemented, there would be no need to create 
imaginary currencies like "GUSD" any more.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180301081323.21539.31114%40celery-worker-106.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.


Re: (Eventual) native support for Windows?

2018-02-19 Thread Zhuoyun Wei
2018-02-17 07:22:11 Jeff Brantley :
> a) One has to install 3-4 GiB of compiler/build tools from Microsoft in order 
> to compile the C portions on the fly.
> This is workable, but ideally this would be distributed as a binary wheel (or 
> whatever, I'm no expert on python
> packaging).

I would like to share a successful example as a potential approach of
"native" Windows release of Beancount: 
https://github.com/borgbackup/borg/issues/440

BorgBackup is an excellent backup tool (try it out!) written in Python
and Cython. So compiling it in Windows is a headache, just like
Beancount. A contributor finally created an all-in-one Windows binary
installer for BorgBackup. The installation is self-contained and bundles
Cygwin, Python 3, and all the Python dependencies. It took ~100 MiB disk
space but it saves you from "polluting" your Windows with tons of
development tools.

I have been using the Windows BorgBackup release on my gaming PC for a
few months and it works well. You may consider creating a similar
Beancount Windows release as well.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180219094606.GA10631%40herus.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: How to have custom plugin picked up automatically.

2018-01-06 Thread Zhuoyun Wei
2018-01-06 03:38:19 Martin Blais :
> You need to adjust your PYTHONPATH, or put the code somewhere on the 
> PYTHONPATH.
> You could improve on what you're doing by appending the absolute path to the 
> current PYTHONPATH value.

I see the problem with PYTHONPATH has been brought up a few times by new
users of Beancount. I have two possible suggestions:

1. There could be an option for defining search paths, in which custom
plugins and importers are searched for.

2. The directory where root beancount file resides could be searched
implicitly.

The idea is inspired by Ansible. By default, Ansible searches the
current directory for an ansible.cfg file, in which search paths for
hosts and roles could be defined. This way, the entire Ansible repo is
self-contained. You could clone it on any machine (with Ansible
installed, of course) and run the playbooks right away, without setting
up additional config files or environment variables.

Currently I use a few custom importers. I use a little trick in the
importer config file (which is a Python file) to make Beancount search
the same directory of the config file for importers:

here = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, here)

By doing this, I do not have to modify PYTHONPATH every time I run
bean-identify / bean-extract / bean-file. But for bean-report,
bean-check, and fava, I do not have a chance to inject additional search
paths for custom plugins without modifying PYTHONPATH.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20180107063557.GA3283%40xenien.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Loosely tracking shared expenses between partners

2017-12-18 Thread Zhuoyun Wei
Hi Andreas,

I track my shared expenses with my roommates this way:


; My roommate pays, the dinner is 100 for each of us
2017-12-01 * "Dining out"
  Equity:ARAP:Alice   -100.00 CNY
  Expenses:Food:DiningOut 100.00 CNY

; I pay for the rent, which is 3000 for each of us
2017-12-02 * "Rent for November"
  Assets:SomeBank   -6000.00 CNY
  Expenses:Rent  3000.00 CNY
  Equity:ARAP:Alice  3000.00 CNY

; My roommate pays me to settle up
2017-12-03 * "Settle up"
  Equity:ARAP:Alice  -2900.00 CNY
  Assets:SomeBank 2900.00 CNY


The idea is to set up an account for each of your friends (Alice, Bob,
etc). I used to put these personal accounts under
Assets:AccountsReceivables, but I do not want them to appear under Assets
column in the Balance Sheet. Also, the balance of these accounts may be
negative sometimes. So I abuse / misuse the "Equity" root account and
renamed them to be under "Equity:ARAP". "ARAP" is a term I made up for
"Account Receivables / Account Payables".

I recommend that you try [Splitwise](https://www.splitwise.com/), which
is a great software for tracking shared expenses. My friends and I use
it to track shared expenses collaboratively. I use the CSV export
feature, and bean-extract the bills into Beancount at the end of each
month.

A side note: Splitwise does not provide a day-to-day balance. So my
friends and I settle up at least once a month. This works as a "balance"
directive in Beancount, asserting the balance to be zero. It makes
finding errors easier.


2017-12-17 06:27:59 adde.f...@gmail.com :
> Hey,
> 
> I'm trying to figure out a good simple strategy that allows me to track 
> expenses that I share with my girlfriend. We
> live together and we have two types of shared expenses: the ones for our 
> apartment like rent and utilities and the ones
> where usually I pay for something for the both of us.
> 
> For the first type of transactions I don't care about the balance between us, 
> she pays a fixed amount into my account
> from which most bills go out from each month. I do however care about having 
> accurate tracking of these expenses so I
> can tell what our fixed monthly expenses are. For example, I want the full 
> rent and cost of all the utilities to show
> up among my expenses. At the moment I'm tracking this using regular expense 
> accounts which I create posts against
> whenever I pay our rent for example. I post the transactions where my 
> girlfriend sends me the fixed amount as a special
> income account and I'm pretty happy with this solution (I think).
> 
> I currently have no solution that I'm happy with for the second type of 
> transactions. These transactions usually occur
> at an irregular basis and the amounts vary wildly and I always care about 
> maintaining some sort of balance but whether
> I care about tracking the full value to an expense account or not varies. For 
> example, if I pay for a pair of shoes she
> wants because she doesn't have any money in the currency then I'd want to 
> keep track of the balance she owes me but not
> the expense. However if we go and buy Christmas decorations and I pay then 
> I'd want to record the full amount to an
> expense account and half of the amount to an account that represents the 
> money my girlfriend owes me. Preferably I'd
> like to track the balance between me and my girlfriend as an asset account as 
> that to me seems like the quickest way to
> at a glance tell the status between us (but I may be wrong).
> 
> I was playing around with using an intermediate liability account (see 
> bellow) and I think I could calculate the
> balance between us with a query but since we already have a history and I 
> just started using beancount I have no
> account to post the current balance against and future payments to balance 
> this would be harder to track without an
> asset account?
> 
> 2017-11-26 * "Christmas"
>   Expenses:Home:Decoration  30 GBP
>   Liabilities:Shared                  -30 GBP
> 
> 2017-11-26 * "Christmas"
>   Liabilities:Shared  30 GBP
>   Liabilities:Amex   -30 GBP
> 
> Does anyone have any idea on how to track this in a neat way, preferably 
> without plugins. And yes I've read the expense
> sharing cookbok but didn't see any solution I was perfectly happy with :).
> 
> Cheers!
> Andreas
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web

Re: Compute unrealized PnL day-by-day

2017-12-10 Thread Zhuoyun Wei
2017-12-09 22:39:56 Martin Blais :
> There's no way to do this right now, unless you resort to some Python (but 
> it's doable with Python for sure, as long as
> you have frequent enough price directives, you have all the required data 
> already).

Ah I see. I have enough price directives.

> See the net-worth-over-time.py script, for example.
> 

Thanks for pointing out a way. I looked into the script, along with the
beancount.plugins.unrealized pluin, and wrote a quick script to compute
the unrealized PnL day by day. Here is the script for anyone with similar
needs:

https://gist.github.com/wzyboy/427808e3fab4e75eb4b007c530884132

The script is very crude: it does not consider your actual holdings on a
certain date (because I do not know how to get the balance of a commodity on a
certain date, efficiently). Instead, it just compares your current holdings
with the market value of your holdings on a certain date.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20171210091408.GA32306%40xenien.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Compute unrealized PnL day-by-day

2017-12-05 Thread Zhuoyun Wei
Hi,

I've been using Beancount to track trading activities. With
"beancount.plugins.unrealized" plugin enabled, I can see a few special
transactions inserted for unrealized PnL. The special transactions are
always inserted as the last transactions in the journal.

I am wondering if there is a BQL or something to compute the unrealized
PnL day-by-day. Id est, if I close the position on Nov 25, the PnL is X
USD; if I close the position on Nov 26, the PnL is Y USD.

I have tried:

select date, account, position, balance from close on 2017-XX-XX clear where 
account ~ 'Unrealized';

but it does not work as expected. Is that because the plugin runs before
the "CLOSE" syntax takes effect?

Currently the only way I can think of, is to comment out / remove latest
"price" entries from price database to force Beancount to compute
unrealized PnL for a different date.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20171201182525.GA30869%40xenien.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Bulk changing all transactions in my scripts

2017-10-17 Thread Zhuoyun Wei

2017-10-16 23:01:36 Martin Blais :
> 
> In order to do that, I would suggest going LO-FI and using sed (or Python), 
> and working off of the input text directly.
> Working off of the parsed input will just cause you headaches.
> 

I had a few similar use cases with Holger -- renaming a account while
preserving the indentation and whitespace, reformat the payee +
narration field, etc.

I found the fileinput module from Python stdlib extremely useful in
these cases:


with fileinput.input('ledger.bean', inplace=True) as f:
for line in f:
new_line = process_line(line)
print(new_line, end='')


With inplace=True parameter, it's like `sed -i`, but with all the
powerful batteries of Python.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20171017075841.GA4020%40herus.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Realized and unrealized currency gain

2017-09-19 Thread Zhuoyun Wei
2017-09-19 19:48:16 'Patrick Ruckstuhl' via Beancount 
:
> Looks like I was too quick, seems like * is not yet implemented, this fails:
> 
> 2017-06-01 *
>     Assets:CHF                            -30 CHF
>     Assets:USD                            20 USD { 1.5 CHF }
> 
> 2017-06-01 *
>     Assets:CHF                            -30 CHF
>     Assets:USD                            20 USD { 1.6 CHF }
> 
> 2017-07-01 price USD 1.7 CHF
> 
> 2017-08-01 *
>     Assets:USD                    -10 USD { * } @ 2 CHF
>     Assets:CHF   40 CHF
>     Income:USD:Realized
> 

To be exact, "*" is only a syntax meaning "select some lots from my
inventory and I don't care which lots". It's the same as an empty
bracket (-10 USD {} @ 2 CHF).

The booking method in use is determined by a global- or per-account
option. You could either:


1) Define a global option:

option booking_method "FIFO"

2) Define a per-account option:

open Assets:USD USD "FIFO"

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170920041840.GB30221%40xenien.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Realized and unrealized currency gain

2017-09-19 Thread Zhuoyun Wei
2017-09-19 19:19:44 'Patrick Ruckstuhl' via Beancount 
:
> Hi,
> 
> Thank you very much, I got confused by this: 
> https://docs.google.com/document/d/
> 1dW2vIjaXVJAf9hr7GlZVe3fJOkM-MtlVjvCO1ZpNLmg/edit (Beancount - Comparison / 
> Differences)
> which made me think that currency transactions should never use the cost 
> functionality.
> 

As Jason says, there's no need to record cost for currencies if you are
just "spending" them. In your case, you are "trading" USD for profits.
USD, in your case, if more of a stock held at cost to you.

> It looks like the average cost booking method has also been implemented in 
> the mean time, so I can do it like this
> without having to bother about lots (which I don't care about)
> 
> 2017-06-01 *
>     Assets:CHF                            -30 CHF
>     Assets:USD                            20 USD { 1.5 CHF }
> 
> 2017-07-01 price USD 1.7 CHF
> 
> 2017-08-01 *
>     Assets:USD                    -10 USD { * } @ 2 CHF
>     Assets:CHF   40 CHF
>     Income:USDTrading
> 
> 

Last time I checked, AVERAGE booking method is not implemented. Only
STRICT (default), FIFO, LIFO and NONE are available for now.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170920041310.GA30221%40xenien.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Realized and unrealized currency gain

2017-09-19 Thread Zhuoyun Wei
Hi Patrick,

in order to compute PnL, you need to provide cost instead of price:


2017-06-01 * "Buy USD"
  Assets:CHF -30 CHF
  Assets:USD 20 USD { 1.5 CHF }

2017-07-01 price USD 1.7 CHF

2017-08-01 * "Sell USD"
  Assets:USD -20 USD { 1.5 CHF } @ 2 CHF
  Assets:CHF 40 CHF
  Income:PnL


This way you could see a realized PnL of (2 CHF - 1.5 CHF) * 10 = 5 CHF
in the account Income:PnL.

To compute unrealized PnL, you could enable a built-in plugin:


plugin "beancount.plugins.unrealized" "Unrealized"


This way you could see an unrealized PnL in Assets:CHF:Unrealized.


See official documentation for more information: 
https://docs.google.com/document/d/1WjARst_cSxNE-Lq6JnJ5CC41T3WndEsiMw4d46r2694/edit



2017-09-18 11:14:22 patrick via Beancount :
> Hi,
> 
> I've now tried to search for this for quite a bit but somehow I'm not finding 
> the right stuff or maybe not
> understanding it right and I hope someone can help me.
> 
> I would like to separate the currency gains from other income and would like 
> to also differentiate between realized and
> unrealized gain.
> 
> Let's take the following example
> 
> 2017-06-01 * "Buy USD"
> Assets:CHF -30 CHF
> Assets:USD 20 USD @ 1.5 CHF
> 
> 2017-07-01 price USD 1.7 CHF
> 
> 2017-08-01 * "Sell USD"
> Assets:USD -20 USD @ 2 CHF
> Assets:CHF           40 CHF
> 
> 
>   • On 2017-07-01 I would have an unrealized currency gain of 4 CHF, how 
> would I see this?
>   • On 2017-08-02 I would have a realized currency gain of 10 CHF, how would 
> I set this up to see this as income?
> 
> 
> One thing I found was
> http://www.mathstat.dal.ca/~selinger/accounting/tutorial.html
> 
> Which looked quite interesting to me and seems to have a solution for this 
> but I'm struggling with implementing some of
> the details of it.
> I think in my case the concept of "adjusted cost base" seems to be the 
> simplest and make sense. 
> 
> So if I understood that correct I would need to do the following:
> 
> 2017-06-01 *
> Assets:CHF -30 CHF
> Income:USDTrading       30 CHF
> Income:USDTrading       -20 USD
> Assets:USD 20 USD
> 
> 2017-07-01 price BTC 0.30 CHF
> 
> 2017-08-01 *
> Assets:USD -20 USD
> Income:USDTrading       20 USD
> Income:USDTrading       -30 CHF
> Income:USDTradingRealized       -10 CHF
> Assets:CHF           40 CHF
> 
> What I get out of this
> 
>   • If I take the balance of Income:USDTradingRealized with the current 
> exchange rate this should reflect my unrealized
> gain
> 
> 
> A couple of things that confuse me
> 
>   • This feels somehow "wrong" as I'm no longer using the @ price annotation 
> and have this price implicit in the
> difference between the amounts in one currency going into the USDTrading 
> and and out of the USDTrading in the other
> currency.
>   • I need to manually calculate the -10 CHF realized gain
>   • Income:USDTradingRealized could actually be an income or an expense, 
> depending on current exchange rates
> 
> 
> Can anyone help me with this or point me in the right direction?
> 
> 
> Thanks and Regards,
> Patrick
> 
> 
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> 397c15c6-c5ea-4d9c-917f-60adf03344d4%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170919071516.GA20960%40herus.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Issue #194: Use of float numbers in Amount() (blais/beancount)

2017-09-16 Thread Zhuoyun Wei
New issue 194: Use of float numbers in Amount()
https://bitbucket.org/blais/beancount/issues/194/use-of-float-numbers-in-amount

Zhuoyun Wei:

Hi,

I have always been bugged by the fact that in Fava, in almost all
transactions involving currency conversions (that is, every time I pay
with international credit cards), very long fractional
numbers are displayed in postings.

I always thought it's something about DisplayContext and did not dig
into the reasons. Today I am playing with BQL and finally it occurs to
me that float numbers, instead of Decimals, are used somewhere
internally in Beancount.

Observe the float round-off errors:

```
beancount> select date, narration, position, weight where account ~ "Expenses:" 
and narration ~ "Amazon web services";
   date narration  positionweight
-- --- - --
[...]
2016-07-04 Amazon web services 12.06 USD  80.530001 CNY
[...]
2017-05-05 Amazon web services 13.04 USD  90.13 CNY
```

I can see that in Beancount's docs, Martin always uses "@" syntax to
record currency conversions, like "10 USD @ 1.3 CAD". I, however,
always uses "@@" syntax to record conversions, like "10 USD @@ 65 CNY".
Because on my bank statements there are no currency exchange rates, and
only the numbers in foreign currency and local currency are provided.

Here is how the two transactions in the bean-query examples above look
like in the Beancount input files:

```
2016-07-04 * "Amazon web services"
  Liabilities:CMB:CreditCards -80.53 CNY
  Expenses:Communications:Internet+12.06 USD @@ 80.53 CNY

2017-05-05 * "Amazon web services"
  Liabilities:CMB:CreditCards -90.14 CNY
  Expenses:Communications:Internet+13.04 USD @@ 90.14 CNY
```

It seems that Beancoun did not use these numbers directly. Instead, it
uses the quotient of the two numbers to calculate the weight. In this
process, float round-off errors occur.

Responsible: blais

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170916161612.29960.62319%40celery-worker-108.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.


Issue #193: beancount.prices.sources.google.Source.get_historical_price() is no longer working as expected (blais/beancount)

2017-09-15 Thread Zhuoyun Wei
New issue 193: beancount.prices.sources.google.Source.get_historical_price() is 
no longer working as expected
https://bitbucket.org/blais/beancount/issues/193/beancountpricessourcesgooglesourceget_hist

Zhuoyun Wei:

Hi,

I found a bug where `bean-price` always returns today's price no matter what 
date I provided. I root the cause here: 
https://bitbucket.org/blais/beancount/src/621cec5ed38bcd128a3502a3b5c367f283deffe2/beancount/prices/sources/google.py?at=default&fileviewer=file-view-default#google.py-181:184

The Google Finance API now (since when? I have no idea) always returns a full 
year's data (from ~365 days ago to today), ignoring `startdate` and `enddate` 
parameters. So fetching the most recent record (line 1) is always to get 
today's price.

Responsible: blais

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170915144322.7377.94842%40celery-worker-106.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.


Issue #192: Make it possible to use single letter as commodity name (blais/beancount)

2017-09-13 Thread Zhuoyun Wei
New issue 192: Make it possible to use single letter as commodity name
https://bitbucket.org/blais/beancount/issues/192/make-it-possible-to-use-single-letter-as

Zhuoyun Wei:

Hi Martin,

this is a similar issue to #138. I recently found out that Beancount currently 
does not allow single-letter commodity name. A minimal reproducible example:

```
1970-01-01 commodity USD
1970-01-01 commodity V

2017-09-01 open Assets:SingleLetter:X
2017-09-01 open Assets:Trade:Cash USD
2017-09-01 open Assets:Trade:Positions "FIFO"

2017-09-13 * "Buy 10 shares of Visa"
  Assets:Trade:Cash -1000.00 USD
  Assets:Trade:Positions  +10.00 V { 100.00 USD }
```

A bean-check shows:

```
single-letter.beancount:2:   Invalid token: 'V'
single-letter.beancount:10:  Invalid token: 'V'
```

It seems that single-letter account names do not trigger errors any more (line 
4) since #138 is resolved, but single-letter commodity names are still not 
allowed (line 2 and line 10).

Could you please make single-letter commodity possible? I would like to make 
pull request but I do not know how to write C code...

Responsible: blais

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170913100325.27849.36887%40celery-worker-107.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.


Issue #190: Use of implicit_prices and operating_currency together leads to incorrect calculations of net worth (blais/beancount)

2017-09-06 Thread Zhuoyun Wei
New issue 190: Use of implicit_prices and operating_currency together leads to 
incorrect calculations of net worth
https://bitbucket.org/blais/beancount/issues/190/use-of-implicit_prices-and

Zhuoyun Wei:

Hi,

if you have the following conditions to be true, the calculated net worth is 
wrong:

- Two operating currencies are defined;
- At least one transaction involves the two currencies with `@@`;
- The implicit_prices plugin is enabled.

Here is a minimal example:

```
plugin "beancount.plugins.implicit_prices"
  
option "operating_currency" "CNY"
option "operating_currency" "USD"

1970-01-01 open Liabilities:CC
1970-01-01 open Expenses:Food

2017-09-01 * ""
  Liabilities:CC -660.00 CNY
  Expenses:Food  +100.00 USD @@ 660.00 CNY
```

Running bean-report:

```
Currency  Net Worth
  -
CNY -660.00
USD -100.00
  -
```

Either:

- disabling one of the operating currencies

or

- disabling implicit_prices plugin

restores the correct calculation of net worth:

```
Currency  Net Worth
  -
CNY -660.00
  -
```

I rooted the cause of this behavior in a very confusing situation. I was 
looking at the net worth graph in Fava and found something very strange:

- My ledger spans from 2013 to 2017.
- The ledger consists of only CNY transactions from 2013 to 2015. The net worth 
graph from 2013 to 2015 consists of a rising line of CNY and a flat line of USD 
which is always 0.
- In year 2015 I got my first international credit card and there were USD @@ 
CNY transactions from then on.
- On the day the first USD @@ CNY transaction occurs, the USD value in Fava net 
worth graph spikes from zero to a non-zero value, which roughly equals to all 
my CNY assets converted to USD.
- The USD line in the graph keeps a similar shape with CNY line from 2015 to 
2017.

Attachment: the USD net worth spikes from zero to non-zero starting from the 
day the first USD @@ CNY transaction occurs, and keeps a similar shape with CNY 
value from then on.

Responsible: blais

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170906124508.30042.25766%40celery-worker-110.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.


Re: Documentation is now read-only

2017-08-13 Thread Zhuoyun Wei
2017-08-14 01:53:41 Martin Blais :
> 
> 
> AFAIK you can search from the Drive interface. Just add the word "beancount" 
> and some terms.
> 

It suddenly occurred to me that since the Docs is now read-only, could
we utilize the /pub feature [1] of Docs? I am not sure if this helps
Google and other search engines to better index the page, but it does at
lease provide a more light-weight web page, without those menu bars,
edit controls, and avatars on the top-right corner showing who are
viewing the same page with you.

[1] One could just change "/edit" to "/pub" in the URL to get a
"published" version of the Docs, so it's easy to update existing links
in the source code. The owner of the Docs have to enable the feature
first.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170814064630.GA23849%40herus.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Documentation is now read-only

2017-08-13 Thread Zhuoyun Wei
Glad to hear Beancount moves on from Google Docs.

No offense. But I was very confused when I first met Beancount. Google
Docs is a very good collaborating platform but a poor choice for
software documentation. I remember when I needed to look up for some
syntax or usage I cannot search thru the documention because
"site:docs.google.com beancount" does not return any useful results [1]
-- it's very ironic that a search engine does not index its sibling
website well. The Docs page itself is slow to load compared to simple
HTML (without a ton of AJAX) or plain text documentation that were
popular among open source projects.

Cheers!


[1] https://www.google.com/search?q=site%3Adocs.google.com+beancount


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170813161509.GA3766%40xenien.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Issue #172: How to override "HEADER" in bean-extract? (blais/beancount)

2017-07-02 Thread Zhuoyun Wei
New issue 172: How to override "HEADER" in bean-extract?
https://bitbucket.org/blais/beancount/issues/172/how-to-override-header-in-bean-extract

Zhuoyun Wei:

Hi,

in `extract.py` I could see this comment:

```
# The format for the header in the extracted output.
# You may override this value from your .import script.
HEADER = ';; -*- mode: beancount -*-\n'
```

However, defining `HEADER` in .import script does not seem to work. It seems 
that `output.write(HEADER)` in `extract.py` writes the hard-coded header 
directly to the output.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170702200939.10213.17467%40celery-worker-106.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.


Re: Partial refunds

2016-09-09 Thread Zhuoyun Wei
2016-09-08 23:05:59 strikov.cob...@gmail.com :
> 
> 2016-09-06 * "Hotel booking"
>   Assets:PL:Bank:Checking   -900.00 USD
>   Expenses:Trips:Hotels          900.00 USD
> 

Personally I will use another transaction like this for this kind of situation:

2016-09-07 * "Hotel booking (refund)"
  Expenses:Trips:Hotels  -855.00 USD ; 95% of 900.00 USD
  Assets:PL:Bank:Checking+855.00 USD ; or whatever account name

This way I know the date of payment and the date of refund.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20160909085417.GA2952%40eva.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Reconciling credit card statements

2016-05-08 Thread Zhuoyun Wei

2016-05-08 21:10:14 yegle :
> 
> On Sun, May 8, 2016 at 9:00 PM, Jason Chu  wrote:
> 
> The problem is that postings are inserted before the statement end in the 
> next billing cycle (because of random
> delays in the charge processing systems) so the balance assertion can't 
> be against any given date.
> 
> 
> 
> There's an effective date plugin (don't remember the git repo though), which 
> can help organize the transactions that
> happen on day X and settled on day Y.
> 
> For me I just move the transaction to the billing cycle that matches the 
> statement, and add the real transaction date
> in the narration field.
> 

Ditto here. For credit card transactions, I use the settled date as
directive date in the Beancount file, and keep sale date in metadata.

> --
> Yuchen Ying
> http://about.me/yegle
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> CAFL5w3VEbJJAFTm3-kLea6xFWAwwVvcoZ77amufDka0MoDspiQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20160509041529.GB17975%40eden.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Reconciling credit card statements

2016-05-08 Thread Zhuoyun Wei
2016-05-09 04:00:52 Jason Chu :
> The problem is that postings are inserted before the statement end in the 
> next billing cycle (because of random delays
> in the charge processing systems) so the balance assertion can't be against 
> any given date.

Why does the balance assertion not match any given date? I make a
balance assertion every month on the statement day. One needs to be
cautious that the balance assertion occurs at the beginning of the day,
prior to any real transactions: If you your statement day is 03, you
should use "-XX-04 balance Liabilities:XX" to assert your credit
card balance.

Martin is also working on a new directive "balance_end", enabling user
to insert balance assertions at the end of day:
https://bitbucket.org/blais/beancount/issues/118/create-a-balance_end-directive


> 
> On Sun, May 8, 2016 at 8:41 PM yegle  wrote:
> 
> If you have one balance assertion for each statement, you'll be able to 
> reconcile each billing cycle separately.
> 
> On Sun, May 8, 2016 at 2:01 PM, Jason Chu  wrote:
> 
> Every time I import transactions from my credit card the balance 
> lines never match up.  I understand this is
> because transactions can be inserted inserted in history.  How do 
> other people reconcile their credit card
> statements to make sure they have the correct balance for a given set 
> of transactions?  I'm afraid if I don't
> do this I will end up missing or double counting a transaction 
> somewhere and not accurately representing my
> debt.
> 
> Gnucash had a mechanism for reconciling a set of transactions with a 
> statement, where it would change the state
> of the transaction to reconciled (y vs n or c) and would verify that 
> all reconciled transactions at that point
> in time matched the statement balance.
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> 2a5a65cb-ba31-4a9c-b5c8-fcbaf6fb78e7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> 
> 
> 
> --
> Yuchen Ying
> http://about.me/yegle
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> CAFL5w3X9m987Dk4NO8xaxczGjJDsjt2DGOoNoBwgVGqaPJOTuA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
> 
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> CAFFHUgsLVOweX-YW2A4mNTYqDipSF3zR3VKPRJd4C%2Bn9TdE27w%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20160509041244.GA17975%40eden.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature