geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher James Blythe (JIRA)" <...@geronimo.apache.org>
Subject [jira] Commented: (DAYTRADER-25) Update decimal precision and indexes in ddl
Date Wed, 15 Nov 2006 23:04:37 GMT
    [ http://issues.apache.org/jira/browse/DAYTRADER-25?page=comments#action_12450223 ] 
            
Christopher James Blythe commented on DAYTRADER-25:
---------------------------------------------------

Matt... 

You mean it isn't possible for someone to become trillionare in DayTrader? What a crock!!!
;-)

Good point... found the code... the creep is due to the quote price updates that occur on
every buy and sell. After load, the highest quote price is around $200 and we randomly multiple
this by a number form 0.5 to 1.5. Some of the quotes end up as penny stocks while others can
balloon to upwards of $1000. 

If the stock price gets down to $0.01 we automatically bump it up to $6.

For the time being, I suggest impossing some kind of ceiling on the maximum stock price and
also making it an additive algorithm with less variance.

Something like...

changeFactor = random() * 0.2
if (random() < 0.5)
   changeFactor *= -1

if (price > 400)
   newPrice = 200;
else if (price < 0.10)
   newPrice = 6
else
   newPrice += price + (changeFactor * price)

For Daytrader 2.0, I actually think we could beef up the logic by adding the concerpt of stock
splits. When ever we reach the ceiling, we split the stock and double the shares for users
holding that stock in their portfolio.

> Update decimal precision and indexes in ddl
> -------------------------------------------
>
>                 Key: DAYTRADER-25
>                 URL: http://issues.apache.org/jira/browse/DAYTRADER-25
>             Project: DayTrader
>          Issue Type: Improvement
>            Reporter: Christopher James Blythe
>            Priority: Minor
>
> While working with previous versions of Trade, I found that the monetary values stored
in the database could overrun the decimal precision defined in the schema (10,2) if allowed
to run for an extended period of time. This would result in SQL exceptions related to data
conversion.
> To prevent this we increased the decimal presion to (14,2)
> We also found that some of the indexs were not necessary and that others should be added.
> In addition to the primary keys, here are the indexes we found to be the most useful...
> CREATE INDEX a.profile_userid on accountejb(profile_userid);
> CREATE INDEX h.account_accountid on holdingejb(account_accountid);
> CREATE INDEX o.account_accountid on orderejb(account_accountid);
> CREATE INDEX o.holding_holdingid on orderejb(holding_holdingid);
> CREATE INDEX o.closed_orders on orderejb(account_accountid,orderstatus);
> Will wait to submit a patch until the fate of Daytrader-14 is determined.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message