Lean icon indicating copy to clipboard operation
Lean copied to clipboard

FilteredIdentity doesn't accept Python lambda.

Open DerekMelchin opened this issue 7 months ago • 0 comments

Expected Behavior

This algorithm runs without error

class FilteredIdentityAlgorithm(QCAlgorithm):
    
    def initialize(self) -> None:
        self._symbol = self.add_equity("SPY", Resolution.DAILY).symbol
        self._filtered_identity = FilteredIdentity("SPY", filter = lambda x: x.Close > x.Open)

Actual Behavior

at initialize
    self._filtered_identity = FilteredIdentity("SPY", filter = lambda x: x.Close > x.Open)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 in main.py: line 9
 No method matches given arguments for .ctor: (<class 'str'>)

Potential Solution

N/A

Reproducing the Problem

Run algorithm above

System Information

QC Cloud

Checklist

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues
  • [x] I have provided detailed steps to reproduce the issue

DerekMelchin avatar May 22 '25 20:05 DerekMelchin