Re: No position matches error

2020-04-30 Thread Martin Blais
On Thu, Apr 30, 2020 at 9:32 PM Martin Michlmayr  wrote:

> * salmi.tuo...@gmail.com  [2020-04-30 12:03]:
> > 2) Is the booking method (strict, fifo, lifo, average, none) somehow
> > relevant in this and if so, what implications each one has? Since I
> > can't manage which lots I sell from by bank, to me it seems like it
> > would make sense to use average method. Or is this completely
> > unrelated to my problem?
>
> It typically depends on the tax laws of your country which lot is
> sold first.
>

And it gets really weird if you're filing in two countries simultaneously
(e.g. USA and Canada). Technically you'd have to maintain two cost bases
(and I don't know how to do that in Beancount).




>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/20200501013225.GA29967%40jirafa.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhO_DUZb1MHET_qMdi2%2BhVZv6FFOt-o1oy0y135AzDcg8g%40mail.gmail.com.


Re: Question on query output on per transaction basis.

2020-04-30 Thread Martin Blais
Use bean-bake, or if you cannot, write a script that will upload journals
to a spreadsheet.


On Thu, Apr 30, 2020 at 9:12 PM Red S  wrote:

> Right, but it groups postings together by transaction, which is exactly
> what transactions are: groups of postings.
>
> If this is not what you want, what exactly do you want? Send us a sample
> format.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/c38d3f41-2204-4396-a817-f95e73da41d6%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhObqXo4xbd-2tqPY2d3C23p_OVYSiw8j-HoWGxfTJuRJQ%40mail.gmail.com.


Re: No position matches error

2020-04-30 Thread Martin Michlmayr
* salmi.tuo...@gmail.com  [2020-04-30 12:03]:
> 2) Is the booking method (strict, fifo, lifo, average, none) somehow
> relevant in this and if so, what implications each one has? Since I
> can't manage which lots I sell from by bank, to me it seems like it
> would make sense to use average method. Or is this completely
> unrelated to my problem?

It typically depends on the tax laws of your country which lot is
sold first.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20200501013225.GA29967%40jirafa.cyrius.com.


Re: Question on query output on per transaction basis.

2020-04-30 Thread Red S
Right, but it groups postings together by transaction, which is exactly what 
transactions are: groups of postings.

If this is not what you want, what exactly do you want? Send us a sample format.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/c38d3f41-2204-4396-a817-f95e73da41d6%40googlegroups.com.


Re: Question on query output on per transaction basis.

2020-04-30 Thread mployby
yes, it outputs postings, not transactions.

On Thursday, April 30, 2020 at 1:28:19 PM UTC-4, Red S wrote:
>
>  Did you try: `journal` ?
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/1966022b-5c1f-4238-9c94-9b7336f0c090%40googlegroups.com.


Re: No position matches error

2020-04-30 Thread Red S
You're on the right track with your questions. Responses inline:

On Thursday, April 30, 2020 at 12:03:55 PM UTC-7, salmi...@gmail.com wrote:
>
> Thanks. Didn't get it yet but I have few questions.
>
> 1) After reading the doc it seems to me that I should specify which lots I 
> sold by using {} syntax, am I right? When I sell a part of my position, my 
> bank does not let me to select which lots I'll sell. So I have difficulty 
> in understanding how to apply the lot's price to the transaction. Based on 
> my bank's report I only know that I sold 20 shares. And to clarify I sold 
> only a part of my total position. 
>

If you bank does not let you select (STRICT booking, aka "specific 
identification of shares" in the US), it's possible they picked lots to 
sell using FIFO, LIFO, average cost, or some other method. I'm not familiar 
with the laws that apply to you, but you could either research this or 
back-work it out by asking your bank the value of the gains you realized in 
that transaction, if they are required by law to maintain that.

 

> 2) Is the booking method (strict, fifo, lifo, average, none) somehow 
> relevant in this and if so, what implications each one has? Since I can't 
> manage which lots I sell from by bank, to me it seems like it would make 
> sense to use average method. Or is this completely unrelated to my problem?
>

Yes, this is very related to your problem. If you're sure it's not FIFO or 
LIFO, then it's likely AVERAGE. However, average cost booking is not yet 
implemented 

 
fully in Beancount. The simple hack is to use the NONE 

 
booking method. You can also simulate 

 
AVERAGE.

 

> 3) In the example transaction you gave I don't understand the point of the 
> Income row. I sold 20 shares with price 47.996 EUR, and in return I had to 
> pay 15 EUR commissions and I got 944.92 EUR to my Cash account. While this 
> transaction would likely result in capital gain or loss, I don't understand 
> how I would calculate that when I don't know the prices of lots I sold. 
> Again I guess this is just a result of my confusion with the first question.
>

This gets into what you're trying to do, and what your tax laws require you 
to do. If you aren't required to report the gains (eg: tax sheltered 
accounts in the US are like this), you setting the booking method to NONE 

 
is a quick hack if you don't care about recording the gains for yourself. 
As Martin notes: *"Note: If you are familiar with Ledger, this is the 
default and only booking method that it supports."* So while it's one way 
of doing things, one of the things that made me move to Beancount from 
Ledger was booking methods beyond NONE.

 

> Finally I'm not shorting and this is the first transaction I'm selling 
> this ETF so afaik the balance should not be negative in any part of the 
> ledger as seems to be the case in some other threads. Anyway, I'll try to 
> keep reading and figuring out what I should do.
>

Your sale got counted as a short position. Your subsequent purchase was 
assumed to be a short-closing transaction, and beancount attempted to match 
it against your sale.



 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/d1487479-edd3-4c76-a623-11d59255a8a1%40googlegroups.com.


Re: No position matches error

2020-04-30 Thread salmi . tuomas
Thanks. Didn't get it yet but I have few questions.

1) After reading the doc it seems to me that I should specify which lots I 
sold by using {} syntax, am I right? When I sell a part of my position, my 
bank does not let me to select which lots I'll sell. So I have difficulty 
in understanding how to apply the lot's price to the transaction. Based on 
my bank's report I only know that I sold 20 shares. And to clarify I sold 
only a part of my total position. 

2) Is the booking method (strict, fifo, lifo, average, none) somehow 
relevant in this and if so, what implications each one has? Since I can't 
manage which lots I sell from by bank, to me it seems like it would make 
sense to use average method. Or is this completely unrelated to my problem?

3) In the example transaction you gave I don't understand the point of the 
Income row. I sold 20 shares with price 47.996 EUR, and in return I had to 
pay 15 EUR commissions and I got 944.92 EUR to my Cash account. While this 
transaction would likely result in capital gain or loss, I don't understand 
how I would calculate that when I don't know the prices of lots I sold. 
Again I guess this is just a result of my confusion with the first question.

Finally I'm not shorting and this is the first transaction I'm selling this 
ETF so afaik the balance should not be negative in any part of the ledger 
as seems to be the case in some other threads. Anyway, I'll try to keep 
reading and figuring out what I should 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/e5e6e426-d7d5-4217-983b-270c943116fd%40googlegroups.com.


Re: No position matches error

2020-04-30 Thread Red S
This 

 
section of the documentation might help. Specifically:
Reductions
Augmentations vs. Reductions
Homogeneous and Mixed Inventories

Also, read this thread 
.
 
In short, your sell transaction should look like this:

2020-03-10 * "EUNL sold"
  Assets:Nordnet:EUNL -20 EUNL {} @ 47.996 EUR
  Expenses:Financial:Commissions 15 EUR
  Assets:Nordnet:Cash 944.92 EUR
  Income:Capital-Gains XXX.XX EUR


The {} above might need a lot specification depending on your booking 
method, and whether you are reducing all positions or some.



