tailieunhanh - Financial Toolbox For Use with MATLAB Computation Visualization Programming phần 2

Vì vậy bạn có thể tính toán sự khác biệt giữa hai ngày theo bốn cách khác nhau. Cách thứ nhất (cơ sở = 0) chỉ đơn giản là trả lại sự khác biệt trong những ngày thực tế giữa hai ngày. Thứ hai (cơ sở 1) trả về sự khác biệt, nhưng điều chỉnh đến một năm 360 ngày, trong đó tất cả các tháng có 30 ngày. | 1 Tutorial The default basis is actual days if none is specified. The toolbox basis choices are basis 0 Actual days default basis 1 360-day year assumes all months are 30 days basis 2 Actual days 360 basis 3 Actual days 365 Thus you can compute the difference between two dates in four different ways. The first way basis 0 simply returns the difference in actual days between two dates. The second basis 1 returns the difference but adjusted to a 360-day year in which all months have 30 days. The third and fourth methods return a difference in dates as a fraction of either a 360- or 365-day year respectively. Determining Dates The toolbox provides many functions for determining specific dates including functions which account for holidays and other non-trading days. For example you schedule an accounting procedure for the last Friday of every month. The Iweekdate function returns those dates for 1998 the 6 specifies Friday fridates lweekdate 6 1998 1 12 fridays datestr fridates fridays 30 Jan 1998 27 Feb 1998 27 Mar 1998 24 Apr 1998 29 May 1998 26 Jun 1998 31 Jul 1998 28 Aug 1998 25 Sep 1998 30 Oct 1998 27 Nov 1998 25 Dec 1998 1-28 Understanding the Financial Toolbox Or your company closes on Martin Luther King Jr. Day which is the third Monday in January. The nweekdate function determines those dates for 1998 through 2001 mlkdates nweekdate 3 2 1998 2001 1 mlkdays datestr mlkdates mlkdays 19-Jan-1998 18-Jan-1999 17-Jan-2000 15-Jan-2001 Accounting for holidays and other non-trading days is important when examining financial dates. The toolbox provides the holidays function which contains holidays and special non-trading days for the New York Stock Exchange between 1950 and 2030 inclusive. You can edit the file to customize it with your own holidays and non-trading days. In this example use it to determine the standard holidays in the last half of 1998 lhhdates holidays 1-Jul-1998 31-Dec-1998 lhhdays datestr lhhdates lhhdays 03-Jul-1998 07-Sep-1998 26- .