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()):
    print(x.date(), x.amount())
  • $\begingroup$ This is probably better suited for Stack Overflow $\endgroup$
    – amdopt
    Commented May 3, 2023 at 16:26
  • 3
    $\begingroup$ Questions about the QuantLib API (or similar) are fine for me. $\endgroup$
    – Bob Jansen
    Commented May 3, 2023 at 16:41

1 Answer 1


A leg is just a list of cashflows:

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

Your Answer

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

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