Refactors Custom Models for python
Moves custom model setters from QCAlgorithm class to Security class. Modifies algorithm examples to reflect the change.
This commit is contained in:
@@ -508,67 +508,7 @@ namespace QuantConnect.Algorithm
|
||||
|
||||
return _converter.GetDataFrame(History(symbols, start, end, resolution));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the fee model for securities
|
||||
/// </summary>
|
||||
/// <param name="model">Model that represents a fee model</param>
|
||||
/// <param name="security">Security that will use the fee model, if null, sets the model to all securities</param>
|
||||
public void SetFeeModel(PyObject model, Security security = null)
|
||||
{
|
||||
if (security != null)
|
||||
{
|
||||
security.FeeModel = new FeeModelPythonWrapper(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var sec in Securities.Values)
|
||||
{
|
||||
sec.FeeModel = new FeeModelPythonWrapper(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the fill model for securities
|
||||
/// </summary>
|
||||
/// <param name="model">Model that represents a fill model</param>
|
||||
/// <param name="security">Security that will use the fill model, if null, sets the model to all securities</param>
|
||||
public void SetFillModel(PyObject model, Security security = null)
|
||||
{
|
||||
if (security != null)
|
||||
{
|
||||
security.FillModel = new FillModelPythonWrapper(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var sec in Securities.Values)
|
||||
{
|
||||
sec.FillModel = new FillModelPythonWrapper(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the slippage model for securities
|
||||
/// </summary>
|
||||
/// <param name="model">Model that represents a slippage model</param>
|
||||
/// <param name="security">Security that will use the slippage model, if null, sets the model to all securities</param>
|
||||
public void SetSlippageModel(PyObject model, Security security = null)
|
||||
{
|
||||
if (security != null)
|
||||
{
|
||||
security.SlippageModel = new SlippageModelPythonWrapper(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var sec in Securities.Values)
|
||||
{
|
||||
sec.SlippageModel = new SlippageModelPythonWrapper(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the symbols/string from a PyObject
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user