• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Options Pricing with Python - Exotics and the Vanna Volga method

Joined
11/5/14
Messages
294
Points
53
Hi friends,

I delivered a talk to my team today on Options Pricing with Python. It was tremendous fun - with lots of intuitive examples, code-snippets and visuals.

I would love to share the powerpoint deck and the PDF document containing the code snippets.

Cheers!
Quasar.
 

Attachments

  • Options pricing using Python.pptx
    2.1 MB · Views: 876
  • Options pricing with Python - Examples.pdf
    1.4 MB · Views: 1,204
Hi friends,

I delivered a talk to my team today on Options Pricing with Python. It was tremendous fun - with lots of intuitive examples, code-snippets and visuals.

I would love to share the powerpoint deck and the PDF document containing the code snippets.

Cheers!
Quasar.
Your python code doesn't look really Pythonic. It looks more like you are coding in C++ or Java instead of Python.

For example, your initialization of the C ndarray could be done better this way:
C++:
if optionType == 'C':
    C[N] = np.where(S[N] > strike, S[N]-strike, 0)
else:
    C[N] = np.where(strike > S[N], strike-S[N], 0)

or if you want to take it to the next level:
C++:
C[N] = np.where(S[N] > strike, S[N]-strike, 0) if optionType == 'C' else np.where(strike > S[N], strike-S[N], 0)

In Scientific Python, you tried to avoid loops as much as possible. That's the power of the language.
 
Hi, I tried using the code as you wrote it and keep getting a math domain error.

sigma = sigma2 + (-sigma2 + math.sqrt(sigma2*2 + d1d2 *(2sigma2*P+Q)))/(d1d2) -> causes the issue as the "P" component is negative under the square root. I am probably missing something. Any help would be appreciated. Thanks.
 
Hi, I tried using the code as you wrote it and keep getting a math domain error.

sigma = sigma2 + (-sigma2 + math.sqrt(sigma2*2 + d1d2 *(2sigma2*P+Q)))/(d1d2) -> causes the issue as the "P" component is negative under the square root. I am probably missing something. Any help would be appreciated. Thanks.
you have to divide the volatility by 100
and replace math.sqrt with numpy.sqrt (import numpy)
 
Back
Top