Hi there

I have install lean on my local pc and I can use it backtest well, and now I want to use it to paper trading.

I have make dir, named ‘hour_data’ in ‘/root/qc_lean/data/crypto/binance’(this dir was created when install LEAN); and in ‘hour_data’ dir, I have saved each coin's csv file(such as ‘adausdt.csv’, ‘btcusdt.csv’ and so on), and then each of these file would be updated once per hour for the latest bars data. The format of this each file is like this:

188056_1648014122.jpg

the time is bar's end time and utc time, then open price, high price, low price, close price, volume.

I use self.AddData to load these data, but I don't know how to code CustomData.Reader(), could you help me complete it?

from AlgorithmImports import *


class CustomDataLiveTrading(QCAlgorithm):

    def Initialize(self):
        self.SetTimeZone(TimeZones.NewYork)  #
        self.SetStartDate(2021, 3, 1)
        self.SetBrokerageModel(BrokerageName.Binance, AccountType.Margin)
        self.SetAccountCurrency("USDT")
        self.SetCash(100000)
        self.SetBenchmark(Symbol.Create("BTCUSDT", SecurityType.Crypto, Market.Binance))
        CustomData.Debug = self.Debug
        self.symbols = ['ETHUSDT', 'BTCUSDT']
        for symbol in self.symbols:
            properties = SymbolProperties("Bitcoin", "USDT", 1, 0.01, 0.01, symbol)
            exchangeHours = SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork)
            self.AddData(CustomData, symbol, properties, exchangeHours, Resolution.Hour)
            # self.Securities[symbol].SetFeeModel(CustomFeeModel())

    def OnData(self, data):
        self.MarketOrder('ETHUSDT', 0.1)


class CustomData(PythonData):
    def GetSource(self, config, date, is_live):
        source = os.path.join(Globals.DataFolder, f"/root/qc_lean/data/crypto/binance/hour_hm/{config.Symbol}.csv")
        return SubscriptionDataSource(source, SubscriptionTransportMedium.LocalFile)

    def Reader(self, config, line, date, isLiveMode):
        coin = CustomData()
        coin.Symbol = config.Symbol
        # how shall I code below?