Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
-0.457%
Drawdown
0.000%
Expectancy
0
Net Profit
-0.028%
Sharpe Ratio
-5.236
Probabilistic Sharpe Ratio
2.931%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.002
Beta
0.003
Annual Standard Deviation
0.001
Annual Variance
0
Information Ratio
2.528
Tracking Error
0.147
Treynor Ratio
-1.003
Total Fees
$1.00
Estimated Strategy Capacity
$30000000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# region imports
from AlgorithmImports import *
# endregion

class WhenIsPortfolioUpdated(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2022, 12, 12)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.symbol = self.AddEquity("SPY", Resolution.Minute).Symbol
        self.order_count = 0

        # Schedule the daily evaluation at 1am on each trading day,
        # and after we get the daily bar for the previous trading day
        # which happens at midnight.
        self.Schedule.On(
            self.DateRules.EveryDay(self.symbol),
            self.TimeRules.At(1, 0),
            self.daily_evaluation
        )
    
    def daily_evaluation(self):
        if not self.Portfolio[self.symbol].Invested:
            # I didn't expect to reach this line more than once,
            # but we reached it twice. Strangely, only one market order
            # was executed. I expect it to be executed on Dec 12,
            # since this line is reached at the algo time of 1am on Dec 12.
            # However, the order is only executed at market open on Dec 13.
            self.MarketOrder(self.symbol, 1)
            self.Log('Placed market order at {}'.format(self.Time))

    def OnData(self, data: Slice):
        pass