Skip to content

Conversation

@Murph24
Copy link

@Murph24 Murph24 commented Jan 30, 2026

Pull Request

NautilusTrader prioritizes correctness and reliability, please follow existing patterns for validation and testing.

  • I have reviewed the CONTRIBUTING.md and followed the established practices

Summary

To subscribe to tick updates for index instruments such as SPX.CBOE, we need to call eclient.reqMktData. For an index we want the last price (tickType 4) and not the typical bid\ask tick types. Implementing the subscribe_index_prices functionality allows for a way to differentiate between typical bid\ask ticks and index price ticks in process_tick_price() of market_data.py

Related Issues/PRs

Addresses #3413

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Improvement (non-breaking)
  • Breaking change (impacts existing behavior)
  • Documentation update
  • Maintenance / chore

Breaking change details (if applicable)

None

Documentation

  • Documentation changes follow the style guide (docs/developer_guide/docs.md)

Release notes

  • I added a concise entry to RELEASES.md that follows the existing conventions (when applicable)

Testing

Possible this needs new test coverage?

  • Affected code paths are already covered by the test suite
  • I added/updated tests to cover new or changed logic

@CLAassistant
Copy link

CLAassistant commented Jan 30, 2026

CLA assistant check
All committers have signed the CLA.

@faysou
Copy link
Collaborator

faysou commented Jan 30, 2026

If only one value is produced would TradeTick be more appropriate?

Copy link
Member

@cjdsellers cjdsellers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Murph24

Thanks for the contribution!

Ideally we need some test coverage on this. In the past this was follow up work maintainers could take on, however with the recent increase in PRs, we have to insist on complete test coverage for new functionality.

One additional comment:

 Tick data not cleared after creating update:

  Compare to _try_create_quote_tick_from_market_data:
  # Quote tick clears after use:
  self._subscription_tick_data[req_id].clear()

  But _try_create_index_price_tick_from_market_data doesn't clear. This means every process_tick_price callback will emit an IndexPriceUpdate even if
  the price hasn't changed (the old value stays in tick_data[4]).


if price is not None:
instrument_id = InstrumentId.from_str(subscription.name[0])
instrument = self._cache.instrument(instrument_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check for None here, log an error and return (common pattern in other adapters). This is clearer than an attribute error on a NoneType later.

@Murph24
Copy link
Author

Murph24 commented Jan 31, 2026

If only one value is produced would TradeTick be more appropriate?

@faysou Can you clarify? Are you saying why not just subscribe to the index with: self.subscribe_trade_ticks(instrument_id=InstrumentId.from_str("^SPX.CBOE")) ?

This does not work with the adapter as-is

-or-

are you suggesting to implement the SubscribeIndexPrice, but have it emit a TradeTick? That wouldn't seem correct to me, but you guys know this adapter much better than I do.

@Murph24
Copy link
Author

Murph24 commented Jan 31, 2026

Hi @Murph24

Thanks for the contribution!

Ideally we need some test coverage on this. In the past this was follow up work maintainers could take on, however with the recent increase in PRs, we have to insist on complete test coverage for new functionality.

One additional comment:

 Tick data not cleared after creating update:

  Compare to _try_create_quote_tick_from_market_data:
  # Quote tick clears after use:
  self._subscription_tick_data[req_id].clear()

  But _try_create_index_price_tick_from_market_data doesn't clear. This means every process_tick_price callback will emit an IndexPriceUpdate even if
  the price hasn't changed (the old value stays in tick_data[4]).

Thanks for taking a look! Yes this would make sense, however I don't see this anywhere else in the adapter?

Compare to _try_create_quote_tick_from_market_data:
Quote tick clears after use:
self._subscription_tick_data[req_id].clear()

@faysou
Copy link
Collaborator

faysou commented Jan 31, 2026

I don't know things much better than you, I'm just a contributor like you. I'm just saying that a quote is associated to a bid ask and last prices to trade ticks so it would be better to subscribe to trade ticks in this case and then there would maybe be nothing to change.

Can you test if subscribing to trade ticks for the index works ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants