Entering stock transactions

Charles Day cedayiv at gmail.com
Mon Oct 6 18:05:20 EDT 2008


On Mon, Oct 6, 2008 at 8:34 AM, Fred Bone <Fred.Bone at bcs.org.uk> wrote:

> On 22 Sep 2008 at 11:02, Charles Day said:
>
> > On Mon, Sep 22, 2008 at 10:19 AM, Fred Bone
> > <Fred.Bone at dial.pipex.com>wrote:
> [...]
> > > After a great deal of experimentation, I have narrowed my problem down
> > to
> > > the Euro transactions. Unfortunately I have quite a few, spread around
> > a
> > > number of accounts. However, the balance is not zero except in one
> > case
> > > (where an Expenditure account got zeroed to Equity; deleting that
> > > transaction has no effect on the "imbalance").
> > >
> > > My main currency is GBP, and I have one Euro account under Assets
> > > (Assets:Currency:Euro), two under Equity (Equity:Opening
> > Balances:Euro
> > > and Equity:Year end:2007:Euro), and four under Expenditure. I buy
> > Euros
> > > (cash) from my bank Current account, and deleting all the cash-
> > > expenditure transactions makes no difference.
> > >
> > > What does make a difference is deleting the four transactions where
> > I
> > > purchased Euros, and three where I charged Euro transactions to my
> > (GBP)
> > > credit card.
> [...]
> > > Deleting a single EUR purchase and re-entering the same amount with
> > the
> > > same exchange rate yields the same "imbalance", so it's not a case of
> > bad
> > > data in the file.
> > >
> > > The last such transaction was on 2008-05-20, when I bought EUR305.00
> > for
> > > GBP250.29. If I delete this transaction, my "imbalance" changes from
> > > 4218.29 to 8.10. If instead I create another one (dated today or
> > some
> > > arbitrary other date, makes no difference), the "imbalance" becomes
> > > 288.97.
> > >
> > > FWIW, the other bank-to-cash transactions are
> > > 2007-02-20 EUR290.00 bought for GBP201.07
> > > 2007-07-11 EUR290.00 bought for GBP202.68
> > > 2007-10-07 EUR280.00 bought for GBP200.70
> > > and the credit card transactions are
> > > 2007-10-10 EUR258.00 charged at GBP183.78
> > > 2008-06-01 EUR85.50 charged at GBP69.55
> > > 2008-06-06 EUR55.10 charged at GBP45.29
> > >
> > > I cannot make any sense of what is going on. Especially the huge
> > variance
> > > in the effect of duplicating or removing a single transaction.
> > >
> >
> > I think things will be easier to track down if you run the trial
> > balance
> > with your price source set to "average cost" (available starting in
> > 2.2.6) .
> > The default price source of "weighted average" seems to be more volatile
> > due
> > to the way it is calculated.
> >
> > I see you saying that GBP is being sold to buy EUR. Does the EUR cash
> > later
> > get transferred into accounts that are not also denominated in EUR?
>
> No. And btw, I've been running "average cost" all along.
>
> Some very strange things are happening.
>
> If I delete the earliest EUR purchase, the "imbalance" reduces from
> GBP4218.29 to GBP49.78.
>
> If I then re-enter it from the (GBP-denominated) bank account side, the
> "imbalance" is again shown as GBP4218.29, as noted previously.
>
> However, if instead I re-enter it from the "Cash - Euro" side, the
> "imbalance" reduces further, to GBP5.42.
>
> OTOH, if I create a new file and enter all my Euro transactions, I can't
> create an imbalance whether I enter the purchases from the GBP or the
> Euro end.
>
> It may be worth noting that the PriceDB holds an entry obviously derived
> from the first GBP/EUR transaction, showing an exchange rate of "1 +
> 8893/20107" (which is the GBP-per-EUR rate; all the others show the EUR-
> per-GBP rate, as I would expect). Deleting this makes no difference to
> the "imbalance"; I'm not sure whether it ought to (i.e. whether the Trial
> Balance makes any use at all of PriceDB entries).
>
> I've tried saving the "before" and "after" versions of the (real) file
> uncompressed and running a diff. Here's the entire output (for the one
> where I re-entered from the Euro side). I cannot see anything that I
> would expect to affect the calculation of exchange rates.
>

