Fix 'GetParameter()' ambiguous call error when no default parameter is provided (#6541)
Regression Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled

* Fix QCAlgorithm.GetParameter() ambiguous call error when no default parameter is provided

* Add unit tests

* Add regression algorithms
This commit is contained in:
Jhonathan Abreu
2022-08-11 17:45:00 -04:00
committed by GitHub
parent aa8a3a241b
commit 2dd3a0cb94
6 changed files with 389 additions and 20 deletions
@@ -518,30 +518,30 @@ namespace QuantConnect.AlgorithmFactory.Python.Wrappers
/// <summary>
/// Gets the parameter with the specified name parsed as an integer. If a parameter with the specified name does not exist,
/// or the conversion is not possible, the given default value is returned if any, else null
/// or the conversion is not possible, the given default value is returned
/// </summary>
/// <param name="name">The name of the parameter to get</param>
/// <param name="defaultValue">The default value to return</param>
/// <returns>The value of the specified parameter, or defaultValue if not found or null if there's no default value</returns>
public int? GetParameter(string name, int? defaultValue = null) => _baseAlgorithm.GetParameter(name, defaultValue);
public int GetParameter(string name, int defaultValue) => _baseAlgorithm.GetParameter(name, defaultValue);
/// <summary>
/// Gets the parameter with the specified name parsed as a double. If a parameter with the specified name does not exist,
/// or the conversion is not possible, the given default value is returned if any, else null
/// or the conversion is not possible, the given default value is returned
/// </summary>
/// <param name="name">The name of the parameter to get</param>
/// <param name="defaultValue">The default value to return</param>
/// <returns>The value of the specified parameter, or defaultValue if not found or null if there's no default value</returns>
public double? GetParameter(string name, double? defaultValue = null) => _baseAlgorithm.GetParameter(name, defaultValue);
public double GetParameter(string name, double defaultValue) => _baseAlgorithm.GetParameter(name, defaultValue);
/// <summary>
/// Gets the parameter with the specified name parsed as a decimal. If a parameter with the specified name does not exist,
/// or the conversion is not possible, the given default value is returned if any, else null
/// or the conversion is not possible, the given default value is returned
/// </summary>
/// <param name="name">The name of the parameter to get</param>
/// <param name="defaultValue">The default value to return</param>
/// <returns>The value of the specified parameter, or defaultValue if not found or null if there's no default value</returns>
public decimal? GetParameter(string name, decimal? defaultValue = null) => _baseAlgorithm.GetParameter(name, defaultValue);
public decimal GetParameter(string name, decimal defaultValue) => _baseAlgorithm.GetParameter(name, defaultValue);
/// <summary>
/// Initialise the Algorithm and Prepare Required Data: