[R] previous business day

David Scott d.scott at auckland.ac.nz
Fri Oct 22 22:19:29 CEST 2010


On 23/10/2010 4:59 a.m., David Reiner wrote:
> Look at the documentation for timeDate and try ?timeNdayOnOrBefore after loading the package.
>
> -- David
>
>

If you are dealing with such problems I suggest you obtain

"A Discussion of Time Series Objects for R in Finance"

available from Rmetrics for free. timeDate is an Rmetrics package.

Go to https://www.rmetrics.org/ebooks to see what is available from 
Rmetrics.

David Scott


> -----Original Message-----
> From: Li, Jing Yi [mailto:jingyi.li at credit-suisse.com]
> Sent: Friday, October 22, 2010 9:38 AM
> To: David Reiner; David Winsemius
> Cc: r-help at r-project.org
> Subject: RE: [R] previous business day
>
> yes. do you know the name of related functions in the timeDate package?
> Thanks!
>
>
> -----Original Message-----
> From: David Reiner [mailto:David.Reiner at xrtrading.com]
> Sent: Friday, October 22, 2010 10:10 AM
> To: Li, Jing Yi; David Winsemius
> Cc: r-help at r-project.org
> Subject: RE: [R] previous business day
>
> you may be thinking of the timeDate package, which has some holiday
> calendars.
> HTH,
> David L. Reiner, PhD
> Head Quant
> XR Trading LLC
>
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Li, Jing Yi
> Sent: Thursday, October 21, 2010 3:51 PM
> To: David Winsemius
> Cc: r-help at r-project.org
> Subject: Re: [R] previous business day
>
> Thanks a lot for all your reply! It really helps!
>
> Somehow I remember there is some package which can provide financial
> exchange calendars, like NYSE holidays, not sure where to find it.
>
>
> -----Original Message-----
> From: David Winsemius [mailto:dwinsemius at comcast.net]
> Sent: Thursday, October 21, 2010 4:34 PM
> To: Li, Jing Yi
> Cc: Clint Bowman; Henrique Dallazuanna; r-help at r-project.org
> Subject: Re: [R] previous business day
>
>
> On Oct 21, 2010, at 4:20 PM, Li, Jing Yi wrote:
>
>> Yeah, thanks Henrique for the code. It works! But I also have the
>> questions for the holidays.
>>
>
>   >  require(tis)
>
>   >  previousBusinessDay(Sys.Date()-1:3)
> [1] 20101019 20101018 20101015
> class: ti
>
> It runs on US "business days". You might be able to hack the holidays
> function if you were trying to transpose to another locale.
>
> --
> David.
>
>>
>> Please follow the attached hyperlink to an important disclosure:
>> http://www.credit-suisse.com/legal/marketcommentary
>>
>>
>> -----Original Message-----
>> From: Clint Bowman [mailto:clint at ecy.wa.gov]
>> Sent: Thursday, October 21, 2010 4:16 PM
>> To: Henrique Dallazuanna
>> Cc: Li, Jing Yi; r-help at r-project.org
>> Subject: Re: [R] previous business day
>>
>> May also wish to "or" in a check for holidays.
>>
>> --
>> Clint Bowman                  INTERNET:       clint at ecy.wa.gov
>> Air Quality Modeler           INTERNET:       clint at math.utah.edu
>> Department of Ecology         VOICE:          (360) 407-6815
>> PO Box 47600                  FAX:            (360) 407-7534
>> Olympia, WA 98504-7600
>>
>> On Thu, 21 Oct 2010, Henrique Dallazuanna wrote:
>>
>>> Try this:
>>>
>>> f<- function(d)if(format(d - 1, '%w') %in% c(0, 6)) Recall(d - 1)
>>> else d -
>>> 1
>>> d<- Sys.Date()
>>> f(d)
>>>
>>> On Thu, Oct 21, 2010 at 5:38 PM, Li, Jing Yi
>> <jingyi.li at credit-suisse.com>wrote:
>>>
>>>> How to get the previous business day in R? I saw some post about
>>>> using functions in timeSeries package before but can not find it
>> anymore.
>>>> Thanks!
>>>>
>>>>
>>>>
>>>>
>>>> =
>>>> ====================================================================
>>>> ========== Please access the attached hyperlink for an important
>>>> el...{{dropped:8}}
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>>
>>>
>>>
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>> Please access the attached hyperlink for an important el...{{dropped:
>> 4}}
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> West Hartford, CT
>
>
> ========================================================================
> =======
> Please access the attached hyperlink for an important el...{{dropped:4}}
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
> This e-mail and any materials attached hereto, including, without
> limitation, all content hereof and thereof (collectively, "XR Content")
> are confidential and proprietary to XR Trading, LLC ("XR") and/or its
> affiliates, and are protected by intellectual property laws.  Without
> the prior written consent of XR, the XR Content may not (i) be disclosed
> to any third party or (ii) be reproduced or otherwise used by anyone
> other than current employees of XR or its affiliates, on behalf of XR or
> its affiliates.
>
> THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES
> OF ANY KIND.  TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR
> HEREBY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING
> TO THE XR CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY
> EVENT BE LIABLE FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT
> NOT LIMITED TO, DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE
> DAMAGES, LOSS OF PROFITS AND TRADING LOSSES, RESULTING FROM ANY PERSON'S
> USE OR RELIANCE UPON, OR INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS
> ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR IF SUCH DAMAGES WERE
> FORESEEABLE.
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ===============================================================================
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
_________________________________________________________________
David Scott	Department of Statistics
		The University of Auckland, PB 92019
		Auckland 1142,    NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email:	d.scott at auckland.ac.nz,  Fax: +64 9 373 7018

Director of Consulting, Department of Statistics



More information about the R-help mailing list