Hello!

I am using custom data in my backtest. I code in Python. I am using minute resolution. My data is in CSV files, one file per day, one line per minute. Each line looks like this:

Time,Open,High,Low,Close,Volume

093100,100.00000,101.00000,99.00000,100.00000,12000

So the time is HHMMSS, timezone is New York, and it is the closing time for the bar. So the example above is for the bar from 9h30 to 9h31.

I have used the Weather example in the docs and I have looked at the LEAN C# code (a whole lot 😊). So I use AddData with a custom class that inherits from PythonData and defines GetSource and Reader. The data loads fine, I can see the engine reporting missing files (some days are missing in my data within my algo start and end times) and if I add a print() in my Reader method, I can also see a whole lot of prints in the console (each minute bar that gets loaded).

The problem is that my algo's OnData method's slice param never includes data for my custom ticker (associated to my custom data). This code is always false:

data.ContainsKey(self.custom_symbol) and data[self.custom_symbol] is not None

When I debug, I can see that the slice only contains 1 item, which is an Equity my algo also subscribe to (I do AddEquity for some other ticker). So what is false is actually the first condition (ContainsKey). It appears that LEAN reads my data fine but then it does not serve it to my algo.

Here is what I tried so far:

1- I tried to set the TimeZone of the algo to America/New York thinking that maybe the local engine I am using is UTC by default (from the logs I could see it was New York but tried anyway). No luck.

2- I tried in my custum data class to use:

a) 9h31 as the Time for the returned object by Reader.

b) use 9h30 (so report the start time of the bar instead of the end time).

c) use 9:30:30, so substract 30 seconds (using “- timedelta(seconds=30)”) from the end time to tell LEAN that the data is within the 9h30-9h31 minute.

All with no luck.

Does anyone have a clue why the engine does not feed my custom data to my algo OnData?

Thanks!

Fred