On Thursday, April 30, 2020 at 8:46:46 AM UTC-7, salmi...@gmail.com wrote:
>
> I already checked this thread which seemed like a similar problem but I 
> couldn't apply it to my case: 
> https://groups.google.com/forum/#!topic/beancount/Qvbcq-Sk5NY
>
> Anyway, I'm investing to a ETF with ticker EUNL monthly. Recently I sold 
> some of my position and marked it to my ledger:
> 2020-03-10 * "EUNL sold"
>   Assets:Nordnet:EUNL -20 EUNL @ 47.996 EUR
>   Expenses:Financial:Commissions 15 EUR
>   Assets:Nordnet:Cash 944.92 EUR
>
>
>  Next time EUNL is mentioned in my ledger is just a random price 
> definition when I wanted to know my asset worth at certain date:
> 2020-03-21 price EUNL 42.536 EUR
>
>
> Today I tried to add a recent purchase of EUNL in a normal way like this:
> 2020-04-30 * "EUNL purchase"
>   Assets:Nordnet:EUNL 8 EUNL {45.9998 EUR}
>   Assets:Nordnet:Cash -368.00 EUR
>
>
> but I get an error:
> No position matches "Posting(account='Assets:Nordnet:EUNL', units=5 EUNL, 
> cost=CostSpec(number_per=Decimal('45.9998'), number_total=None, 
> currency='EUR', date=None, label=None, merge=False), price=None, flag=None, 
> meta={'filename': '/home/tuomas/ledger/ledger.beancount', 'lineno': 5847})" 
> against balance (-20 EUNL, 80 EUNL {45.10 EUR, 2018-04-30}, 6 EUNL {45.5980 
> EUR, 2018-05-07}, 2 EUNL {46.62 EUR, 2018-12-05}, 11 EUNL {46.6660 EUR, 
> 2018-07-05}, 4 EUNL {46.8219 EUR, 2018-11-05}, 3 EUNL {47.0850 EUR, 
> 2019-02-05}, 10 EUNL {47.2815 EUR, 2018-06-05}, 10 EUNL {48.5568 EUR, 
> 2018-08-06}, 4 EUNL {48.6140 EUR, 2019-03-05}, 4 EUNL {49.2354 EUR, 
> 2018-10-05}, 2 EUNL {49.3720 EUR, 2019-06-05}, 4 EUNL {50.49 EUR, 
> 2019-04-05}, 3 EUNL {50.5220 EUR, 2019-08-05}, 4 EUNL {50.6877 EUR, 
> 2019-05-06}, 3 EUNL {52.19 EUR, 2019-07-05}, 4 EUNL {52.436 EUR, 
> 2019-10-07}, 3 EUNL {52.50 EUR, 2019-09-05}, 7 EUNL {52.9177 EUR, 
> 2020-03-05}, 5 EUNL {54.5880 EUR, 2019-11-05}, 4 EUNL {55.14 EUR, 
> 2019-12-05}, 4 EUNL {56.8213 EUR, 2020-01-07}, 3 EUNL {58.5676 EUR, 
> 2020-02-05})
>
>
>
> If I remove my selling transaction, the problem disappears. Based on the 
> another thread it looks like this has something to do with how the 
> Beancount tracks lots. To be honest I'm not completely familiar with that 
> topic so I didn't figure out yet why my selling transaction breaks things. 
> So my question is what I'm doing wrong here and how to fix this?
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/43c6a36c-1a7d-4f0f-8cf6-ca26e486ace8%40googlegroups.com.


Re: Question on query output on per transaction basis.

2020-04-30 Thread Red S
 Did you try: `journal` ?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/835d8070-7380-4acc-b974-16c906c54b56%40googlegroups.com.


Re: No position matches error

2020-04-30 Thread salmi . tuomas
Oh, and I am using Beancount version 2.1.2

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/8ed3505b-e246-447d-a386-d6417649dd37%40googlegroups.com.


No position matches error

2020-04-30 Thread salmi . tuomas
I already checked this thread which seemed like a similar problem but I 
couldn't apply it to my case: 
https://groups.google.com/forum/#!topic/beancount/Qvbcq-Sk5NY

