[R] [R-SIG-Finance] AsOf join in R

Roupell, Darko Darko.Roupell at cba.com.au
Thu Oct 6 03:22:39 CEST 2011


Btw tweaking MatchTradesQuotes should not be an issue and its easy to accommodate any data format that is passed through in xts object. 

At least that's what I did with RTAQ package - used it as a shell to create unique functions that suit data format for intra-day tick flow from ASX. 


Hope this helps.

__________________________________________________
Commonwealth Bank 
Darko Roupell 
Associate Quantitative Analyst 
Institutional Banking & Markets
Equities Research
Darling Park Tower 1
Level 23, 201 Sussex Street
Sydney, NSW 200
P:  +61 2 9117 1254
F:  +61 2 9118 1000
M: +61 400 170 515
E: Darko.Roupell at cba.com.au 
Our vision is to be Australia's finest financial services organisation through excelling in customer service.

Email Security
This email is sent solely for informational purposes. Hoax emails, commonly referred to as phishing, can appear to be from the Commonwealth Bank and ask you to update or confirm details such as client numbers, passwords, personal identification questions, contact details or account numbers. The Commonwealth Bank will never send you an email asking you to confirm, update or reveal your confidential banking information. 
Important Information
Produced by Global Markets Research, a business unit of Commonwealth Bank of Australia ABN 48 123 123 124 - AFSL 234945 (Commonwealth Bank). This publication is based on information available at the time of publishing.  We believe that the information in this communication is correct and any opinions, conclusions or recommendations are reasonably held or made as at the time of its compilation, but no warranty is made as to accuracy, reliability or completeness.  To the extent permitted by law, neither Commonwealth Bank nor any of its subsidiaries accept liability to any person for loss or damage arising from the use of this communication. This communication does not purport to be a complete statement or summary.  
The information provided has been prepared without considering your objectives, financial situation or needs, and before acting on the information, you should consider its appropriateness to your circumstances. No person should act on the basis of this report without considering and if necessary taking appropriate professional advice upon their own particular circumstances.  
Commonwealth Bank of Australia, as a provider of investment, borrowing and other financial services undertakes financial transactions with many corporate entities in Australia. This may include any corporate issuer referred to in this communication. Commonwealth Bank and its subsidiaries have effected or may effect transactions for their own account in any investments or related investments referred to herein. In the case of certain securities Commonwealth Bank is or may be the only market maker.


-----Original Message-----
From: Robert A'gata [mailto:rhelpacc at gmail.com] 
Sent: Thursday, 6 October 2011 12:08 PM
To: Roupell, Darko; r-help at r-project.org; r-sig-finance at stat.math.ethz.ch
Subject: Re: [R-SIG-Finance] AsOf join in R

Hi Roupell,

Yes I am aware of RTAQ function matchTradesQuotes. But my time series
does not follow the TAQ format like they suggest. So I gave it a try
and find that it doesn't work. In particular, my time series contain
full level 2 order book and trades. I want to do asof join of the book
to the trade. Is there any better way? Or I misunderstand anything
about the RTAQ's function? Thank you.

Robert

