Overall Statistics
Total Trades
125
Average Win
0.38%
Average Loss
-0.43%
Compounding Annual Return
12.173%
Drawdown
4.900%
Expectancy
0.146
Net Profit
5.895%
Sharpe Ratio
1.362
Probabilistic Sharpe Ratio
59.113%
Loss Rate
39%
Win Rate
61%
Profit-Loss Ratio
0.88
Alpha
0.112
Beta
-0.026
Annual Standard Deviation
0.075
Annual Variance
0.006
Information Ratio
-1.528
Tracking Error
0.166
Treynor Ratio
-3.992
Total Fees
$160.09
Estimated Strategy Capacity
$7500000000.00
import random
import numpy as np

class DancingYellowGreenAntelope(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 9, 25)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
        random.seed(1234)


    def OnData(self, data):
        weight = random.random() * 2 - 1  # `weight` is in the interval [-1, 1)
        quantity = self.CalculateOrderQuantity(self.symbol, weight)
        self.MarketOrder(self.symbol, quantity)
        
        # Generate insight
        if weight < 0:
            direction = InsightDirection.Down
        elif weight == 0:
            direction = InsightDirection.Flat
        else:
            direction = InsightDirection.Up
        insight = Insight.Price(self.symbol, timedelta(days=1), direction, weight = abs(weight))
        self.EmitInsights(insight)