On Thursday 07 February 2008 13:14:16 I wrote:
> On Thursday 07 February 2008 11:58:34 Oleg Broytmann wrote:
> >    What do you mean by "changing dynamically"?
>
> 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?

TIA,
cs

-------------------------------------------------------------------------
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