Hi everyone,

My experience with research notebooks has been great, but I always get limited by speed at some point due to the python experience and the complexity of my alpha idea. Using a complex lamba function and "apply"ing it to a dataframe is straightforward enough to make, but has some drawdowns:

1) Slow. Because it will be done in python and not C
2) Non-transferable. Ok, it technically is transferable... if you plan to use the History API every cycle to generate an entire dataframe then apply it to that. But.... see 1)

So to kill two birds with one stone, I want to find a way to work on my alpha in C#, and then analyze the results in a notebook. Ideally I want to do all the work from within a notebook but that's not as simple as it sounds.


Right now, to achieve what I want, I can:

1) Build my Alpha in C#
2) Execute the backtest, saving the trading results to file
3) Open an analyze the results in a notebook for pretty printing.

This is a slow cycle really, but it will do for now.

What I would like to achieve is:
1) Build my alpha in a C# notebook and see the results instantly in a nice chart.
In a similar way to how zipline can be run really.

 

To get to this point, first I need notebooks to use C#, which is kinda here!
 

https://devblogs.microsoft.com/dotnet/net-core-with-juypter-notebooks-is-here-preview-1/

But this only works for dot net core 3.0
The other part of my problem is, I don't know how to execute a strategy and get back the results from a simple function call. Something like this
var Results = Lean.Run(MyAlpha)

Is what I'm looking to achieve. Where Results will contain a bunch of performance results along with actual trades/times etc.

Are there some tests that I could look at which would be close to what I want to achieve? I am pretty lost in all the code to be honest. The standard way to run an algorithm pulls config values from file, then runs the algo as a job in a separate thread. I want to avoid all of that and just execute my algo as cleanly as possible. From the test examples, there are many mock setups and I'm not sure what handlers etc are neccessary etc.

If anyone could give me a bit of direction here it would be much appreciated.

Thanks