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

get_instruments() inserts commas for non-list symbol parameter #53

Closed
kartiksubbarao opened this issue May 10, 2024 · 1 comment · Fixed by #143
Closed

get_instruments() inserts commas for non-list symbol parameter #53

kartiksubbarao opened this issue May 10, 2024 · 1 comment · Fixed by #143
Labels
enhancement New feature or request

Comments

@kartiksubbarao
Copy link

Description of Bug
get_instruments unconditionally calls ','.join(symbols) even if symbols is not a list. This breaks the functionality and e.g. prevents symbol-regex queries from working:

'symbol': ','.join(symbols),

Code to Reproduce
api.get_instruments('[A-M][^ ]*', api.Instrument.Projection.SYMBOL_REGEX)

Expected Behavior
All non-option symbols starting with A through M

Actual Behavior
No results

A simple fix is to change this line to:
'symbol': ','.join(symbols) if isinstance(symbols, list) else symbols,

kartiksubbarao added a commit to kartiksubbarao/schwab-py that referenced this issue May 10, 2024
Only join symbols if passed as a list, fixes alexgolec#53
@kartiksubbarao
Copy link
Author

@alexgolec I didn't quite understand your response to the pull request, can you please elaborate? I was trying to provide something that supported the intent of your existing code (convert an array of symbols into a comma-separated string), while enabling the symbols parameter to be passed as-is for calls like symbol-regex.

@alexgolec alexgolec added the enhancement New feature or request label May 17, 2024
@alexgolec alexgolec linked a pull request Jun 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants