Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ClassicRenkoConsolidator Does Not Update with Trade Tick for Futures #8639

Open
4 tasks done
AlexCatarino opened this issue Mar 20, 2025 · 0 comments
Open
4 tasks done
Assignees
Labels

Comments

@AlexCatarino
Copy link
Member

AlexCatarino commented Mar 20, 2025

Expected Behavior

We can consolidate Classic Renko with Futures' tick data using SubscriptionManager.AddConsolidator.

Actual Behavior

All ticks are quotes

Potential Solution

Review consolidation logic

Reproducing the Problem

class ClassicRenkoBarConsolidatorAlgorithm(QCAlgorithm):
    _consolidators = {}
    _bucket_size = 100_000.0
        
    def initialize(self) -> None:
        self.set_start_date(2025, 3, 1)
        self.set_end_date(2025, 3, 5)
        
        self._es = self.add_future("ES", Resolution.Tick)
        self._es.set_filter(0,180)

    def on_consolidated(self, sender: object, bar: TradeBar) -> None:
        self.log(str(bar))

    def on_data(self, slice):
        if self._es.mapped not in self._consolidators:
            def selector(data):
                value = data.quantity * data.price
                return value
            consolidator =  ClassicRenkoConsolidator(self._bucket_size, selector=selector)
            consolidator.data_consolidated += self.on_consolidated
            self.subscription_manager.add_consolidator(self._es.mapped, consolidator, TickType.TRADE)
            self._consolidators[self._es.mapped] = consolidator

        #ticks = slice.ticks.get(self._es.mapped, [])
        #for tick in ticks:
        #    self._consolidators[self._es.mapped].update(tick)

data.quantity is always zero when we use

self.subscription_manager.add_consolidator(self._es.mapped, consolidator, TickType.TRADE)

and we get non-zero values when we update it manually.

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants