Hi,

I created an account a couple days ago, went through the BootCamp, the documentation, and looked a bit in the source code (I am not familiar in C# however). I really like the fact that LEAN is open-source; I am planning on using the managed version for now since I'm a beginner, but I still want to know now if I can make it run locally (and test on a custom data source). Two of my goals were: add some custom data source that is pulled from an exchange API and add a brokerage class for Alpaca. I have some questions related to that which I wasn't able to find clear answers for in the docs:

  1. If I understand correctly, the engine (both in Live and Backtesting) has several data subscriptions. As the time frontier progresses, the different data subscriptions return data objects (ticks or timebars) that are sent to the onData functions of the algorithm. If needed, I could add consolidators to group the tick data into higher resolution bars. Am I describing correctly how the engine works? Does that mean that for live trading we don't necessarily need tick data? i.e. our live trading source could directly send us bars? (or does it send us ticks that I would need to consolidate myself)
  2. If I want to use python code to add custom data to my algorithm, i have to put the python code directly in the algorithm file, like this? I wanted to use the ccxt library to get data from multiple exchanges, but I cannot split the python code into multiple files? If I wanted to do it properly in C#, i would have to create new BaseData classes like this?
  3. Could someone give me pointers as to where to look to undertstand how the data handling works? To add a custom data source, the docs just mention adding `AddData` and `CustomData : BaseData`, but is there some docs explaining how the broader logic of DataSources/DataFeeds/DataSubscriptions work?
  4. It says here that with Resolution.Tick, the custom data source will be polled constantly. Does that mean that the connection has to be open via a websocket? Or can it be anything, even a file, and LEAN deals with converting it into a stream. What about for live trading? I notice that the Tiingo example is for daily calls to the api, but how does it work for live trading and constant polling?
  5. The docs mention 'quote ticks', are those top of the book quotes, or can they be L2 quotes as well? (or would i have to write a custom class that overrides BaseData)
  6. I wanted to contribute by adding an implementation of a Brokerage class for Alpaca, but I was a bit discouraged after seeing how complicated the InteractiveBrokers implementation looked. Also the IB Brokerage class seems to include methods to get live and historical data. Is that because during live trading LEAN switches to using the broker's data as a data source? Is it a requirement to have those?

    Thanks in advance for the help, I hope this thread can help others as well