4

You could just use the ql.Date().from_date method. Example: d0 = pd.to_datetime(date(2010,1,1)) df = pd.DataFrame() df['month #'] = np.arange(0,60) df['dates'] = df.apply( lambda x: d0 + pd.DateOffset(months = x['month #']) , axis = 1 ) df['cf'] = 0 df.iloc[0,2] = -100 df.iloc[1:,2] = 2 df['qldate'] = df.dates.apply(ql.Date().from_date) df['dayc act 365'] =...


4

I think your discrepancy is a problem in Excel: https://support.office.com/en-us/article/DAYS360-function-b9a509fd-49ef-407e-94df-0cbda5718c2a =DAYS360(29/02/2016,01/03/2016,0) = 1 (suitable for 30/360 US) =DAYS360(29/02/2016,01/03/2016,1) = 2 And reverse calculated the different is 2, because Excel count both days as whole days: =DAYS360(01/03/2016,29/02/...


4

No. It is a detail that is important to get right, but otherwise uninteresting. There is no point in changing a convention once you've set one. There are some more common ones associated with the biggest markets, like Act/360, but that's all. Day count conventions are well documented. There is a degree of consolidation via ISDA standard contracts in the ...


3

What you've calculated is essentially ACT/ACT day count basis, since you use the actual number of days between the dates and the actual number of dates in the coupon period. With a 30/360 DCC, you treat each month as if it has 30 days, and that there are 360 days in a year (which means that there are 12 even interest periods). So the calculation is done in ...


3

Day count conventions such as Act/Act or Act/360 are used for bond math, e.g. interest accrual calculation. The $dt$ in your Monte Carlo simulation is just model time increment and is unrelated to day count conventions. If $T$ is your time horizon for the simulation and you want a uniformly spaced time line $\{t_k\}$ with $N$ time points simply set $dt = T/N$...


3

There are lots, decide which ones you actually need for your project - follow the coding maxim You Ain't Gonna Need It. Be aware that those rules have variants: Actual/365 has 2 varieties, fixed and actual, 30/360 has at least 3 varieties (see that Wikipedia article). Then there is Brazillian Bus/252, etc etc. Consider using a library (like Fincad or ...


3

The discount curve should be constructed such that there's a one-to-one mapping between a date and a discount factor. It is common practice to use either Actual/365 or Actual/365.25 for the discount curve. Once a convention has been adopted, it should be used for all discount curve construction, regardless of the market convention of the product in question. ...


2

I am using Act/365 day-count convention. How do I compute the time offset between 2/28/2015 and 3/1/2016? 3/1/2017 So it is not clear whether you are referring to the Act/365F (Fixed) or the Act/365A (Actual). I think you are trying to us Act/365A as it is much more commonly used in the USA. Where as the Act/365F is more used in the UK from what I know. ...


2

As I know act/act you are using the sum of 2 fractions. One with 365 and one with 366 in the denominator. In your example the number of days in non-leap-years is 1155 and we have 366 days in leap-years. The resulting year fraction would be 1155/365 + 366/366 = 4.164


2

You're pretty much correct, so these are mostly confirmations: Yes, the "3-month" USD LIBOR rate is really a 2 business day forward 3-month LIBOR rate (assuming the anchor date of your yield curve, the date on which the discount factor is 1, is "today"). USD swaps observe both New York and London holidays. If the maturity date is a bad day, it is adjusted ...


2

The swap convention is that on swap start, the swap has 0 value. In your example, you entered into a swap to start in two days. The convention for Libor is that the fix applies from settlement date for the tenor of rate, calculated on an Act/360 basis. From the start of the swap, 1/9/19, to the first payment date of 4/9/19, there is exactly 90 days hence ...


2

Do you have an actual example of this ? In practice I don't think you'll find bonds that have day count conventions that give an accrual factor > 1. Most Treasury bonds across the world are quoted using 30/360 or Actual/Actual so the accrual factor is always less than or equal to 1. Conventions that give accrual factors > 1 are mostly confined to ...