Anyway, I'm investing to a ETF with ticker EUNL monthly. Recently I sold 
some of my position and marked it to my ledger:
2020-03-10 * "EUNL sold"
  Assets:Nordnet:EUNL -20 EUNL @ 47.996 EUR
  Expenses:Financial:Commissions 15 EUR
  Assets:Nordnet:Cash 944.92 EUR


 Next time EUNL is mentioned in my ledger is just a random price definition 
when I wanted to know my asset worth at certain date:
2020-03-21 price EUNL 42.536 EUR


Today I tried to add a recent purchase of EUNL in a normal way like this:
2020-04-30 * "EUNL purchase"
  Assets:Nordnet:EUNL 8 EUNL {45.9998 EUR}
  Assets:Nordnet:Cash -368.00 EUR


but I get an error:
No position matches "Posting(account='Assets:Nordnet:EUNL', units=5 EUNL, 
cost=CostSpec(number_per=Decimal('45.9998'), number_total=None, 
currency='EUR', date=None, label=None, merge=False), price=None, flag=None, 
meta={'filename': '/home/tuomas/ledger/ledger.beancount', 'lineno': 5847})" 
against balance (-20 EUNL, 80 EUNL {45.10 EUR, 2018-04-30}, 6 EUNL {45.5980 
EUR, 2018-05-07}, 2 EUNL {46.62 EUR, 2018-12-05}, 11 EUNL {46.6660 EUR, 
2018-07-05}, 4 EUNL {46.8219 EUR, 2018-11-05}, 3 EUNL {47.0850 EUR, 
2019-02-05}, 10 EUNL {47.2815 EUR, 2018-06-05}, 10 EUNL {48.5568 EUR, 
2018-08-06}, 4 EUNL {48.6140 EUR, 2019-03-05}, 4 EUNL {49.2354 EUR, 
2018-10-05}, 2 EUNL {49.3720 EUR, 2019-06-05}, 4 EUNL {50.49 EUR, 
2019-04-05}, 3 EUNL {50.5220 EUR, 2019-08-05}, 4 EUNL {50.6877 EUR, 
2019-05-06}, 3 EUNL {52.19 EUR, 2019-07-05}, 4 EUNL {52.436 EUR, 
2019-10-07}, 3 EUNL {52.50 EUR, 2019-09-05}, 7 EUNL {52.9177 EUR, 
2020-03-05}, 5 EUNL {54.5880 EUR, 2019-11-05}, 4 EUNL {55.14 EUR, 
2019-12-05}, 4 EUNL {56.8213 EUR, 2020-01-07}, 3 EUNL {58.5676 EUR, 
2020-02-05})



If I remove my selling transaction, the problem disappears. Based on the 
another thread it looks like this has something to do with how the 
Beancount tracks lots. To be honest I'm not completely familiar with that 
topic so I didn't figure out yet why my selling transaction breaks things. 
So my question is what I'm doing wrong here and how to fix this?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/8e4814be-af0b-49c7-9b4c-f2d1c078435f%40googlegroups.com.


Question on query output on per transaction basis.

2020-04-30 Thread mployby
Guys hi,

I need to prepare general ledger for my cpa for specific period.
Since he does not have beancount installed I originally i planned to use 
bean-bake, but now i think it will be easier to general excel files in fava.

SELECT
  date, description, account, position
FROM
date > 2019-04-19 AND date < 2020-04-19

gives me close to what i need, problem is that transactions are separated 
into postings:

2019-04-20 Best Hosting Company Assets:Paypal   -15.99 USD
2019-04-20 Best Hosting Company Expenses:Hosting 15.99 USD



solution is to use PRINT:
PRINT FROM  date > 2019-04-19 AND date < 2020-04-19

which gives format close to what i need
2019-04-20 * "Best Hosting Company"
  Assets:Paypal -15.99 USD
  Expenses:Hosting   15.99 USD



