Skip to content

Fail fast at add time naming valid markets, add subscription-free market hours lookup - #9680

Draft
jhonabreul wants to merge 1 commit into
QuantConnect:masterfrom
jhonabreul:feature-fail-fast-add-time-validation
Draft

Fail fast at add time naming valid markets, add subscription-free market hours lookup#9680
jhonabreul wants to merge 1 commit into
QuantConnect:masterfrom
jhonabreul:feature-fail-fast-add-time-validation

Conversation

@jhonabreul

@jhonabreul jhonabreul commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Description

Adding a security with an unknown ticker/market combination fails without hinting at what would have worked:

Crypto 'BNBUSD' symbol could not be found in the database for coinbase market

Also, reading exchange hours via Securities["SPY"].Exchange.Hours required a subscription.

Changes:

  • New SymbolPropertiesDatabase.GetMarketsForSymbol(ticker, securityType) helper.
  • SecurityService.CreateSecurity crypto validation errors now list the markets that have the ticker. Same for the crypto futures/forex base-currency failure.
  • MarketHoursDatabase.GetEntry failures list markets with the ticker, falling back to markets with entries for the security type.
  • New QCAlgorithm.MarketHours(Symbol) / MarketHours(string): exchange hours lookup without a subscription. The ticker overload resolves through the symbol cache, defaulting to equity in the default market.
  • LocalZipMapFileProvider error now states where map file zips were expected.
  • Coinbase and Binance.US UnsupportedAccountType messages now name the supported configuration.

Related Issue

N/A

Motivation and Context

Algorithms commonly hit these lookups with a wrong market and get a dead-end error. Naming the valid markets makes the first failure self-correcting.

Requires Documentation Change

The new QCAlgorithm.MarketHours() API could be documented.

How Has This Been Tested?

  • New unit tests covering the market-listing messages and the subscription-free MarketHours lookup (symbol properties, market hours database, security service, algorithm, and brokerage model tests).
  • New regression algorithm AddTimeValidationAndMarketHoursRegressionAlgorithm (C# and Python); both pass.
  • Full Common.Securities, Common.Brokerages, Common.Data.Auxiliary and Algorithm.* suites with CI filters: 18153 passed, 0 failed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

…market hours lookup

Unknown ticker/market combinations in Add* now throw naming the markets
that do have the requested ticker, sourced from the symbol properties
database, instead of only surfacing the missing database key. Adds
QCAlgorithm.MarketHours(symbol/ticker) to query exchange hours without a
subscription, improves the LocalZipMapFileProvider missing-data error,
and names the supported account type in the Coinbase/Binance.US margin
rejection messages.
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.

1 participant