Forum Replies Created
-
AuthorPosts
-
Wednesday, September 18, 2019 at 12:23 AM in reply to: Why does XBRL return differing values for same concept and how to address it #151753Teji AbrahamParticipant
Many thanks David – is there per chance a reference document where I can find info for a particular fact.id and also perhaps explains the difference between two facts that outwardly seem to share most characteristics ?
Thanks again, TejiWednesday, September 18, 2019 at 4:55 PM in reply to: Why does XBRL return differing values for same concept and how to address it #151833David TaurielloKeymasterTeji – you can wildcard fact.* as the attribute of fields parameter to get all details for facts.
CAVEAT: use this with fact.limit() to get a sample return; it’s not recommended as a default because performance will be bad with a broad query.
For this CIK look for all of the latest 2017 Year facts appearing in a 10-K and show all the details for each fact, with a limit on the number of facts at 10.
Wednesday, September 18, 2019 at 5:40 PM in reply to: Why does XBRL return differing values for same concept and how to address it #151837Teji AbrahamParticipantSounds good, thanks again David
TejiKevin MonahanParticipantGreetings,
I have been a member previously utilizing the google sheets via token for the margin analysis template and it worked flawlessly. However, with the new setup, it seems that it does not call all the data. For example when searching AMZN in the MarginTimeSeries tab, (utilizing the overrides ticker) the data stops at 2018 2Q and for many other symbols such as OLLI, there is no data at all or very little.
I’m I missing something or additional step perhaps??
Saturday, September 21, 2019 at 3:19 PM in reply to: Google Sheet – margin time series not working #152025David TaurielloKeymasterHi Kevin – thanks for writing and for your good question. You might need to adjust the elements queried for the time series to work properly.
I’m confirming OLLI was empty until I entered RevenueFromContractWithCustomerExcludingAssessedTax in the override cell B21 of the time series tab. NOTE – you can use a comma-delimited set of elements in this override field.
Jason MelloneParticipantAssuming I know some report.id, I can retrieve stuff like
CommonStockSharesOutstanding
using something like:def fields_from_report_id(report_id, fields): return execute_query('fact/search?report.id=' + str( report_id) + '&fact.has-dimensions=false&concept.local-name=' + fields + '&fields=concept.local-name.sort(ASC),fact.value,fact.decimals,period.fiscal-year,period.fiscal-period')
execute_query
just executes the query using my credentials – you can assume this works.Now, assuming I want to retrieve Market Cap as a concept.local-name, is this possible?
Right now, I am calc’ing Market Cap using an external vendor for price, but would rather use the xbrl feed directly, if possible
Friday, October 18, 2019 at 4:50 PM in reply to: Retrieving Market Cap as a concept.local-name item from a report.id #153801David TaurielloKeymasterHi Jason – take a look at
EntityPublicFloat
– it might be helpful to you.Here’s a sample of Microsoft’s
fact.value
history for the concept:/report/fact/search?entity.id=6930&concept.local-name=EntityPublicFloat&fields=fact.value,report.document-type,report.period-end.sort(DESC),report.restated-index,dts.id
Here’s the definition of the concept across all US GAAP Taxonomies:
/concept/search?dts.id=257581,257584,257585,257586,257587,257588,257589, 257590,292503,322998&concept.local-name=EntityPublicFloat&fields= dts.id.sort(DESC),concept.namespace,concept.local-name,label.text
Wednesday, November 6, 2019 at 6:39 AM in reply to: Getting started with the XBRL Google Sheet and add-on #156160AnonymousInactiveGetting error in ALL and on the BSCompare tab. Sheet worked two days ago when testing. Repeated steps on a new machine, aPI install, and new copy of sheets and receive same message. Error
Request failed for https://api.xbrl.us returned code 401. Truncated server response: {“error”:”invalid_request”,”error_description”:”Bad or expired token”} (use muteHttpExceptions option to examine full response) (line 106).
Is there a problem with the server? A few students who attempted had the same problem.Wednesday, November 6, 2019 at 9:56 AM in reply to: Getting started with the XBRL Google Sheet and add-on #156181David TaurielloKeymasterHi James – it sounds like you may have an expired token in your browser that’s not being properly cleared and refreshed. Please open the URL to your copy of the XBRL API Spreadsheet in the browser’s incognito (Chrome) or private (Edge) mode. When you return to the ‘regular’ tab, the issue should be cleared – you might need to refresh the browser tab.
Let me know if this does not resolve the issue, and thanks for your institution’s interest in XBRL – send a note to info@xbrl.us if there’s anything we can do to help your work on this topic.
Sriram SrinivasanParticipantHello everyone,
I’m trying to access XBRL data from Python using the API. I’m new to Python and working with APIs so I’m going through some teething pains and would be glad to have some assistance.
As a first step, I had to get the access token, which I successfully managed to do in Python using the below code (all sensitive data is masked).
”
import requests
API_ENDPOINT = “https://api.xbrl.us/oauth2/token”data = {‘grant_type’:’password’,
‘client_id’:’xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’,
‘client_secret’:’xxxx-xxxx-xxxx-xxxx-xxxxx’,
‘username’:’xxxxxxxxxxxxxxx@xxx.com’,
‘password’: ‘xxxxxxxxxx’}# sending post request and saving response as response object
r = requests.post(url = API_ENDPOINT, data = data)# extracting response text
pastebin_url = r.text
print(pastebin_url)”
This gave me output including an access token and a refresh token. I’m now trying to use the access token to pull data.
This is the code I have been working with:
“import requests
# api-endpoint
URL = “https://api.xbrl.us/api/v1/fact/search?concept.local-name=Assets&period.fiscalyear=2017&period.fiscal.period=1Q&Entity.cik=0000001&fields=fact.value”PARAMS = {‘Host’:’api.xbrl.us’,
‘Authorization’: ‘Bearer<xxxxxxx-xxxxx-xxx-xxx-xxxxx>’}# sending get request and saving the response as response object
r = requests.get(url = URL, params = PARAMS)# extracting data in json format
data = r.json()
print(data)”
This returns the error: ‘Bad or expired token’. I have tried getting a fresh access token and running the code again but I’m still getting the same error.
Is there anything wrong with my code? Will be grateful for any guidance. Thanks in advance for your help.
Marc WardKeymasterHi Sriram,
You’re almost there! The token needs to submitted in the header of the request. You don’t need to submit any parameters since they’re in the url.
Add this to your code:
headerarray = {'Authorization' : 'Bearer xxxxxxx-xxxxx-xxx-xxx-xxxxx'}
Then change your request line to:
r = requests.get(url, headers=headerarray)
You should receive the results of the query now.
Sriram SrinivasanParticipantThanks a lot Mark! This worked.
Nathan SudermanParticipantI have been working in python to load all company XBRL filings into a SQL server. Now that I have the data available, I too am running into standardization issues with the tags(concepts). I don’t want to reinvent the wheel if there is already a mapping table that has been created.
Has anyone already standardized/mapped the key tags?
Tim BuiParticipantHi Nathan, I too was able to upload the Financial Data Set into SQL Server, but even after spending a tremendous amount of time trying to standardize the tags, I have failed to come up with a workable solution. There are just way too many inconsistencies and variations in the way companies naming their tags. They name the tags to best describe their particular financial items at that moment in time and change the tag if their situations change. It is difficult to find consistency for the same company over time. It becomes more difficult when comparing tags of companies within the same economic sector or across sectors.
Being an investor, I try to standardize the tags to get the granularity for financial analysis. Not sure what is your goal for standardization, but if you wanted, we can collaborate and share ideas on this issue. Tim
Wednesday, January 8, 2020 at 9:15 AM in reply to: Retrieving Market Cap as a concept.local-name item from a report.id #162538Jason MelloneParticipantDavid,
I am experimenting with this a bit.
Using
CIK='0000789019'
as an example anddts.id=346047
, I get the following URL: https://www.sec.gov/Archives/edgar/data/789019/000156459019037549/0001564590-19-037549-index.htmWhich xml file should I look in to find the various fields that I should try to pull via your API?
For MSFT it is easy, but what about a company that reports less robustly:
https://www.sec.gov/Archives/edgar/data/1117171/000121390019024078/0001213900-19-024078-index.htmThank you for any input.
- This reply was modified 4 years, 6 months ago by Jason Mellone.
-
AuthorPosts