# [R-SIG-Finance] calculating the high frequency return

markleeds at verizon.net markleeds at verizon.net
Mon Jan 5 05:33:55 CET 2009

```  sorry but in my previous message, i meant to say that the going short
return is -1.0* what i have. my apologies.

also, lgoing ong return should have read going long return. ( it's late
).

On Sun, Jan 4, 2009 at 11:26 PM, markleeds at verizon.net wrote:

> Suppose I have the bid and ask data for a stock XXX, at every minute (
> best bid and best ask ). Then, say I want to calculate the
>
> A) going long that stock at 10:10 for 10 minutes.
>
> B) going short that stock at 10:10 for 10 minutes.
>
> I realize that , since I have only quote data, the whole thing is
> approximate anyway because the actual prices that one transacts in
> are unknown ( or in the transaction price data which I'd rather avoid
> dealing with ) but my understanding is that  the best approximation is
>
> lgoing ong return =   (bid at 10:20 - ask at 10:10)/ask at 10:10
>
> going short return = ( ask at 10:20 - bid at 10:10)/bid at 10:10
>
> Since I'm taking the spread into account in the formula ( rather than
> using ( midpoint at 10:20 - midpoint at 10:10)/midpoint at 10:10 ),
>  then these are not the negative of each other, as they would be if
> one used the midpoint.  but I would think that above gives a better
> measure than using the midpoint because it implicity takes into
> account the transaction cost due to the spread which actually could be
> different depending on whether one is going long or short.
>
> Any comments or corrections are appreciated. There's also interest
> rebates when one shorts but I'm assuming they are small enough
> to ignore.  it also assumes that you can close the transaction EXACTLY
> when you want to which is not particularly realistic either. Still, if
> there's something wrong with above or a better way to calculate these
> things or a known standard source that explains it, enlightenment is
> appreciated.
>
>
>
> Mark
>
>
> On Sun, Jan 4, 2009 at  9:59 PM, Josh Ulrich wrote:
>
>> Hi Andrew,
>>
>> You can use TTR's functionality to get both split and dividend
>> information from Yahoo Finance.
>>
>> x <- getYahooData("SPY", type='split', quiet=TRUE)
>>
>> Best,
>> Josh
>> --
>> http://quantemplation.blogspot.com
>>
>>
>>
>> On Sun, Jan 4, 2009 at 7:31 PM, Andrew Yee <yee at post.harvard.edu>
>> wrote:
>>> Apologies if this is a newbie question, but I've been able to use
>>> get.hist.quote() to obtain quote information.
>>>
>>> However, is there a way to use this function to obtain dividend
>>> distribution
>>> information?  Or is there a function for doing this?
>>>
>>> Thanks,
>>> Andrew
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>> -- Subscriber-posting only.
>>> -- If you want to post, subscribe first.
>>>
>>
>> _______________________________________________
>> R-SIG-Finance at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only.
>> -- If you want to post, subscribe first.
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.

```