Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG? _dcf_actacticma with leap year #144

Open
shh6242 opened this issue Apr 18, 2024 · 3 comments
Open

BUG? _dcf_actacticma with leap year #144

shh6242 opened this issue Apr 18, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers securities

Comments

@shh6242
Copy link

shh6242 commented Apr 18, 2024

Bill.dcf attribute throws large dcf years when using convention ActActICMA.
I think the problem is the effective date of 29th Feb 2024.

Could you please see if _dcf_actacticma working well for the leap year?

Replicate code as below,

from rateslib import Bill
from datetime import datetime as dt

bill_actacticma = Bill(
    effective= dt(2024, 2, 29),
    termination= dt(2024, 5, 29),   # 90 calendar days
    modifier='NONE',
    calendar= 'bus',
    payment_lag= 0,
    notional=-1000000,
    currency='usd',
    convention='ACTACTICMA',        
    settle=0, 
    calc_mode='ustb', 
)

bill_act360 = Bill(
    effective= dt(2024, 2, 29),
    termination= dt(2024, 5, 29),   # 90 calendar days
    modifier='NONE',
    calendar= 'bus',
    payment_lag= 0,
    notional=-1000000,
    currency='usd',
    convention='ACT360',        
    settle=0, 
    calc_mode='ustb', 
)

print(bill_actacticma.dcf)  # 8333333.333333333
print(bill_act360.dcf)        # 0.25

thank you.

@attack68
Copy link
Owner

Actually the problem here is that Bill is created with a default frequency of "Z". It is only ever a single period.
You will probably get the same problem with any Bill that uses ActActICMA.

The DCF "ActActICMA" requires a known frequency to define a regular period. In your case this is obviously 3 months so the DCF should be 0.25.

However, it is unclear to me what to do here.
What if you defined a 4month or 9month ActActICMA Bill, what should be the result?

@attack68
Copy link
Owner

#147 looks to handle this. But its still not clear what to do, but now at least the User is better informed.

@shh6242
Copy link
Author

shh6242 commented Apr 20, 2024

Thanks for reply:)

What do you think about telling the user for bill that frequency would be forced into 'z'? I think the doc string is redundant which says:
instruments.p line 2796
frequency : str in {"M", "B", "Q", "T", "S", "A"}, optional
The frequency of the schedule. "Z" is not permitted.

Bur in the end Bill instance always have frequency of 'z'.

@attack68 attack68 added documentation Improvements or additions to documentation good first issue Good for newcomers securities labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers securities
Projects
None yet
Development

No branches or pull requests

2 participants