-
Notifications
You must be signed in to change notification settings - Fork 269
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When I run the code sample under Querying News Data
from the PyPi docs page, it fails because no api_key
or secret_key
is supplied, despite the comment reading # no keys required for news data
:
from alpaca.data.historical.news import NewsClient
from alpaca.data.requests import NewsRequest
from datetime import datetime
# no keys required for news data
client = NewsClient()
request_params = NewsRequest(
symbols="TSLA",
start=datetime.strptime("2022-07-01", '%Y-%m-%d')
)
news = client.get_news(request_params)
# convert to dataframe
news.df
results in the following stack trace:
File "/path/to/src.py", line 6, in <module>
client = NewsClient()
File "/path/to/venv/lib/python3.13/site-packages/alpaca/data/historical/news.py", line 38, in __init__
super().__init__(
~~~~~~~~~~~~~~~~^
api_key=api_key,
^^^^^^^^^^^^^^^^
...<6 lines>...
raw_data=raw_data,
^^^^^^^^^^^^^^^^^^
)
^
File "/path/to/venv/lib/python3.13/site-packages/alpaca/common/rest.py", line 61, in __init__
self._api_key, self._secret_key, self._oauth_token = self._validate_credentials(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
api_key=api_key, secret_key=secret_key, oauth_token=oauth_token
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/path/to/venv/lib/python3.13/site-packages/alpaca/common/rest.py", line 354, in _validate_credentials
raise ValueError("You must supply a method of authentication")
ValueError: You must supply a method of authentication
Expected Behavior
The code snippet should be a functional example
SDK Version I encountered this issue in
alpaca-py-0.40.1
Steps To Reproduce
`pip install alpaca-py`
copy and paste snippet from [pypi docs](https://pypi.org/project/alpaca-py/#data-api-example)
run the code
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?
Metadata
Metadata
Assignees
Labels
No labels