My custom data is in a csv file, the data itself is in form of OHLCV with 1M timeframe. 

Suppose I want to use TradeBar consolidator to produce 4H TradeBars, as the doc/community suggests, I need to somehow convert my custom data type to TradeBar type before feeding it to the TradeBar consolidator

According to the doc the custom data class inherits from PythonData class, in order to make it TradeBar compatible, should I modify it to inherit from TradeBar class like:

class MyCustomDataType(TradeBar):

def GetSource(self, config, date, isLiveMode):
source = "<directory>" + config.Symbol + ".csv"
return SubscriptionDataSource(

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

idx = MyCustomDataType()
idx.Symbol = config.Symbol
idx.DataType = MarketDataType.TradeBar

data = line.split(',')
currency.Time = datetime.strptime(data[0], "%Y-%m-%d")
currency.Value = decimal.Decimal(data[4])
currency.Open = float(data[1])
currency.High = float(data[2])
currency.Low = float(data[3])
currency.Close = float(data[4])
currency.Volume = float(data[5])

except ValueError:
return None

return idx

Any example in Python would be much appreciated!