Overall Statistics
Total Orders
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Start Equity
100000
End Equity
100000
Net Profit
0%
Sharpe Ratio
0
Sortino Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-19.469
Tracking Error
0.047
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
# region imports
from AlgorithmImports import *
# endregion

class ImpliedVolatilityAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2024, 7, 1)
        self.set_end_date(2024, 7, 8)
        self._symbol = self.add_equity("SPY", Resolution.DAILY).symbol
        self._option = Symbol.create_option("SPY", Market.USA, OptionStyle.AMERICAN, OptionRight.PUT, 225, datetime(2024, 7, 12))
        self.add_option_contract(self._option, Resolution.DAILY)
        self._mirror_option = Symbol.create_option("SPY", Market.USA, OptionStyle.AMERICAN, OptionRight.CALL, 225, datetime(2024, 7, 12))
        self.add_option_contract(self._mirror_option, Resolution.DAILY)
        self.my_iv = self.iv(self._option, self._mirror_option)
        self.count_indicator_history = self.indicator_history(self.my_iv, [self._symbol, self._option, self._mirror_option], 100, Resolution.MINUTE)
        self.timedelta_indicator_history = self.indicator_history(self.my_iv, [self._symbol, self._option, self._mirror_option], timedelta(days=10), Resolution.MINUTE)
        self.time_period_indicator_history = self.indicator_history(self.my_iv, [self._symbol, self._option, self._mirror_option], datetime(2024, 7, 1), datetime(2024, 7, 5), Resolution.MINUTE)
        self.indicator_history_df = self.time_period_indicator_history.data_frame
        

    def OnData(self,slice):
        self.Log(self.my_iv.Current.Value)