Re: Need some tips on query generating averages on time series data
Date: Wed, 23 Oct 2013 21:08:44 -0700 (PDT)
Message-ID: <cb757795-0280-4cd8-85b7-fb84335cf278_at_googlegroups.com>
If you need Oracle access, please send me your email address at ecotaj at gmail dot com.
_at_Peter: you make an assumption that I was the guy that lost $5B at JPM ;-) in a single day of trading.
On Wednesday, October 23, 2013 1:12:33 AM UTC-5, Lennart Jonsson wrote:
> On 10/23/2013 04:35 AM, TomGar wrote:
>
> I'm not entirely sure how you define hold time for a stock, is it per
> share? Otherwise why is rule 4 necessary? Can you provide the expected
> result for the sample data above?
>
> I don't have access to an Oracle instance so I ran on a competitor:
>
> with T(stock, ts, qnt) as (
> values ('GOOG', 12459.6, -100)
> , ('GOOG', 12634.0, 100)
> , ('GOOG', 12636.2, 200)
> , ('GOOG', 12464.8, -100)
> , ('GOOG', 12568.3, -300)
> , ('GOOG', 12678.0, 200)
> )
>
> select stock, ts, qnt, sum(qnt) over (partition by stock
> order by ts) as cumulative_sum
> from t;
>
> What is the average hold times above?
>
> /Lennart
Received on Thu Oct 24 2013 - 06:08:44 CEST