QuantBook Universe Selection (#7587)
* QuantBook Universe Selection - QuantBook universe selection helper method. Adding new unit tests. - Universe selection data sets improvements * QuantBook API renames
This commit is contained in:
@@ -1466,7 +1466,7 @@ namespace QuantConnect.Algorithm
|
||||
return pythonIndicator;
|
||||
}
|
||||
|
||||
private PyObject GetDataFrame(IEnumerable<Slice> data, Type dataType = null)
|
||||
protected PyObject GetDataFrame(IEnumerable<Slice> data, Type dataType = null)
|
||||
{
|
||||
var memoizingEnumerable = data as MemoizingEnumerable<Slice>;
|
||||
if (memoizingEnumerable != null)
|
||||
@@ -1475,7 +1475,20 @@ namespace QuantConnect.Algorithm
|
||||
// the user will only have access to the final pandas data frame object
|
||||
memoizingEnumerable.Enabled = false;
|
||||
}
|
||||
return PandasConverter.GetDataFrame(data, dataType);
|
||||
var history = PandasConverter.GetDataFrame(data, dataType);
|
||||
if(dataType != null && dataType.IsAssignableTo(typeof(BaseDataCollection)))
|
||||
{
|
||||
// clear out the first symbol level since it doesn't make sense, it's the universe generic symbol
|
||||
dynamic dynamic = history;
|
||||
using (Py.GIL())
|
||||
{
|
||||
if (!dynamic.empty)
|
||||
{
|
||||
dynamic.index = dynamic.index.droplevel("symbol");
|
||||
}
|
||||
}
|
||||
}
|
||||
return history;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user