Set Up Stock Druid?

Josh Sled jsled at asynchronous.org
Tue Oct 23 20:23:12 EDT 2007


"David T." <sunfish62 at yahoo.com> writes:
> I have been working with my stock portfolio just now (GC2.0.5 from Fink on an
> IntelMac 10.4.10), and I think it would be nice if there were some sort of "Add
> a Stock to My Portfolio" druid. What I am envisioning is some form that
> collects basic information (Stock Name, Ticker Symbol, price, shares bought,
> date bought, commission, etc.) and then sets up the necessary accounts and
> related stuff. I found the process of adding a new stock to be very
> daunting--even with the tutorial. And then, once I "owned" the stocks in
> GnuCash, I had to remember to create the appropriate Income account (which I
> forgot until I was in the middle of entering a dividend transaction...) and be
> sure the Security is entered into the Get Prices part of things. It would also
> be nice if GnuCash could take a ticker symbol and supply the rest of the info
> (Company Name, Exchange, etc.).
>
> I understand that my needs are probably not the same as anyone else's, but I
> wondered how/whether I could go about making my own such druid, which I might
> then share back to the community if I actually got it to work.

Awesome.

I'd encourage you to spec out the process of the druid and its effects:

- what is the paginated sequence of operations?

  - what might easily vary from your scenario, without going overboard on
    generalization?

- what data is required to be solicited/computed before subsequent stages?

  - one way to think of this is as a spreadsheet: there are input cells and
    derived/formula cells.

- at the end of all the druid processing, what's the sequence of
  operations that will be done to mutate the books?

  - note that it should be the case that a druid cancelled on the last page
    has not mutated the state of the data... that might necessitate you
    saving some work from the middle of the operations sequence until to end
    to actually apply it.

  - what are the possible error scenarios?

    - can they be prevented?  

    - how will they be handled?

Ideally, we would have a UI-netural model of the process, with the actual
Druid code just hooking up the UI to the model.  But if we just had a single
src/gnome/druid-add-stock.[ch], where its gnc_add_stock_druid_finish(...)
function directly called all the engine API to do the work, that'd be fine.

I'd suggest taking a look at src/gnome/druid-stock-split.c [1] to get a sense
of how things would be structured and whatnot.

Once you want to begin actually writing the code, the zeroth step is to get
the sources built.  See <http://wiki.gnucash.org/wiki/Building>.

Some of us are available at <irc://irc.gnome.org/gnucash>, and we're happy to
help (time permitting, of course :).

If the conversation advances much, we should probably move to -devel.

[1] http://svn.gnucash.org/trac/browser/gnucash/trunk/src/gnome/druid-stock-split.c

-- 
...jsled
http://asynchronous.org/ - a=jsled; b=asynchronous.org; echo ${a}@${b}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-user/attachments/20071023/4af9e3b7/attachment.bin 


More information about the gnucash-user mailing list