Skip to content

Missing numpy floats overloads #78

@jhonabreul

Description

@jhonabreul

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions