Next [was Re: Stock trades and realized gains/losses]

Matthew Vanecek mevanecek@yahoo.com
13 Jan 2003 01:28:38 -0600


--=-CW7Rcm1od0dWrynTWpYX
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Sun, 2003-01-12 at 10:43, Linas Vepstas wrote:
> On Sat, Jan 11, 2003 at 12:01:57PM -0500, Derek Atkins was heard to remar=
k:
> > Linas,
> >=20
> > Thank you for this great summary.  Mind if I ask a few clarifying
> > questions?
> >=20
> > linas@linas.org (Linas Vepstas) writes:
> >=20
> > > Note that because the 'adjusting transaction' has one split
> > > in dollars, and another split in RHAT shares (albeit for zero=20
> > > RHAT shares), it evades the old double-entry requriement,
> > > and will not be flagged as 'out of balance'.  Note also=20
> > > that because the 'adjusting transaction' contains a split
> > > holding S (albeit zero S), it *must* be a part of a Lot.
> >=20
> > But it IS in balance by the old rules.  The split->value is in
> > balance.
>=20
> Well, its a 'weird balance'; its a good example of what I mean=20
> by 'multi-commodity transactions fundamentally can't balance'.
>=20
> The split in the 'unrealized' account shows amt=3D$1000, value=3D$1000
> The split in the 'stock' account shows amt=3D0 shrs value=3D$1000
>=20
> If you look at the above 'adjusting transaction' on its own,
> you conclude an infinite price. Yuck.  To compute the prices
> corrctly, you have to find the lot that this belongs to, and=20
> assume that the lot shares were all sold and then rebought=20
> at $1000 less.  This means that any kind of split_get_price()
> routine needs to also be made more complex.  Ugh. There are really
> *two* prices involved ...

Indeed.  That's why I was kind of wondering if it would be possible to
add a field or two the Lot--perhaps a guid/price hash table, where guid
=3D=3D a given Split?  That way there's no guessing after the initial Split
creation--if amt =3D=3D 0 && value !=3D 0 return hash table element guid.  =
Of
course, that would mean an extra bit of storage to the backend for the
Lot.

This is just my "I just got home and am really tired" stab, so perhaps
tomorrow evening will yield better ideas.


--=20
Matthew Vanecek
perl -e 'print $i=3Dpack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
***************************************************************************=
*****
For 93 million miles, there is nothing between the sun and my shadow except=
 me.
I'm always getting in the way of something...

--=-CW7Rcm1od0dWrynTWpYX
Content-Type: application/DEFANGED-2584; name="signature_asc.DEFANGED-2584"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA+Imqmi/CNzDSN0RIRAgGmAJ49Y4VMjZGQ8+V/al8V/pWI4Jt98QCeN4QA
s2xtRDgnEJmrXalws393Ank=
=jmdO
-----END PGP SIGNATURE-----

--=-CW7Rcm1od0dWrynTWpYX--