rateslib icon indicating copy to clipboard operation
rateslib copied to clipboard

Rateslib Performance on large number of instuments

Open ChrisSun19921016 opened this issue 1 year ago • 2 comments

Hi

Is there a faster way of pricing a large number of instruments in rateslib? Say I have a calibrated curve and would like to calculate rate for 10000 instrument, what is a better way than running a for loop on these 10000 instruments?

Chris

ChrisSun19921016 avatar Sep 30 '24 15:09 ChrisSun19921016

See https://www.linkedin.com/pulse/rateslib-performance-1000-irs-rateslib/ and https://www.linkedin.com/pulse/rateslib-performance-1000-swaps-2024-rateslib-pufyf/

There are a number of things these discuss.

  1. Turning off AD on the curves if you just want to value them and not obtain any risk sensitivities.
  2. Add them to a Portfolio and setting cores in your defaults so that it can parallel calculate.

Interested to hear how you get on. I guess it is also relevant what type of Instruments you are building.

Also a few days ago you posted on QuantStack about turns in XCCY curves. Did you manage to solve the issue?

attack68 avatar Oct 01 '24 11:10 attack68

ah thanks for the info.

Tried with Portfolio but seems it could only calculate NPV instead of implied yield. Also, tried testing it on 1000 instruments, speed of calculation seems similar to just calculating individually.

That said, I have found a way of work around it, without having to calculate large amount of instruments.

Yes I have managed to found a way to model XCCY turns in rateslib, your page on "how to handle turns" is actually pretty useful!

ChrisSun19921016 avatar Oct 03 '24 05:10 ChrisSun19921016