smm329
New member
Hello everyone,
I am trying to calculate the straddle price of the underlying at a specific time frame, and the following code is giving me an issue. Can anyone here help me?
declare lower;
input symbol = "AAPL"; # Symbol of the underlying asset
input expirationDate = 20230617; # Expiration date of the option contract
input targetTime = 1430; # Target time in 24-hour format
def callOptionContract = GetATMOption(underlyingSymbol = symbol, yyyyMmDd = expirationDate);
def putOptionContract = getATMOption(symbol, expirationDate, OptionClass.PUT);
def callOptionBid = if SecondsFromTime(targetTime) == 0 then callOptionContract.priceType.MARK else Double.NaN;
def putOptionBid = if SecondsFromTime(targetTime) == 0 then putOptionContract.priceType.MARK else Double.NaN;
def sumBidPrices = callOptionBid + putOptionBid;
plot SumBidPrices = sumBidPrices;
I am trying to calculate the straddle price of the underlying at a specific time frame, and the following code is giving me an issue. Can anyone here help me?
declare lower;
input symbol = "AAPL"; # Symbol of the underlying asset
input expirationDate = 20230617; # Expiration date of the option contract
input targetTime = 1430; # Target time in 24-hour format
def callOptionContract = GetATMOption(underlyingSymbol = symbol, yyyyMmDd = expirationDate);
def putOptionContract = getATMOption(symbol, expirationDate, OptionClass.PUT);
def callOptionBid = if SecondsFromTime(targetTime) == 0 then callOptionContract.priceType.MARK else Double.NaN;
def putOptionBid = if SecondsFromTime(targetTime) == 0 then putOptionContract.priceType.MARK else Double.NaN;
def sumBidPrices = callOptionBid + putOptionBid;
plot SumBidPrices = sumBidPrices;