I've taken a look at the differences. I take it the intention is to buy 290
EUR at a cost of 201.07 GBP. The important tags are <cmdty:id>,
<split:value>, and <split:quantity>.

The <cmdty:id> tag tells the currency of the transaction, and it will be GBP
if you enter a new transaction in the GBP-denominated account's register, or
EUR if you use the EUR-denominated account's register. Since you used a
GBP-denominated register in one file, and a EUR-denominated register in the
other file, the observed difference makes sense.

The <split:value> tag tells the amount of the split in terms of the
transaction currency (<cmdty:id> tag).  In your GBP-denominated transaction,
the <split:value> lines are both 201.07, so that looks OK. In the
EUR-denominated transaction, both are 290.00, so that looks good too.

The <split:quantity> tag tells the value of the split in terms of that
split's account's currency. Here is where you would see the effect of the
exchange rate. The problem is that there seems to be no difference in the
<split:quantity> in the two files. That means the exchange rate is wrong in
one of them.

Could you verify whether the transaction looks correct from all four
registers (two in each file)? I would suspect that in one file the exchange
rate is 1 and either the "290.00" figure or the "201.07" figure cannot be
found.

Cheers,
Charles

P.S. That weird-looking fraction in the Price Editor is fixed in 2.2.7, and
Price Editor prices don't affect the "average cost" computation.


> ====
> 71684c71684
> <   <trn:id type="guid">88c96a9b8c279b8b121fb9495a6a301e</trn:id>
> ---
> >   <trn:id type="guid">3f0508aa8648742ff5f0e912498670c6</trn:id>
> 71687c71687
> <     <cmdty:id>GBP</cmdty:id>
> ---
> >     <cmdty:id>EUR</cmdty:id>
> 71690c71690
> <     <ts:date>2007-02-20 10:59:00 +0000</ts:date>
> ---
> >     <ts:date>2007-02-20 00:00:00 +0000</ts:date>
> 71693c71693,71694
> <     <ts:date>2007-06-17 15:17:21 +0100</ts:date>
> ---
> >     <ts:date>2008-10-06 11:39:08 +0100</ts:date>
> >     <ts:ns>62500000</ts:ns>
> 71699,71703c71700
> <       <slot:value type="string">OFX ext. info: |Trans type:Point of sale
> debit or credit (Note: Depends on signage of amount)|Memo:MONEY LONDON ,
> 6628 18FEB07 1624</slot:value>
> <     </slot>
> <     <slot>
> <       <slot:key>online_id</slot:key>
> <       <slot:value type="string">200702200001</slot:value>
> ---
> >       <slot:value type="string"></slot:value>
> 71708c71705
> <       <split:id type="guid">a9f7fefe644be6d9f02d2b39ce3f6ae3</split:id>
> ---
> >       <split:id type="guid">a9bf3ec205b8872d7456aca572b3940a</split:id>
> 71710c71707
> <       <split:value>20107/100</split:value>
> ---
> >       <split:value>29000/100</split:value>
> 71715,71721c71712,71714
> <       <split:id type="guid">49d9f689217326bb4f243ec6fa550a39</split:id>
> <       <split:memo>MONEY LONDON , 6628 18FEB07 1624</split:memo>
> <       <split:reconciled-state>c</split:reconciled-state>
> <       <split:reconcile-date>
> <         <ts:date>2007-06-17 15:17:34 +0100</ts:date>
> <       </split:reconcile-date>
> <       <split:value>-20107/100</split:value>
> ---
> >       <split:id type="guid">4d881b45bac7a1de923364065f0e5aeb</split:id>
> >       <split:reconciled-state>n</split:reconciled-state>
> >       <split:value>-29000/100</split:value>
> ====
>
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
>


More information about the gnucash-user mailing list