Wraps Slice Object with PythonSlice for Python Framework Algorithms

Wraps `Slice` object with `PythonSlice` for Python framework algorithms when alternative/custom data is present.
This commit is contained in:
AlexCatarino
2019-10-16 20:13:50 +01:00
parent 86cf6b52ca
commit 24d0ba392d
@@ -558,7 +558,20 @@ namespace QuantConnect.AlgorithmFactory.Python.Wrappers
/// Used to send data updates to algorithm framework models
/// </summary>
/// <param name="slice">The current data slice</param>
public void OnFrameworkData(Slice slice) => _baseAlgorithm.OnFrameworkData(slice);
public void OnFrameworkData(Slice slice)
{
if (SubscriptionManager.HasCustomData)
{
using (Py.GIL())
{
_algorithm.OnFrameworkData(new PythonSlice(slice));
}
}
else
{
_baseAlgorithm.OnFrameworkData(slice);
}
}
/// <summary>
/// Call this event at the end of the algorithm running.