Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
from AlgorithmImports import *

class TransdimensionalDynamicThrustAssembly(QCAlgorithm):

    def Initialize(self):

        # setting Universe Size and ETF Ticker:
        self.UniverseSize = 9
        self.ETFSymbol = 'ACWI'

        self.SetStartDate(2010, 1, 1)  # Set Start Date
        self.SetEndDate(2020, 1, 1)  # Set End Date
   
        # Set Cash, Brokerage Model, Universe Settings and Warmup
        self.SetCash(100000)  
        self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)
        self.SetSecurityInitializer(lambda security: security.SetMarketPrice(self.GetLastKnownPrice(security)))
        self.UniverseSettings.Resolution = Resolution.Daily
        self.SetWarmup(150)

        # Define the Universe
        self.AddUniverse(self.Universe.ETF(self.ETFSymbol, Market.USA, self.UniverseSettings, self.ETFConstituentsFilterStatic))

        # everything else to Null
        self.SetPortfolioConstruction(NullPortfolioConstructionModel())
        self.SetAlpha(NullAlphaModel())
        self.SetExecution(NullExecutionModel())
        self.SetRiskManagement(NullRiskManagementModel())

    def ETFConstituentsFilterStatic(self, constituents: List[ETFConstituentData]) -> List[Symbol]:

        # Original Version - select all ETF constituens that have a weight property and sort them by that weight
        selected = sorted([c for c in constituents if c.Weight],
            key=lambda c: c.Weight, reverse=True)

        # Crude Fix to avoid other ETFs being returned as constituents of ACWI - filtering for a list of ETF tickers that have come up in testing so far
        
        # etfs = ['CRED', 'IVV', 'IJH', 'IPAC', 'IEUR', 'IEMG', 'INDA']
        # selected = sorted([c for c in constituents if c.Weight and c.Symbol.Value not in etfs],
        #     key=lambda c: c.Weight, reverse=True)

        # return the self.UniverseSize largest constituents by weight:
        return [c.Symbol for c in selected][:self.UniverseSize]


    def OnSecuritiesChanged(self, changes: SecurityChanges) -> None:

        # List all tickers added to the universe
        if changes.AddedSecurities:
            self.Debug(str(self.Time) + " Adding to universe: " + str(
                [security.Symbol.Value for security in changes.AddedSecurities]))