Overall Statistics
Total Trades
9
Average Win
0%
Average Loss
0%
Compounding Annual Return
64.975%
Drawdown
0.600%
Expectancy
0
Net Profit
1.753%
Sharpe Ratio
8.866
Probabilistic Sharpe Ratio
86.233%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.9
Beta
0.333
Annual Standard Deviation
0.083
Annual Variance
0.007
Information Ratio
11.446
Tracking Error
0.108
Treynor Ratio
2.206
Total Fees
$0.00
"""
class AmundiMSCIWorld(PythonData):
    '''Amundi MSCI World Custom Data Class'''
    
    def GetSource(self, config, date, isLiveMode):
        
        return SubscriptionDataSource('https://microsegundos.com/wp-content/uploads/2020/03/Amundi_MSCI_World_prepared.csv', SubscriptionTransportMedium.RemoteFile)
        
    
    def Reader(self, config, line, date, isLiveMode):
        
        # New Amundi MSCI World object
        index = AmundiMSCIWorld()
        index.Symbol = config.Symbol
        
        try:
            
            data = line.split(';')
            index.Time = datetime.strptime(data[0], "%Y-%m-%d")
            index.Value = data[1]
            index["Close"] = float(data[1])
             
        except ValueError:
            return None
             
        return index
        

class AmundiMSCIEmergingMarkets(PythonData):
    '''Amundi MSCI Emerging Markets Data Class'''


class Nifty(PythonData):
    '''NIFTY Custom Data Class'''
    def GetSource(self, config, date, isLiveMode):
        return SubscriptionDataSource("https://www.dropbox.com/s/rsmg44jr6wexn2h/CNXNIFTY.csv?dl=1", SubscriptionTransportMedium.RemoteFile)


    def Reader(self, config, line, date, isLiveMode):
        if not (line.strip() and line[0].isdigit()): return None

        # New Nifty object
        index = Nifty()
        index.Symbol = config.Symbol

        try:
            # Example File Format:
            # Date,       Open       High        Low       Close     Volume      Turnover
            # 2011-09-13  7792.9    7799.9     7722.65    7748.7    116534670    6107.78
            data = line.split(',')
            index.Time = datetime.strptime(data[0], "%Y-%m-%d")
            index.Value = data[4]
            index["Open"] = float(data[1])
            index["High"] = float(data[2])
            index["Low"] = float(data[3])
            index["Close"] = float(data[4])


        except ValueError:
                # Do nothing
                return None

        return index
"""
class NotebookProject(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2018, 4, 18)  # Set Start Date
        self.SetEndDate(2018, 4, 30)
        self.SetCash(1000000)  # Set Strategy Cash
        
        self.assets = ["ISHARES_CORE_MSCI_WORLD_UCITS", "ISHARES_MSCI_EMERGING_MARKETS_UCITS_ACC",
             "ISHARES_EURO_AGGREGATE_BOND_UCITS", "ISHARES_$_CORPORATE_BOND_UCITS",
             "VANGUARD_USD_TREASURY_BD", "ISHARES_DEVELOPED_MARKETS_PROPERTY_YIELD_UCITS",
             "THINK_GLOBAL_REAL_ESTATE", "ISHARES_EUROPEAN_PROPERTY_YIELD_UCITS",
             "ISHARES_ASIA_PROPERTY_YIELD_UCITS", "ISHARES_LISTED_PRIVATE_EQUITY_UCITS"
            ]
            
        self.etf_objects = []
        
        for etf in self.assets:
            
            new_etf = self.AddData(InvestingImport, etf, Resolution.Daily).Symbol
            self.etf_objects.append(new_etf)
            self.Debug(str.format("{0} data was added. {1} ", etf, new_etf.Value))
            

    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            Arguments:
                data: Slice object keyed by symbol containing the stock data
        '''
      
        if not self.Portfolio.Invested:
            for etf in self.etf_objects:
                self.SetHoldings(etf, 0.1)
        
        


class InvestingImport(PythonData):
    '''Custom Data Class to import prepared Investing data'''
    
    
    
    def GetSource(self, config, date, isLiveMode):
        
        universum = {"ISHARES_CORE_MSCI_WORLD_UCITS ": "https://microsegundos.com/wp-content/uploads/2020/03/iShares-Core-MSCI-World-UCITS.csv",
             "ISHARES_MSCI_EMERGING_MARKETS_UCITS_ACC": "https://microsegundos.com/wp-content/uploads/2020/03/iShares-MSCI-Emerging-Markets-UCITS-Acc.csv",
             "ISHARES_EURO_AGGREGATE_BOND_UCITS": "https://microsegundos.com/wp-content/uploads/2020/03/iShares-Euro-Aggregate-Bond-UCITS.csv",
             "ISHARES_$_CORPORATE_BOND_UCITS": "https://microsegundos.com/wp-content/uploads/2020/03/iShares-Corporate-Bond-UCITS.csv",
             "VANGUARD_USD_TREASURY_BD": "https://microsegundos.com/wp-content/uploads/2020/03/Vanguard-USD-Treasury-Bd.csv",
             "ISHARES_DEVELOPED_MARKETS_PROPERTY_YIELD_UCITS": "https://microsegundos.com/wp-content/uploads/2020/03/iShares-Developed-Markets-Property-Yield-UCITS.csv",
             "THINK_GLOBAL_REAL_ESTATE": "https://microsegundos.com/wp-content/uploads/2020/03/Think-Global-Real-Estate.csv",
             "ISHARES_EUROPEAN_PROPERTY_YIELD_UCITS": "https://microsegundos.com/wp-content/uploads/2020/03/iShares-European-Property-Yield-UCITS.csv",
             "ISHARES_ASIA_PROPERTY_YIELD_UCITS": "https://microsegundos.com/wp-content/uploads/2020/03/iShares-Asia-Property-Yield-UCITS.csv",
             "ISHARES_LISTED_PRIVATE_EQUITY_UCITS": "https://microsegundos.com/wp-content/uploads/2020/03/iShares-Listed-Private-Equity-UCITS.csv"
            }
            
        
        
        return SubscriptionDataSource(universum[config.Symbol.Value], SubscriptionTransportMedium.RemoteFile)
        
    
    def Reader(self, config, line, date, isLiveMode):
        
        # New InvestingImport object
        index = InvestingImport()
        index.Symbol = config.Symbol
        
        try:
            data = line.split(';')
            index.Time = datetime.strptime(data[0], "%Y-%m-%d")
            index["Open"] = float(data[1])
            index["High"] = float(data[2])
            index["Low"] = float(data[3])
            index.Value = data[4]
            index["Close"] = float(data[4])
        except ValueError:
            return None
             
        return index