Need to find what is mistake in the code

Course Name: Options Trading Strategies In Python: Intermediate, Section No: 4, Unit No: 3, Unit type: Exercise

 

Error u need to use 'stock_price' without quotes after

mibian.BS([

 

Why this error popping up?



code


Import the library

import mibian

Define parameters

stock_price = 100

strike_price = 100

interest_rate = 0

days_to_expiry = 40

volatility = 30.00

Type your code below

greeks = mibian.BS([100,100,0,40],volatility=30)

print(greeks.vega)

Hi,



The error arises because the 'mibian.BS' function is expecting variable references like stock_price, strike_price, etc., not hardcoded values in the list. However, we have modified the exercise to accept direct values, too. Still, passing the variable reference is always a good practice to make your code more modular and easier to work with.