Fail fast at add time naming valid markets, add subscription-free market hours lookup - #9680
Draft
jhonabreul wants to merge 1 commit into
Draft
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adding a security with an unknown ticker/market combination fails without hinting at what would have worked:
Also, reading exchange hours via
Securities["SPY"].Exchange.Hoursrequired a subscription.Changes:
SymbolPropertiesDatabase.GetMarketsForSymbol(ticker, securityType)helper.SecurityService.CreateSecuritycrypto validation errors now list the markets that have the ticker. Same for the crypto futures/forex base-currency failure.MarketHoursDatabase.GetEntryfailures list markets with the ticker, falling back to markets with entries for the security type.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.LocalZipMapFileProvidererror now states where map file zips were expected.UnsupportedAccountTypemessages 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?
MarketHourslookup (symbol properties, market hours database, security service, algorithm, and brokerage model tests).AddTimeValidationAndMarketHoursRegressionAlgorithm(C# and Python); both pass.Common.Securities,Common.Brokerages,Common.Data.AuxiliaryandAlgorithm.*suites with CI filters: 18153 passed, 0 failed.Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>