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_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_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_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_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_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_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_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_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: 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_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=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_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-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 <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 <bl...@furius.ca>:
> > 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
> &g

Re: Beancount 2.1.0 release

2018-05-13 Thread Zhuoyun Wei
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


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 <bl...@furius.ca>:
> 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 <bl...@furius.ca>:
> 
> 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 <bl...@furius.ca>:
> > 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=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=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 <wzy...@wzyboy.org> 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           

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 <z...@upsilon.cc>:
> 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 <bl...@furius.ca>:
> 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 <bl...@furius.ca>:
> 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 <z...@upsilon.cc>:
> 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 <jsb...@gmail.com>:
> 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 <bl...@furius.ca>:
> 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: Compute unrealized PnL day-by-day

2017-12-10 Thread Zhuoyun Wei
2017-12-09 22:39:56 Martin Blais <bl...@furius.ca>:
> 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 <bl...@furius.ca>:
> 
> 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 
<beancount@googlegroups.com>:
> 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 
<beancount@googlegroups.com>:
> 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 <beancount@googlegroups.com>:
> 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 #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=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-14 Thread Zhuoyun Wei
2017-08-14 01:53:41 Martin Blais <bl...@furius.ca>:
> 
> 
> 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.