FinancePy icon indicating copy to clipboard operation
FinancePy copied to clipboard

Vectorisation of Calculations

Open domokane opened this issue 4 years ago • 3 comments

Some functions take a date as an input. However I would like to be able to pass in a vector/list of dates and/or a vector of enums and get a corresponding vector of values.

This is shown in notebook

https://github.com/domokane/FinancePy/blob/master/notebooks/products/equity/EQUITY_VANILLA_EUROPEAN_STYLE_OPTION_VECTORISATION.ipynb

Consider f(x,y,z). Behaviour that would be good

  1. If x is an N-element vector and y, z not then f(x,y,z) is an N-element vector for each value of x
  2. If x is an N-element vector and y is an N element vector but z is not then f(x,y,z) is an N-element vector for each value of x,y
  3. If x, y, z are all an N-element vector then f(x,y,z) is an N-element vector for each value of x,y

A generic approach would be best that is easy to modify and relies on a central function that takes as argument the function to be called.

domokane avatar Nov 15 '20 21:11 domokane

I'll take this up.

poornagurram avatar Nov 16 '20 07:11 poornagurram

Great!

domokane avatar Nov 16 '20 07:11 domokane

#49 - Enum Support

poornagurram avatar Dec 07 '20 18:12 poornagurram

Hi, looks like the list of dates part of this was never implemented. I'm happy to do it if no one else is

idorrington92 avatar Feb 03 '23 12:02 idorrington92

Hi - I have not looked at this for a while. Please look into it and if you have a good solution then I would be happy if you could do it. Ideally it should be a solution that can be applied to many functions with minimum changes. So a helper function or other approach will be needed. Best D

domokane avatar Feb 03 '23 12:02 domokane