Overall Statistics
Total Orders
6
Average Win
0%
Average Loss
-0.01%
Compounding Annual Return
-0.316%
Drawdown
0.000%
Expectancy
-1
Start Equity
100000
End Equity
99992.48
Net Profit
-0.008%
Sharpe Ratio
-7.861
Sortino Ratio
-9.861
Probabilistic Sharpe Ratio
24.012%
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.006
Beta
0.003
Annual Standard Deviation
0.001
Annual Variance
0
Information Ratio
-4.945
Tracking Error
0.092
Treynor Ratio
-1.307
Total Fees
$5.00
Estimated Strategy Capacity
$2900000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
Portfolio Turnover
0.24%
# region imports
from AlgorithmImports import *
# endregion

class HipsterYellowGreenHippopotamus(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2021, 7, 1)
        self.set_end_date(2021, 7, 9)
        self.set_cash(100000)
        self.universe_settings.data_normalization_mode = DataNormalizationMode.RAW
        self.add_equity("SPY")

    def on_data(self, data):
        if not self.portfolio.invested:
            quantity = 1
            factor = 0.99
            if self.time.day % 2 != 0:
                quantity = -1
                factor = 1.01
            
            self.market_order("SPY", quantity)
            self.stop_market_order("SPY", -quantity, data["SPY"].close * factor)