yassinemaaroufi / MibianLib

Python Options Pricing Library
http://code.mibian.net
254 stars 77 forks source link

Performance Problems - Too Slow #7

Open victorjabur opened 7 years ago

victorjabur commented 7 years ago

I'm trying to calculate implied volatility and the greeks for around 40.000 options.

It takes me almost 20 minutes against another algorithm that do the same job in a fast way (less than 2 minutes).

Maybe it will need a better use of libraries like numpy and pandas in order to get things faster.

yassinemaaroufi commented 7 years ago

Hi,

I am all ears if you have a solution to optimize the library.

You also can develop one yourself and I can integrate it in the code.

On Sun, Jul 16, 2017 at 4:59 AM, Victor Hugo Jabur Passavaz < notifications@github.com> wrote:

I'm trying to calculate implied volatility and the greeks for around 40.000 options.

It takes me almost 20 minutes against another algorithm that makes the same job in a fast way (less than 2 minutes).

Maybe it will need a better use of libraries like numpy and pandas in order to get things faster.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yassinemaaroufi/MibianLib/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHtP1UnLNi8lMsoiZ6OpG3atXVM8vo2ks5sOYq8gaJpZM4OZMSC .

surajthorat commented 3 years ago

@yassinemaaroufi thank you for the great library. This is one of the most userfriendly library if I need to calculate metrics for 1 option but I have come across the same problem.

@victorjabur can you post the library that gets things done faster? Even I am looking for a similar solution where in I have a lot of options in a data frame and need to calculate their implied volatility and greeks.

iceboal commented 3 years ago

I haven't tested it but I suspect it's because this loop is slow sometimes. Especially when the input is invalid and doesn't have a solution (I ran into it when my underlying spot price and the option price isn't fetched from the same time).

Perhaps you can tweak the constants or use a more efficient solver.

@surajthorat I can PM you if you are still looking for solutions.

apmcodes commented 5 months ago

Is there a performant library to get option greeks from option prices

purohitank commented 5 months ago

Look for py-vollib-vectorized. Here is the link.