我需要从SEC 10-K文件中得到一些事实,如毛收入、毛利、毛利率、营运费用等,以及相应的上下文。
对于像https://www.sec.gov/Archives/edgar/data/1318605/000156459018002956/tsla-20171231.xml这样的文件,只使用XPath来找出少数必需的元素和值似乎是可行的。但也有一些文件(如(https://www.sec.gov/Archives/edgar/data/19617/000001961718000057/jpm-20171231.xml) )将总费用划分为不同的部分,并使用扩展分类法进行分类。
我的问题是
在任何情况下,如果简单地使用XPath是可能的话,我更愿意这样做。xbrl文档的有效性并不重要。
发布于 2018-11-22 09:50:52
使用XBRL文件的最可靠方法是使用XBRL处理库。Java中有一些是专有的(收费的),还有一些是开源的。
在xbrl.org上有一个维护好的工具和服务列表:
https://www.xbrl.org/the-standard/how/tools-and-services/
据我所知,SEC的文件是可靠的,被许多人广泛使用,并在许多处理器上进行了测试。如果UBMatrix有问题,比如空指针异常,我建议联系他们,让他们知道,这样他们就可以解决这个问题。
从理论上讲,使用XPath/XQuery/XSLT也是可能的,因为XBRL使用XML语法,但是您需要意识到,通过解析上下文(在关系术语中是一个连接),实际上您将从头开始重新实现一个不完整的XBRL处理器,同时也会带来but和沉没成本的风险。除了核心XBRL (例如,维度、.)之外,还有许多细节和规范的生态系统。为了不检索错误的值而考虑。通过使用现有处理器,您可以在其他人已经为此投入的努力的基础上建立起来,以便使所有的XBRL语义都正确:这是XBRL作为一个标准的好处。
最后要指出的是:用于毛收入、毛利等的确切XBRL标签可能因公司而异,因为有些公司使用自己的标签(扩展),而不是美国-GAAP标签。此外,一些公司忽略了一些需要消费者根据其他事实进行计算的事实。这可以使用XBRL处理器上的映射和公式来解决。Charles用许多有用的建议分享了关于这个问题的报告,并在网上维护了这样的映射(搜索的关键词是:基本会计概念,报告框架)。
发布于 2018-11-27 20:53:22
根据您对数据的期望,我建议您查看XBRL美国API。这提供了对所有SEC文件的API访问,并使数据可用于JSON。您可以为私人非商业研究与开发获得一个免费的API密钥。
我还要看一下阿瑞尔开源项目,它是一个用Python编写的XBRL处理器。特别是,它有一个插件,它将提供xBRL-JSON格式的数据,您可能会发现它比原始的XML文件更容易处理,并将处理Ghislain提到的这些文件的复杂性。
发布于 2018-12-26 18:07:15
有一个以JSON格式返回公司基本原理的专用API。您可以使用包getFundamentals(symbol) ( eodhistoricaldata-api,https://www.npmjs.com/package/eodhistoricaldata-api)提供的方法。
该方法返回季度和年度财务报表(资产负债表、现金流量、损益表),包括总收入、毛利、毛利率、营业费用等。
例如:
"Highlights": {
"MarketCapitalization": 54915055616,
"MarketCapitalizationMln": "54915.0556",
"EBITDA": 616286976,
"PERatio": null,
"PEGRatio": "-1.5700",
"WallStreetTargetPrice": "321.8900",
"BookValue": "26.2790",
"DividendShare": null,
"DividendYield": null,
"EarningsShare": "-4.8500",
"EPSEstimateCurrentYear": "-6.5600",
"EPSEstimateNextYear": "-2.0000",
"EPSEstimateNextQuarter": "-1.6700",
"MostRecentQuarter": "2018-09-30",
"ProfitMargin": "-0.1022",
"OperatingMarginTTM": "-0.0710",
"ReturnOnAssetsTTM": "-0.0271",
"ReturnOnEquityTTM": "-0.3397",
"RevenueTTM": "17523644416.00",
"RevenuePerShareTTM": "103.3240",
"QuarterlyRevenueGrowthYOY": "1.2860",
"GrossProfitTTM": "2222487000.00",
"DilutedEpsTTM": "-10.5600",
"QuarterlyEarningsGrowthYOY": null
},
// ...
"Income_Statement": {
"currency_symbol": "USD",
"quarterly": {
"2018-09-30": {
"date": "2018-09-30",
"filing_date": "2018-11-02",
"researchDevelopment": "350848000.00",
"effectOfAccountingCharges": null,
"incomeBeforeTax": "271320000.00",
"minorityInterest": "1344731000.00",
"netIncome": "311516000.00",
"sellingGeneralAdministrative": "729876000.00",
"grossProfit": "1523665000.00",
"ebit": "442941000.00",
"operatingIncome": "442941000.00",
"otherOperatingExpenses": null,
"interestExpense": "-169858000.00",
"extraordinaryItems": null,
"nonRecurring": null,
"otherItems": null,
"incomeTaxExpense": "16647000.00",
"totalRevenue": "6824413000.00",
"totalOperatingExpenses": "6381472000.00",
"costOfRevenue": "5300748000.00",
"totalOtherIncomeExpenseNet": "-171621000.00",
"discontinuedOperations": null,
"netIncomeFromContinuingOps": "254673000.00",
"netIncomeApplicableToCommonShares": "311516000.00"
},
// ...
"Balance_Sheet": {
"currency_symbol": "USD",
"quarterly": {
"2018-09-30": {
"date": "2018-09-30",
"filing_date": "2018-11-02",
"intangibleAssets": "291476000.00",
"totalLiab": "23409144000.00",
"totalStockholderEquity": "4508838000.00",
"deferredLongTermLiab": "0.00",
"otherCurrentLiab": "2266778000.00",
"totalAssets": "29262713000.00",
"commonStock": "171000.00",
"otherCurrentAssets": "158627000.00",
"retainedEarnings": "-5457315000.00",
"otherLiab": "2285172000.00",
"goodWill": "65226000.00",
"otherAssets": "1233979000.00",
"cash": "2967504000.00",
"totalCurrentLiabilities": "9775324000.00",
"shortLongTermDebt": "2106538000.00",
"otherStockholderEquity": "8271000.00",
"propertyPlantEquipment": "19733969000.00",
"totalCurrentAssets": "7920491000.00",
"longTermInvestments": "17572000.00",
"netTangibleAssets": "4152136000.00",
"shortTermInvestments": "0.00",
"netReceivables": "1155001000.00",
"longTermDebt": "9726589000.00",
"inventory": "3314127000.00",
"accountsPayable": "3596984000.00",
"totalPermanentEquity": "0.00",
"noncontrollingInterestInConsolidatedEntity": "0.00",
"temporaryEquityRedeemableNoncontrollingInterests": "0.00",
"accumulatedOtherComprehensiveIncome": "0.00",
"additionalPaidInCapital": "0.00",
"commonStockTotalEquity": "0.00",
"preferredStockTotalEquity": "0.00",
"retainedEarningsTotalEquity": "0.00",
"treasuryStock": "0.00"
},
// ...
"Cash_Flow": {
"currency_symbol": "USD",
"quarterly": {
"2018-09-30": {
"date": "2018-09-30",
"filing_date": "2018-11-02",
"investments": null,
"changeToLiabilities": "895197000.00",
"totalCashflowsFromInvestingActivities": "-560965000.00",
"netBorrowings": "-221931000.00",
"totalCashFromFinancingActivities": "-84218000.00",
"changeToOperatingActivities": "98770000.00",
"netIncome": "311516000.00",
"changeInCash": "739728000.00",
"totalCashFromOperatingActivities": "1391281000.00",
"depreciation": "502825000.00",
"otherCashflowsFromInvestingActivities": "128600000.00",
"dividendsPaid": "0.00",
"changeToInventory": "-55055000.00",
"changeToAccountReceivables": "-587594000.00",
"salePurchaseOfStock": "0.00",
"otherCashflowsFromFinancingActivities": "42839000.00",
"changeToNetincome": "179168000.00",
"capitalExpenditures": "-559765000.00"
},https://stackoverflow.com/questions/53418970
复制相似问题