| 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 -0.183 Tracking Error 0.184 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset Portfolio Turnover 0% |
from AlgorithmImports import *
class SwimmingFluorescentPinkArmadillo(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2010, 3, 1)
self.set_end_date(2010, 6, 19)
self.set_cash(100000)
self.res = Resolution.MINUTE
self.universe_settings.resolution = self.res
self.add_equity("SPY")
# Use datetime for expiry to avoid runtime error
self._contract_symbol = Symbol.create_option(
"SPY",
Market.USA,
OptionStyle.AMERICAN,
OptionRight.PUT,
120,
datetime(2010, 6, 19)
)
self.option = self.add_option_contract(self._contract_symbol, resolution=self.res)
self.day = 0
self.high_of_day = 0.0
self.schedule.on(
self.date_rules.every_day(),
self.time_rules.after_market_close("SPY", 1),
self.plot_highs
)
def on_data(self, data: Slice) -> None:
if data.contains_key(self.option.symbol) and data[self.option.symbol] is not None:
bar = data[self.option.symbol]
high_value = getattr(bar, 'high', None)
if high_value is not None:
if self.time.day != self.day:
self.high_of_day = high_value
self.day = self.time.day
elif high_value > self.high_of_day:
self.high_of_day = high_value
def plot_highs(self) -> None:
self.plot("Option Pricing", "100619P00121000", self.high_of_day)