Hi folks,

I'm currently trying to use an external csv file saved within DropBox, to trigger intraday trading. I've cut the dataset down, as well as the code, to try to identify the issues why the code is not triggering any trading activity.

The csv file contains two rows [cut down] and no headers. Col 1 = datetime to mark the minute-level stamp that attached to the trigger [set to =1] in Col2. Example = “10/0½019 ,  14:45:00” Where the comma separates the data.

I wish to use this timestamp in strftime format to trigger an intraday trade within the routine. Project attachedbut code reproduced below in case tat doesnt show. Since the csv file does contain the datestamp example above, I would expect the routine to create a link within OnData [since I have also subscribed to minutely bars]. But no such link is made and the OnData does nothing. Any ideas why this is not making the trade?

 

#region imports
from AlgorithmImports import *
#endregion
class MyAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 1, 9)
        self.SetEndDate(2019, 1, 11)
        self.SetCash(100000)
        
        self.snap = self.AddEquity("SNAP", Resolution.Minute).Symbol
        self.trade = self.AddData(TradeSignal, "trade_signal", Resolution.Minute).Symbol
        
        # self.Schedule.On(self.DateRules.EveryDay(self.snap),
        #          self.TimeRules.BeforeMarketClose(self.snap, 15),      
        #          self.ExitPositions)

    def OnData(self, data):
        if self.trade in data:
                self.SetHoldings(self.snap, 1)

    # def ExitPositions(self):
    #     self.Liquidate()


class TradeSignal(PythonData):

    def GetSource(self, config, date, isLive):
        source = "https://www.dropbox.com/s/biu232j0ep33n9g/TickerUniverse.csv?dl=1"
        return SubscriptionDataSource(source, SubscriptionTransportMedium.RemoteFile);

    def Reader(self, config, line, date, isLive):    
        data = line.split(',')
        signal = TradeSignal()
        
        try:
            signal.Symbol = config.Symbol
            signal.Time = datetime.strptime(data[0], "%d/%m/%Y  %H:%M:%S")
            signal.Trade = data[1]
            
            
        except ValueError:
            return None
        
        return signal