About Beijing Calendar Class

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

About Beijing Calendar Class

Zhou Wu-2
 The Chinese calendar is pretty complicated. I don't
know if it worth doing coding to calculate the
holidays in QuantLib. Moreover, most algorithms can
only be accurate for hundreds years. In fact, Chinese
use the Western Calendar for most holidays except
Spring Festival. I guess it may be not a too bad idea
to just include one hundred years' Spring Festival
dates each before and after year 2004.

 As I remembered, the last day of a lunar year is also
a holiday in China. If this were true, the 2004 year
might miss one day in the current implementation. I
may be wrong. Some friends in China may tell.

Zhou


               
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail


Reply | Threaded
Open this post in threaded view
|

Re: About Beijing Calendar Class

Xavier.Abulker





Hi Zhou,
recently I sent to Quantlib the calendar for Being adding the lunar new yar
for 2004 but also the labor days and the national days.
I looks that for labor day for example, China has more bank holidays than
the western standard calendar.
Please fell free to corect me I'm wrong, this is what I sent to Quantlib.
These data are coming from different web site of derivatives exchange and I
suppose are the official settlement days for Futures.
Regards



  // Labor Day
                || ((d == 1 || d==2 || d==3 || d==4 || d==5 || d==6 || d
==7)  && m == May)

                                // National Day
                || ((d == 1 || d==2 || d==3 || d==4 || d==5 || d==6 || d
==7) && m == October)

                                // Lunar New Year 2004
                || ((d==22 || d==23 || d==24 || d==25 || d==26 || d==27 ||
d==28) && m == January && y==2004)


(See attached file: beijing.hpp)(See attached file: beijing.cpp)




                                                                                                                                     
                    Zhou Wu <[hidden email]>                                                                                      
                    Sent by:                               To:     [hidden email]                              
                    [hidden email]       cc:                                                                      
                    eforge.net                             Subject:     [Quantlib-users] About Beijing Calendar Class                
                                                                                                                                     
                                                                                                                                     
                    07/06/2004 01:48 AM                                                                                              
                                                                                                                                     
                                                                                                                                     





 The Chinese calendar is pretty complicated. I don't
know if it worth doing coding to calculate the
holidays in QuantLib. Moreover, most algorithms can
only be accurate for hundreds years. In fact, Chinese
use the Western Calendar for most holidays except
Spring Festival. I guess it may be not a too bad idea
to just include one hundred years' Spring Festival
dates each before and after year 2004.

 As I remembered, the last day of a lunar year is also
a holiday in China. If this were true, the 2004 year
might miss one day in the current implementation. I
may be wrong. Some friends in China may tell.

Zhou



__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users





*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration.
La FIMAT et ses filiales declinent toute responsabilite au titre de ce
message s'il a ete altere, deforme ou falsifie.
                                          ********
This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
E-mails are susceptible to alteration.
Neither FIMATnor any of its subsidiaries or affiliates shall be liable for
the message if altered, changed or falsified.

beijing.hpp (1K) Download Attachment
beijing.cpp (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: About Beijing Calendar Class

Zhou Wu-2
Hi Xavier,

   I got a file which contains 1900-2150's Spring
Festival dates correpsonding to western dates. No
matter what, Spring Festival (and the last day of
lunar year) is always a holiday in China. It may have
to be adjusted accroding to the current policy (China
only havd  had a week holidays for Labor Day or
Independent day since serveral years ago).

   If QuantLib really wants to include how to
calcualate Spring Festival, probably one can look at
http://thunder.eeap.cwru.edu/ccal/index.html .

Zhou
   

--- [hidden email] wrote:

>
>
>
>
>
> Hi Zhou,
> recently I sent to Quantlib the calendar for Being
> adding the lunar new yar
> for 2004 but also the labor days and the national
> days.
> I looks that for labor day for example, China has
> more bank holidays than
> the western standard calendar.
> Please fell free to corect me I'm wrong, this is
> what I sent to Quantlib.
> These data are coming from different web site of
> derivatives exchange and I
> suppose are the official settlement days for
> Futures.
> Regards
>
>
>
>   // Labor Day
>                 || ((d == 1 || d==2 || d==3 || d==4
> || d==5 || d==6 || d
> ==7)  && m == May)
>
>                                 // National Day
>                 || ((d == 1 || d==2 || d==3 || d==4
> || d==5 || d==6 || d
> ==7) && m == October)
>
>                                 // Lunar New Year
> 2004
>                 || ((d==22 || d==23 || d==24 ||
> d==25 || d==26 || d==27 ||
> d==28) && m == January && y==2004)
>
>
> (See attached file: beijing.hpp)(See attached file:
> beijing.cpp)
>
>
>
>
>                                                    
>                                                    
>                            
>                     Zhou Wu <[hidden email]>    
>                                                    
>                            
>                     Sent by:                        
>       To:     [hidden email]  
>                            
>                     [hidden email]
>       cc:                                          
>                            
>                     eforge.net                      
>       Subject:     [Quantlib-users] About Beijing
> Calendar Class                
>                                                    
>                                                    
>                            
>                                                    
>                                                    
>                            
>                     07/06/2004 01:48 AM            
>                                                    
>                            
>                                                    
>                                                    
>                            
>                                                    
>                                                    
>                            
>
>
>
>
>
>  The Chinese calendar is pretty complicated. I don't
> know if it worth doing coding to calculate the
> holidays in QuantLib. Moreover, most algorithms can
> only be accurate for hundreds years. In fact,
> Chinese
> use the Western Calendar for most holidays except
> Spring Festival. I guess it may be not a too bad
> idea
> to just include one hundred years' Spring Festival
> dates each before and after year 2004.
>
>  As I remembered, the last day of a lunar year is
> also
> a holiday in China. If this were true, the 2004 year
> might miss one day in the current implementation. I
> may be wrong. Some friends in China may tell.
>
> Zhou
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail is new and improved - Check it out!
> http://promotions.yahoo.com/new_mail
>
>
>
-------------------------------------------------------

> This SF.Net email sponsored by Black Hat Briefings &
> Training.
> Attend Black Hat Briefings & Training, Las Vegas
> July 24-29 -
> digital self defense, top technical experts, no
> vendor pitches,
> unmatched networking opportunities. Visit
> www.blackhat.com
> _______________________________________________
> Quantlib-users mailing list
> [hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>
>
>
>
*************************************************************************

> Ce message et toutes les pieces jointes (ci-apres le
> "message") sont
> confidentiels et etablis a l'intention exclusive de
> ses destinataires.
> Toute utilisation ou diffusion non autorisee est
> interdite.
> Tout message electronique est susceptible
> d'alteration.
> La FIMAT et ses filiales declinent toute
> responsabilite au titre de ce
> message s'il a ete altere, deforme ou falsifie.
>                                           ********
> This message and any attachments (the "message") are
> confidential and
> intended solely for the addressees.
> Any unauthorised use or dissemination is prohibited.
> E-mails are susceptible to alteration.
> Neither FIMATnor any of its subsidiaries or
> affiliates shall be liable for
> the message if altered, changed or falsified.

> ATTACHMENT part 2 application/octet-stream
name=beijing.hpp


> ATTACHMENT part 3 application/octet-stream
name=beijing.cpp




       
               
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 
1900.1.31
1901.2.20
1902.2. 8
1903.1.29
1904.2.16
1905.2. 5
1906.1.25
1907.2.13
1908.2. 2
1909.1.22
1910.2.10
1911.1.30
1912.2.18
1913.2. 6
1914.1.26
1915.2.14
1916.2. 3
1917.1.23
1918.2.11
1919.2. 1
1920.2.21
1921.2. 8
1922.1.28
1923.2.16
1924.2. 6
1925.1.24
1926.2.13
1927.2. 2
1928.1.23
1929.2.10
1930.1.30
1931.2.17
1932.2. 6
1933.1.26
1934.2.14
1935.2. 4
1936.1.24
1937.2.11
1938.1.31
1939.2.20
1940.2. 8
1941.1.27
1942.2.15
1943.2. 6
1944.1.25
1945.2.13
1946.2. 2
1947.1.22
1948.2.10
1949.1.29
1950.2.17
1951.2. 6
1952.1.27
1953.2.14
1954.2. 3
1955.1.24
1956.2.12
1957.1.31
1958.2.18
1959.2. 8
1960.1.28
1961.2.15
1962.2. 5
1963.1.25
1964.2.13
1965.2. 2
1966.1.21
1967.2. 9
1968.1.30
1969.2.17
1970.2. 6
1971.1.27
1972.2.15
1973.2. 3
1974.1.23
1975.2.11
1976.1.31
1977.2.18
1978.2. 7
1979.1.28
1980.2.16
1981.2. 5
1982.1.25
1983.2.13
1984.2. 2
1985.2.20
1986.2. 9
1987.1.29
1988.2.17
1989.2. 6
1990.1.27
1991.2.15
1992.2. 5
1993.1.23
1994.2.10
1995.1.31
1996.2.20
1997.2. 7
1998.1.28
1999.2.16
2000.2. 5
2001.1.24
2002.2.12
2003.2. 1
2004.1.22
2005.2. 9
2006.1.29
2007.2.18
2008.2. 7
2009.1.26
2010.2.14
2011.2. 3
2012.1.23
2013.2.10
2014.1.31
2015.2.20
2016.2. 8
2017.1.28
2018.2.16
2019.2. 5
2020.1.25
2021.2.12
2022.2. 1
2023.1.22
2024.2.10
2025.1.29
2026.2.17
2027.2. 6
2028.1.26
2029.2.13
2030.2. 3
2031.1.23
2032.2.11
2033.1.31
2034.2.19
2035.2. 8
2036.1.28
2037.2.15
2038.2. 5
2039.1.24
2040.2.12
2041.2. 1
2042.1.22
2043.2.10
2044.1.30
2045.2.17
2046.2. 6
2047.1.26
2048.2.14
2049.2. 2
2050.1.23
2051.2.11
2052.2. 1
2053.2.19
2054.2. 8
2055.1.28
2056.2.15
2057.2. 4
2058.1.24
2059.2.12
2060.2. 2
2061.1.21
2062.2. 9
2063.1.29
2064.2.17
2065.2. 5
2066.1.26
2067.2.14
2068.2. 3
2069.1.23
2070.2.11
2071.1.31
2072.2.20
2073.2. 7
2074.1.27
2075.2.15
2076.2. 5
2077.1.24
2078.2.12
2079.2. 2
2080.1.22
2081.2. 9
2082.1.29
2083.2.17
2084.2. 6
2085.1.26
2086.2.14
2087.2. 4
2088.1.24
2089.2.10
2090.1.30
2091.2.19
2092.2. 7
2093.1.27
2094.2.15
2095.2. 5
2096.1.25
2097.2.12
2098.2. 1
2099.1.21
2100.2. 9
2101.1.29
2102.2.17
2103.2. 7
2104.1.28
2105.2.15
2106.2. 5
2107.1.24
2108.2.12
2109.1.31
2110.2.20
2111.2. 8
2112.1.29
2113.2.16
2114.2. 6
2115.1.26
2116.2.14
2117.2. 2
2118.1.22
2119.2.10
2120.1.30
2121.2.17
2122.2. 7
2123.1.27
2124.2.15
2125.2. 3
2126.1.23
2127.2.11
2128.2. 1
2129.2.19
2130.2. 8
2131.1.29
2132.2.17
2133.2. 5
2134.1.25
2135.2.13
2136.2. 2
2137.1.22
2138.2.10
2139.1.30
2140.2.18
2141.2. 7
2142.1.27
2143.2.15
2144.2. 5
2145.1.23
2146.2.11
2147.2. 1
2148.2.20
2149.2. 8
2150.1.29
Reply | Threaded
Open this post in threaded view
|

Re: About Beijing Calendar Class

Ferdinando Ametrano-8
Hi Zhou

>    If QuantLib really wants to include how to
>calcualate Spring Festival, probably one can look at
>http://thunder.eeap.cwru.edu/ccal/index.html .

I don't think in QuantLib we should calculate Spring Festival or lunar year.

 > I guess it may be not a too bad idea
 > to just include one hundred years' Spring Festival
 > dates each before and after year 2004.

I would go this way as we did for Easter Monday.

Needless to say I would love if you and Xavier reach an effective
conclusion about the Chinese calendar and fix the implementation if needed.

ciao -- Nando



Reply | Threaded
Open this post in threaded view
|

Here are some code about Beijing Calendar Class.(Was: Re: About Beijing Calendar Class)

Zhou Wu-2
Hi Ferdinando and  Xavier,

   Here is the code I came up with for Beijing Class.
The spring festival date data is from ccal mentioned
below (I used perl script to check Jan and Feb to find
all the dates from 1900-2150). But since the Date
class only handles 1900-2099), I just include the data
in the beijing.hpp file. I think the files probably
cannot be compiled under VC++ since I remembered the
constant implementation is probably not standard
complied. It can be compiled under g++.
 
Zhou


--- Ferdinando Ametrano <[hidden email]> wrote:

> Hi Zhou
>
> >    If QuantLib really wants to include how to
> >calcualate Spring Festival, probably one can look
> at
> >http://thunder.eeap.cwru.edu/ccal/index.html .
>
> I don't think in QuantLib we should calculate Spring
> Festival or lunar year.
>
>  > I guess it may be not a too bad idea
>  > to just include one hundred years' Spring
> Festival
>  > dates each before and after year 2004.
>
> I would go this way as we did for Easter Monday.
>
> Needless to say I would love if you and Xavier reach
> an effective
> conclusion about the Chinese calendar and fix the
> implementation if needed.
>
> ciao -- Nando
>
>


               
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

beijing.cpp (2K) Download Attachment
beijing.hpp (7K) Download Attachment