¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: tickOptionComputation and impliedVolatility


 

If I remember correctly, they introduced that in TWS 980th version.

If you want to convert that number into typical Black Scholes volatility,
probably you can use smth like this (C# code):

? ? ? ? public void tickOptionComputation(int tickerId, int field, int tickAttrib, double impliedVolatility, double delta, double optPrice, double pvDividend, double gamma, double vega, double theta, double undPrice)
? ? ? ? {
? ? ? ? ? ? string[] bachAssets = new string[] { "COIL", "CL", "NG", "BZ" };
?
? ? ? ? ? ? // THIS PARAMETERS SHOULD BE RETRIEVED FROM YOUR REQUEST #tickerID
? ? ? ? ? ? string symbol = "CL"; // get contract symbol from tickerId 'th request
? ? ? ? ? ? double strike = 50; // get option strike from tickerId 'th request
?
?
? ? ? ? ? ? bool isBachelier = ClientSocket.ServerVersion >= MinServerVer.PRICE_BASED_VOLATILITY
? ? ? ? ? ? ? ? && bachAssets.Contains(symbol);
? ? ? ? ? ? if (isBachelier && impliedVolatility > 0 && impliedVolatility < double.MaxValue)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? double bachelierimpliedVolatility = impliedVolatility;
? ? ? ? ? ? ? ? // Bachelier -> Black 76
? ? ? ? ? ? ? ? double K = strike;
? ? ? ? ? ? ? ? double F = undPrice;
? ? ? ? ? ? ? ? if (0.95 <= K / F && K / F <= 1.05)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? // https://quant.stackexchange.com/questions/32644/is-the-implied-volatility-curve-different-under-the-black-scholes-and-bachelier/32653
? ? ? ? ? ? ? ? ? ? impliedVolatility = 1 / Math.Sqrt(K * F) * impliedVolatility; // Sigma_BS = 1/sqrt(KF) * Sigma_Bachelier
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? // https://quant.stackexchange.com/questions/38553/why-is-bachelier-implied-volatility-more-skewed-than-the-black-scholes-implied-v
? ? ? ? ? ? ? ? ? ? double m = K / F;
? ? ? ? ? ? ? ? ? ? impliedVolatility = 1 / F * Math.Log(m) / (m - 1) * impliedVolatility; // Sigma_BS = 1/F * ln(m)/(m-1) * Sigma_Bachelier
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
?
? ? ? ? ? ? // 'impliedVolatility' contains BS implied volatility
? ? ? ? }

Join [email protected] to automatically receive all group messages.