From dev-return-41371-apmail-geronimo-dev-archive=geronimo.apache.org@geronimo.apache.org Wed Nov 15 23:05:03 2006
Return-Path:
Delivered-To: apmail-geronimo-dev-archive@www.apache.org
Received: (qmail 86775 invoked from network); 15 Nov 2006 23:05:01 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2)
by minotaur.apache.org with SMTP; 15 Nov 2006 23:05:01 -0000
Received: (qmail 77609 invoked by uid 500); 15 Nov 2006 23:05:09 -0000
Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org
Received: (qmail 77572 invoked by uid 500); 15 Nov 2006 23:05:09 -0000
Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm
Precedence: bulk
list-help:
list-unsubscribe:
List-Post:
Reply-To: dev@geronimo.apache.org
List-Id:
Delivered-To: mailing list dev@geronimo.apache.org
Received: (qmail 77548 invoked by uid 99); 15 Nov 2006 23:05:08 -0000
Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133)
by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Nov 2006 15:05:08 -0800
X-ASF-Spam-Status: No, hits=0.0 required=10.0
tests=
X-Spam-Check-By: apache.org
Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4)
by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Nov 2006 15:04:58 -0800
Received: from brutus (localhost [127.0.0.1])
by brutus.apache.org (Postfix) with ESMTP id B1CE271431F
for ; Wed, 15 Nov 2006 15:04:37 -0800 (PST)
Message-ID: <15981438.1163631877711.JavaMail.jira@brutus>
Date: Wed, 15 Nov 2006 15:04:37 -0800 (PST)
From: "Christopher James Blythe (JIRA)"
To: dev@geronimo.apache.org
Subject: [jira] Commented: (DAYTRADER-25) Update decimal precision and
indexes in ddl
In-Reply-To: <18112417.1163533897113.JavaMail.jira@brutus>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Virus-Checked: Checked by ClamAV on apache.org
[ 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