|
From: Goutham M. <gou...@gm...> - 2021-11-21 09:12:21
|
Hi, Ok I will try this out and update. Best, Goutham On Sat, Nov 20, 2021, 16:28 Luigi Ballabio <lui...@gm...> wrote: > If you want to filter the past cash flows out, you can write something > like: > > remaining_cashflows = [ cf for cf in floatingleg if not > cf.hasOccurred() ] > > Hope this helps, > Luigi > > > On Sat, Nov 20, 2021 at 12:16 PM Goutham Mahesh < > gou...@gm...> wrote: > >> Hi all, >> >> Luigi - Ok I understood that. But I am actually not trying to pass the >> resulting leg into a function like swap.NPV, instead I want to enumerate >> the cash flows from swap.leg(floatingleg). When I do this I am still >> receiving all the Cash Flows(based on the full schedule) and not the ones >> that I need to reflect the new date. My goal is to pass the floating leg >> cash flows into a list. >> >> Charles - What do you mean by that? Sorry, I did not understand. >> >> Thank you all, >> Best, >> Goutham >> >> On Thu, Nov 18, 2021 at 4:55 PM Charles Allderman <ch...@al...> >> wrote: >> >>> I would use a vector of cash flow dates in conjunction with your vector >>> of cash flows and then filter with dates being greater than your evaluation >>> date. >>> >>> On Tue, Nov 16, 2021 at 10:54 PM Goutham Mahesh < >>> gou...@gm...> wrote: >>> >>>> Hi All, >>>> >>>> This is the scenario: >>>> >>>> I have computed the floating leg for and IRS as follows: >>>> floatingleg = IborLeg(data, SwapSchedule, index, Actual360(), >>>> ModifiedFollowing, fixingDays=[0], gearings=[1], spreads = [0]) >>>> >>>> The SwapSchedule is a schedule set for 3 years with quarterly >>>> payments, therefore there are 12 floating leg payments for the swap. >>>> >>>> "data" is a list of 12 nominals for each of the 12 floating leg cash >>>> flows. >>>> data = [1000000, 1000000, 1000000, 1000000, 1000000, 869565, 739130, >>>> 608695, 478260, 347826, 217391, 86956] >>>> >>>> Let us say now that 1 year and 4 cash flow dates have passed. I have >>>> to re-calculate the floating leg. >>>> The "data" list now has 8 nominals to reflect the 8 remaining cash >>>> flow dates. >>>> data = [1000000, 869565, 739130, 608695, 478260, 347826, 217391, 86956] >>>> >>>> My doubt is regarding how to recalculate my floating leg, and if I >>>> should use a new SwapSchedule or a new index. >>>> >>>> For building the SwapSchedule I have currently used the original >>>> date(old_date) and original maturity_date because I do not want the >>>> cash flow dates to change. >>>> >>>> As for the index I have done: >>>> Settings.instance().evaluationDate = new_date >>>> I have built the index using the methodology in the python cookbook >>>> quantlib IRS example. >>>> >>>> The code is running in this situation but the floating leg is still >>>> returning 12 cash flows, whereas I want to return only 8 cash flows to >>>> reflect the 8 remaining payments of the floating leg. >>>> >>>> -- >>>> >>>> Any help will be appreciated as I have been trying really hard to >>>> figure this problem out. If you require more info as to how I built the >>>> index I will send that as well. >>>> >>>> Thank you, >>>> Goutham >>>> _______________________________________________ >>>> QuantLib-users mailing list >>>> Qua...@li... >>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>>> >>> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |