On Thu, Feb 07, 2008 at 01:18:33PM -0600, Christopher Singley wrote:
> > I mean "dynamical system" where the state of the system is a function of
> > time. I need a function which accepts a time variable as an input, and
> > returns a state.
> >
> > Consider exchange-traded securities (e.g.  stocks).  An important attribute
> > of a stock is its price.  Stock trading prices are a time series of
> > discrete points.  Yahoo Finance, among others, persists series of prices
> > and allows users to look them up by time.  That's the kind of thing I'm
> > talking about:
> 
> So then:
> class SecurityState(SQLObject):
>     parent = ForeignKey('Security')
>     date = DateCol()
>     price = DecimalCol(size=10, precision=4)
> 
> class Security(SQLObject):
>     states = MultipleJoin('SecurityState', joinColumn='parent_id')
> 
> Why define a separate class for security?  So that Security.id can be used as 
> a foreign key in other tables.  For example:
> 
> class SecurityTransaction(SQLObject):
>     time = DateTimeCol()
>     price = DecimalCol(size=10, precision=4)
>     security = ForeignKey('Security')
> 
> Is there a better way of representing data like this in SQL/SQLObject?

   I don't think so, and I think you scheme is very good for the task.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to