Explore whether to add an overload for methods that take a Python float, but with numpy.float64.
Current numpy version used is 1.26.4, where float64 does not implement float. On latest version, float64 inherits float so this is not an issue.
Another potential solution is incrementing numpy version in Lean foundation.
See SetHoldingsRegressionAlgorithm: self.set_holdings("SPY", np.float64(0.30)):
MyPy output:
SetHoldingsRegressionAlgorithm.py_fc6y_lsj:39: error: No overload variant of "set_holdings" of "QCAlgorithm" matches argument types "str", "floating[_64Bit]" [call-overload]
SetHoldingsRegressionAlgorithm.py_fc6y_lsj:39: note: Possible overload variants:
SetHoldingsRegressionAlgorithm.py_fc6y_lsj:39: note: def set_holdings(self, targets: list[PortfolioTarget], liquidate_existing_holdings: bool = ..., tag: str = ..., order_properties: IOrderProperties = ...) -> list[OrderTicket]
SetHoldingsRegressionAlgorithm.py_fc6y_lsj:39: note: def set_holdings(self, symbol: Symbol | str | BaseContract, percentage: float, liquidate_existing_holdings: bool = ..., tag: str = ..., order_properties: IOrderProperties = ...) -> list[OrderTicket]
SetHoldingsRegressionAlgorithm.py_fc6y_lsj:39: note: def set_holdings(self, symbol: Symbol | str | BaseContract, percentage: int, liquidate_existing_holdings: bool = ..., tag: str = ..., order_properties: IOrderProperties = ...) -> list[OrderTicket]
Explore whether to add an overload for methods that take a Python
float, but withnumpy.float64.Current numpy version used is 1.26.4, where
float64does not implementfloat. On latest version,float64inheritsfloatso this is not an issue.Another potential solution is incrementing numpy version in Lean foundation.
See
SetHoldingsRegressionAlgorithm:self.set_holdings("SPY", np.float64(0.30)):MyPy output: