question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`financials_v2` returns error `AttributeError: 'REST' object has no attribute 'financials_v2'`

See original GitHub issue

Hello!

Running a simple example to get AAPL financials returns an error.

Expected Result: Financial Data for AAPL

Actual Result: AttributeError: 'REST' object has no attribute 'financials_v2'

Sample Code:

import alpaca_trade_api as tradeapi

api = tradeapi.REST(API_KEY, SECRET_KEY, base_url=BASE_URL)
print(api.polygon.financials_v2(symbol='AAPL', limit=5, report_type='Y'))

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ItsJamesMurraycommented, Feb 2, 2021

That worked! Thanks!

Only thing I’d note is the documentation here is a bit lacking for this call.

I had to import from alpaca_trade_api.polygon.rest import FinancialsReportType, FinancialsSort and rather than using a string input for the report_type and sort as expected, I had ot use FinancialReportType and FinancialsSort.

import alpaca_trade_api as tradeapi
from alpaca_trade_api.polygon.rest import FinancialsReportType, FinancialsSort

api = tradeapi.REST(API_KEY, SECRET_KEY, base_url=BASE_URL)

print(api.polygon.financials_v2('AAPL', 5, FinancialsReportType.Y, FinancialsSort.ReportPeriodDesc))
0reactions
drew887commented, Apr 29, 2022

Hey closing this one out due to inactivity

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'REST' object has no attribute 'get_bars' (Alpaca ...
I am on Windows 10 running things from a basic cmd prompt run as administrator. While my primary objective is to get through...
Read more >
AttributeError: 'REST' object has no attribute 'historic_agg' #19
AttributeError : 'REST' object has no attribute 'historic_agg' #19 ... See the discussion here to help out with this.
Read more >
REST object has no attribute 'polygon - App-Integration
Hi, my first post here. Is api.polygon.historic_agg_v2 working? Here is the full code liine: minute_bars ...
Read more >
Python AttributeError: 'tuple' object has no attribute
AttributeError : 'tuple' object has no attribute. Learn Data Science with. This error occurs when attempting to access the values of a tuple...
Read more >
AttributeError: 'function' object has no attribute - Microsoft Learn
Using protected keywords from the DataFrame API as column names results in a function object has no attribute error message.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found