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
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"
            }

class InvestingImport(PythonData):
    '''Custom Data Class to import prepared Investing data'''
    
    def GetSource(self, config, date, isLiveMode):
        
        return SubscriptionDataSource(universum[config.Symbol], SubscriptionTransportMedium.RemoteFile)
        
    
    def Reader(self, config, line, date, isLiveMode):
        
        # New InvestingImport object
        index = InvestingImport()
        index.Symbol = config.Symbol
        
        try:
            
            data = line.split(';')
            print(data)
            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

"""
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
"""
import Instruments

etf_objects = []

class NotebookProject(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2018, 4, 18)  # Set Start Date
        self.SetEndDate(2019, 3, 20)
        self.SetCash(1000000)  # Set Strategy Cash
        #self.AddEquity("SPY", Resolution.Minute)
        
        for etf in Instruments.universum:
            
            new_etf = self.AddData(Instruments.InvestingImport, etf, Resolution.Daily).Symbol
            etf_objects.append(new_etf)
            print(str.format("{0} data was added.", etf))

    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 Instruments.universum:
                self.SetHoldings(etf, 0.1)