Closed WillSivolella closed 1 year ago
GPT Explanation:
The error message indicates that the datetime
module does not have an attribute today. This is likely because the datetime
module indeed does not have a today function at the top level; instead, the today function is a class method of the date class within the datetime
module.
To fix this issue, you should make sure that you are importing the date class from the datetime
module correctly at the beginning of your script. The correct way to access the today
method is through the date class like so: datetime.date.today()
.
Here's how the revised import statement should look:
from datetime import datetime, timedelta
When you want to call the today method, use:
end_date = datetime.date.today().strftime('%Y-%m-%d');
Function cannot return 'weekly' data. It can only return daily data over specified interval.
Example: quotes.get_historical_quotes('CF', interval = 'weekly')
Error message: ValueError Traceback (most recent call last) Cell In[20], line 1 ----> 1 quotes.get_historical_quotes('CF', interval = 'weekly')
File ~\OneDrive\Documents\Tradier\tradier\tradier.py:357, in Quotes.get_historical_quotes(self, symbol, interval, start_date, end_date) 344 start_date = last_monday(tmp).strftime('%Y-%m-%d'); 346 r = requests.get( 347 url = '{}/{}'.format(self.SANDBOX_URL, self.QUOTES_HISTORICAL_ENDPOINT), 348 params = { (...) 354 headers = self.REQUESTS_HEADERS 355 ); --> 357 return pd.DataFrame(r.json()['history']['day'])