| Overall Statistics |
|
Total Trades 2 Average Win 0% Average Loss 0.00% Compounding Annual Return 24.853% Drawdown 1.500% Expectancy -1 Net Profit 1.779% Sharpe Ratio 2.624 Probabilistic Sharpe Ratio 66.819% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.245 Beta -0.194 Annual Standard Deviation 0.079 Annual Variance 0.006 Information Ratio 0.1 Tracking Error 0.122 Treynor Ratio -1.069 Total Fees $14.78 |
class WeeklyAlphaCompetitionAlgorithm(QCAlgorithm):
def Initialize(self):
# The blocked section of code below is to remain UNCHANGED for the weekly competitions.
#
# Insight-weighting portfolio construction model:
# - You can change the rebalancing date rules or portfolio bias
# - For more info see https://github.com/QuantConnect/Lean/blob/master/Algorithm.Framework/Portfolio/InsightWeightingPortfolioConstructionModel.py
#
# Use the Alpha Streams Brokerage Model:
# - Developed in conjunction with funds to model their actual fees, costs, etc. Please do not modify other models.
###############################################################################################################################
self.SetStartDate(2020, 12, 1) # 5 years up to the submission date
self.SetCash(1000000) # Set $1m Strategy Cash to trade significant AUM
self.SetBenchmark('SPY') # SPY Benchmark
self.SetBrokerageModel(AlphaStreamsBrokerageModel())
self.SetExecution(ImmediateExecutionModel())
self.SetPortfolioConstruction(InsightWeightingPortfolioConstructionModel())
###############################################################################################################################
# Do not change the code above
# Add the alpha model and anything else you want below
self.AddAlpha(MyCompetitionAlphaModel())
# Add a universe selection model
symbols = [ Symbol.Create("SPY", SecurityType.Equity, Market.USA) ]
self.AddUniverseSelection( ManualUniverseSelectionModel(symbols) )
self.UniverseSettings.Resolution = Resolution.Daily
class MyCompetitionAlphaModel:
def __init__(self, *args, **kwargs):
'''Initializes a new default instance of your Alpha Model class.'''
pass
def Update(self, algorithm, data):
'''Updates this alpha model with the latest data from the algorithm.
This is called each time the algorithm receives data for subscribed securities
Args:
algorithm: The algorithm instance
data: The new data available
Returns:
The new insights generated'''
insights = [Insight.Price("SPY", timedelta(minutes = 20), InsightDirection.Up, None, None, None, 1)]
# This is where insights are returned, which are then passed to the
# Portfolio Construction, Risk, and Execution models.
# The following Insight properties MUST be set before returning
# - Symbol -- Secuirty Symbol
# - Duration -- Time duration that the Insight is in effect
# - Direction -- Direction of predicted price movement
# - Weight -- Proportion of algorithm capital to be allocated to this Insight
return insights
def OnSecuritiesChanged(self, algorithm, changes):
'''Event fired each time the we add/remove securities from the data feed
Args:
algorithm: The algorithm instance that experienced the change in securities
changes: The security additions and removals from the algorithm'''
pass