But problem is that i can't export it to excel in fava. As i understood 
it's cause PRINT is generating beancount format output (not csv / excel).
Is there a query to generate output that displays data on per transaction 
basis AND is in csv / excel format so it's exportable in fava ?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/fb4270f1-4c1c-4bd2-8dae-fb640081168f%40googlegroups.com.


Re: OFX Importer for Investment Accounts

2020-04-30 Thread Red S
It's now on PyPI:

*pip install beancount-reds-importers*

See the examples directory in the installed files, or on github (eg: 
/usr/lib/python3.6/site-packages/beancount_reds_importers/example/my.import)

On Wednesday, April 29, 2020 at 4:15:08 PM UTC-7, Red S wrote:
>
> I've cleaned it up and checked it in to a repo here 
> . It should have 
> enough to import multi-account Vanguard qfx files mostly out of the box. 
> See the README 
> 
> .
>
> My test infrastructure is unfortunately dependent on my personal files. So 
> I'm unable to share it for now, without a fair amount of work.
>
> Let me know your experience.
>
> On Sunday, April 26, 2020 at 4:15:36 PM UTC-7, Jacob Hannan wrote:
>>
>> The built-in importer may well not. I recall an older email thread in 
>> which Martin mentioned merging in bits of ledgerhub into the main project, 
>> but it may be the case that the ofx_invest importer wasn't part of that. 
>>
>> I'd love to take a look at anything you are willing to share. I'm not a 
>> programmer, let alone a python programmer, so I'm mainly working from 
>> examples.
>>
>> Thanks!
>>
>> -JH
>>
>> On Sun, Apr 26, 2020 at 12:32 PM Red S  wrote:
>>
>>> Does the built-in ofx importer handle investment transactions (eg: 
>>> buy/sell stocks/funds)?
>>>
>>> I built my own generic investment ofx importer on top of ofxparse, and 
>>> I've been using it for years. It works for a number of brokerages including 
>>> the case you describe, vanguard with multiple real accounts. I've been 
>>> wanting to share my ofx importers, and will do so shortly.
>>>
>>> It solves a number of issues including:
>>> - stock and fund transactions including buys and sells (lot matching, 
>>> however, is left to the user)
>>> - special handling of money market transactions (price conversions)
>>> - customizable for each brokerage house, to account for ofx differences, 
>>> filenames, etc.
>>> - produces balance assertions
>>> - handles commissions, fees
>>> - produces price entries (many brokerages include ticker prices of all 
>>> active tickers in the account on the date of download, in addition to of 
>>> course, the prices gleaned from transactions)
>>> - available cash computation
>>> - cusip to fund matching (some brokerage houses identify funds only by 
>>> cusip or other custom tickers in the ofx)
>>>
>>>
>>>
>>> On Sunday, April 26, 2020 at 7:16:04 AM UTC-7, hann...@gmail.com wrote:

 Hello, all. 

 Can anyone point in the direction of some examples on setting up the 
 built-in OFX importer for investment accounts? I have it working fine for 
 regular bank accounts (where there is one account number), but I'm not 
 sure 
 how to configure it for accounts that have multiple "subaccounts." For 
 example, when I export transactions from Vanguard, I'm exporting for 5 
 real 
 accounts (4 IRA accounts and one brokerage account) and a larger number of 
 funds under each one. 

 In looking through the documentation and old email threads, I can't 
 tell if this is something one accomplishes in the ".config" file using the 
 built-in importer or if I need to write a custom importer for investment 
 accounts. Old emails reference a ofx_invest importer that was part of 
 ledgerhub, but I know that is discontinued. 

 Thanks in advance!

 -JH

>>> -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "Beancount" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/beancount/JtE9JLQY3Og/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> bean...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/beancount/54d2b408-e27f-44bb-a439-0eaf093646bf%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/aae2ffbb-d7d7-4320-b5ed-6729c34d5467%40googlegroups.com.