On Wed, Oct 5, 2011 at 1:59 AM, Roupell, Darko <Darko.Roupell at cba.com.au> wrote:
> na.locf {zoo}, should do a job, also if you look in RTAQ they wrote a function that looks on previous tick and carries forward value in case its not available.
>
> __________________________________________________
> Commonwealth Bank
> Darko Roupell
> Associate Quantitative Analyst
> Institutional Banking & Markets
> Equities Research
> Darling Park Tower 1
> Level 23, 201 Sussex Street
> Sydney, NSW 200
> P:  +61 2 9117 1254
> F:  +61 2 9118 1000
> M: +61 400 170 515
> E: Darko.Roupell at cba.com.au
> Our vision is to be Australia's finest financial services organisation through excelling in customer service.
>
> Email Security
> This email is sent solely for informational purposes. Hoax emails, commonly referred to as phishing, can appear to be from the Commonwealth Bank and ask you to update or confirm details such as client numbers, passwords, personal identification questions, contact details or account numbers. The Commonwealth Bank will never send you an email asking you to confirm, update or reveal your confidential banking information.
> Important Information
> Produced by Global Markets Research, a business unit of Commonwealth Bank of Australia ABN 48 123 123 124 - AFSL 234945 (Commonwealth Bank). This publication is based on information available at the time of publishing.  We believe that the information in this communication is correct and any opinions, conclusions or recommendations are reasonably held or made as at the time of its compilation, but no warranty is made as to accuracy, reliability or completeness.  To the extent permitted by law, neither Commonwealth Bank nor any of its subsidiaries accept liability to any person for loss or damage arising from the use of this communication. This communication does not purport to be a complete statement or summary.
> The information provided has been prepared without considering your objectives, financial situation or needs, and before acting on the information, you should consider its appropriateness to your circumstances. No person should act on the basis of this report without considering and if necessary taking appropriate professional advice upon their own particular circumstances.
> Commonwealth Bank of Australia, as a provider of investment, borrowing and other financial services undertakes financial transactions with many corporate entities in Australia. This may include any corporate issuer referred to in this communication. Commonwealth Bank and its subsidiaries have effected or may effect transactions for their own account in any investments or related investments referred to herein. In the case of certain securities Commonwealth Bank is or may be the only market maker.
>
> -----Original Message-----
> From: r-sig-finance-bounces at r-project.org [mailto:r-sig-finance-bounces at r-project.org] On Behalf Of Robert A'gata
> Sent: Wednesday, 5 October 2011 2:41 PM
> To: r-help at r-project.org; r-sig-finance at stat.math.ethz.ch
> Subject: [R-SIG-Finance] AsOf join in R
>
> Hi,
>
> I tried to google for any solution for asof join operator in R. But I
> couldn't find one. The asof join operator AsOf(A,B) merges 2 time
> series by looking for latest available value of B prior to each time
> point in A. For example,
>
> A <- xts(c(10,15,20,25),
> order.by=as.POSIXct(c("2011-09-01","2011-09-09","2011-09-10","2011-09-15"))
>
> B <- xts(c(1.1,1.5,1.3,1.7),
> order.by=as.POSIXct(c("2011-08-31","2011-09-09","2011-09-11","2011-09-12"))
>
> AsOf(A,B) should return
>
>                    A       B
> 2011-09-01    10     1.1
> 2011-09-09    15     1.1     #  (because latest value B prior to
> 2011-09-09 is 1.1)
> 2011-09-10    20     1.5
> 2011-09-15    25     1.7
>
> How do I write the above AsOf function in R? The merge function does
> not do what I want because it will align points that have the same
> time stamp together while what I want is actually latest value prior
> to timestamp in A. Any example would be greatly appreciated. Thank
> you.
>
> Cheers,
>
> Robert
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>
> ************** IMPORTANT MESSAGE *****************************
> This e-mail message is intended only for the addressee(s) and contains information which may be
> confidential.
> If you are not the intended recipient please advise the sender by return email, do not use or
> disclose the contents, and delete the message and any attachments from your system. Unless
> specifically indicated, this email does not constitute formal advice or commitment by the sender
> or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries.
> We can be contacted through our web site: commbank.com.au.
> If you no longer wish to receive commercial electronic messages from us, please reply to this
> e-mail by typing Unsubscribe in the subject line.
> **************************************************************
>
>
>
>

************** IMPORTANT MESSAGE *****************************       
This e-mail message is intended only for the addressee(s) and contains information which may be
confidential. 
If you are not the intended recipient please advise the sender by return email, do not use or
disclose the contents, and delete the message and any attachments from your system. Unless
specifically indicated, this email does not constitute formal advice or commitment by the sender
or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries. 
We can be contacted through our web site: commbank.com.au. 
If you no longer wish to receive commercial electronic messages from us, please reply to this
e-mail by typing Unsubscribe in the subject line. 



More information about the R-help mailing list