Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
0.218%
Drawdown
0.000%
Expectancy
0
Net Profit
0.003%
Sharpe Ratio
11.846
Probabilistic Sharpe Ratio
100.000%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.003
Beta
0.003
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-21.755
Tracking Error
0.098
Treynor Ratio
1.17
Total Fees
$1.00
Estimated Strategy Capacity
$19000000.00
import pytz

class UglyBluePanda(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 9, 11)  # Set Start Date
        self.SetEndDate(2020, 9, 15)
        self.SetCash(100000)  # Set Strategy Cash
        
        self.SetSecurityInitializer(lambda x: x.SetFillModel(ExtendedMarketHoursFillModel(self)))
        
        self.symbol = self.AddEquity("SPY", extendedMarketHours=True).Symbol
        self.ordered = 0
    

    def OnData(self, data):
        if not self.ordered:
            self.ordered = True
            self.MarketOrder(self.symbol, 1)
            
class ExtendedMarketHoursFillModel(FillModel):
    
    def __init__(self, algo):
        self.algo = algo

    def Fill(self, parameters):
        security = parameters.Security
        order = parameters.Order
        utcTime = pytz.timezone("America/New_York").localize(self.algo.Time, is_dst=None).astimezone(pytz.utc)
        order_event = OrderEvent(order, utcTime, OrderFee.Zero)
        order_event.FillPrice = security.Price
        order_event.Status = OrderStatus.Filled
        order_event.FillQuantity = order.Quantity
        return Fill(order_event)