Re: Need some tips on query generating averages on time series data

From: Lennart Jonsson <erik.lennart.jonsson_at_gmail.com>
Date: Thu, 24 Oct 2013 06:58:05 +0200
Message-ID: <l4a9ct$71u$1_at_dont-email.me>


On 10/24/2013 06:08 AM, ecotaj_at_gmail.com wrote:
> Hello Lennart:
>
> Thank you for attempting.
>
> Here is my calculation of hold times and wted-avg hold times:
>
> time qnt cumul hold_time wted-hold-time
> 12459.6 -100 -100 174.4 17440
> 12464.8 -100 -200 171.4 17140
> 12568.3 -100 -300 67.9 6790
> 12568.3 -200 -500 109.7 21940
> 12634 100 -400
> 12636.2 100 -300
> 12636.2 100 -200
> 12678 200 0
> totalqnt total-w-h-t wted-avg-hold-time
> 500 63310 126.62
>
> As you can see, I had to break down some trades into smaller quantities in order
> to match the buy-sell and come up with the holdtime.
>
> And as you can see, the order of first in first out is important to the calc. If I were to use LIFO, my numbers would be slightly different.
>

I still don't understand how to determine the hold_time (I have no background in financial business). Can you elaborate on how you came up with these numbers? For example, how is 109.7 and 21940 calculated?

> If you need Oracle access, please send me your email address at ecotaj at gmail dot com.
>

The OLAP functions look fairly equal, and should only require some minor adjustments. I'll leave the porting for you ;-)

/Lennart

[...] Received on Thu Oct 24 2013 - 06:58:05 CEST

Original text of this message