2

By no arbitrage, market participants need to agree on the values of the discount factor, even if they are using different conventions (day count, compounding period) to convert the discount factor into a rate. For example, consider two discount factors computed using continuous compounding, where one is computed using the 30/360 day count (year fraction $t_{...


2

I’m going to go on a limb and suggest that it was Stigum’s Money Market back in the late 70’s that formalised many of these conventions. This was the major reference at the time the bond and money markets exploded in size and volume. Along with academic / practitioner stalwarts like Frank Fabozzi, these conventions just became entrenched (and also why there ...


2

First and foremost, your premise that "most consumer loans/mortgages calculate interest daily based on act/365" is incorrect. At least in the United States, most single-family residential mortgages accrue interest on a 30/360 basis. Using the US mortgage market as the context of this discussion, an important point to remember, and one which you ...


1

For most fixed-coupon bonds in most markets, the convention is that the daycount is only used to calculate the accrued coupon in the middle of the coupon period. If the complete coupon is paid at the end of the coupon period, then this is the quoted coupon. There are exceptions to this, for example, Mexico MBONOs are fixed coupon, but if the coupon date (...


1

You get yield to maturity (YTM) - the yield assuming the calls are not exercised even if they are in the money. According to the master himself http://quantlib.10058.n7.nabble.com/Yield-to-call-for-callable-bonds-td17004.html there's no straighforward way. One workaround would be to instantiate a second bond with maturity equal to the callability date ...


1

Quarterly-Quarterly Swaps (normal rolls) start on a specific date, say 20th March 2018 and have roll dates on the 20th of each Mar, Jun, Sep and Dec, meaning the fixing and accrual start date will be as close as possible to the 20th (but rolled forward if the 20th falls on a holiday). E.g. Normal QQ 20th Rolls Swap: PaymentDate Fixing Date Accrual Start ...


1

If you go to the description page of this bond it says under the calculation type: Day count is NL/365 for Shanghai or Shenzhen listed securities and ACT/ACT for all others. For Shanghai or Shenzhen listed bonds accrued interest is calculated inclusive of both the settlement and previous coupon. Note this will result in one day of interest for ...


1

In your second example (when no period is specified), the ActualActual.ISMA DayCounter basically returns RoundedNumberOfMonthsBetween(date1,date2) / 12 = 5 / 12 = 0.41666 whereas in the first one (when there is a specific period) some fancy adjustments are made based on the difference in days (20 - 8 + halfday = 12.5): RoundedNumberOfMonthsBetween(...


1

On most markets (GBP being a notable exception) the Libor fixes 2 days before its start date, so the Libor rate is actually a forward rate computed on $t_{\text{fix}}$ that covers the period $t_{\text{start}}$ to $t_{\text{end}}$. It has no impact on valuation of products with linear payoffs (such as swaps), but it does have an impact on the valuation of ...


1

Looking at the link to QuantLib's implementation of Act/Act AFB posted by Helin Gai in comments, this would be the part that the determines DiY (variable den): Real den = 365.0; // the DiY if (Date::isLeap(newD2.year())) { temp = Date(29, February, newD2.year()); if (newD2>temp && d1<=temp) den += 1.0; } else if (Date::isLeap(...


1

When the convention is ACT/360, it means that 365 calendar days of interest is calculated as 365/360 years. I knows it seems stupid, but before industrial use of computers, it was convenient for a year to be a nice round number like 360. I forget how the 30/360 convention is handled - I once coded up all the conventions, but they have worked really well ...


1

This is rather a long comment to your post. I think YEARFRAC version Act/Act has nothing to do with finance at all, probably it is a big bug. Also, I checked the link "Implementation of the YEARFRAC", the author of that page is not fully right either - "Property 1: Additivity" - day conventions need not be additive. Act/365L (and Act/Act-AFB) we sometimes ...


Only top voted, non community-wiki answers of a minimum length are eligible