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

[Bug]: NewsRequest classs param:symbols designed to take List[str] for symbols but can only take a single symbol as str #526

Open
2 tasks done
neili02 opened this issue Nov 12, 2024 · 2 comments

Comments

@neili02
Copy link

neili02 commented Nov 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Error when using NewsRequest with multiple symbols.

from alpaca.data.historical.news import NewsClient
from alpaca.data.requests import NewsRequest

NewsClient().getnews(request_params=NewsRequest(symbols=['AAPL','GOOGL'])

results in error.

Expected Behavior

No response

SDK Version I encountered this issue in

alpaca-py v0.31.0

Steps To Reproduce

ValidationError: 1 validation error for NewsRequest
symbols
  Input should be a valid string [type=string_type, input_value=['AAPL', 'GOOGL'], input_type=list]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type

Filled out the Steps to Reproduce section?

  • I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

Anything else?

No response

@hiohiohio
Copy link
Contributor

https://github.com/hiohiohio/alpaca-py/blob/791ce40d01914ad967ae14a2f11d66449af119d4/alpaca/data/requests.py#L389

symbols (Optional[str]): The comma-separated list of symbols to query news for.

@neili02 the parameter currently does not support list. Please convert to comma separated str.

NewsClient().getnews(request_params=NewsRequest(symbols=",".join(['AAPL','GOOGL']))

@neili02
Copy link
Author

neili02 commented Nov 12, 2024

Okay, thanks.

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

No branches or pull requests

2 participants