1
$\begingroup$

I am looking for a way to obtain dates and amounts of each cashflow in a leg, without having to pop the cashflows out of the leg, like this

for i in range(leg.size()):
    x=leg.pop()
    print(x.date(), x.amount())
$\endgroup$
2
  • $\begingroup$ This is probably better suited for Stack Overflow $\endgroup$
    – amdopt
    May 3 at 16:26
  • 3
    $\begingroup$ Questions about the QuantLib API (or similar) are fine for me. $\endgroup$
    – Bob Jansen
    May 3 at 16:41

1 Answer 1

4
$\begingroup$

A leg is just a list of cashflows:

for c in leg:
    print(c.date(), c.amount())
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.