使用Arelle的公司比率计算

时间:2019-07-01 07:30:26

标签: python sphinx

尝试使用Arelle(将公式写在狮身人面像文件中)生成公司的比率计算。

我们提供的输入是xbrl zip,预期的输出是比率计算文件。

python arelleCmdLine.py -f /projects/samplecodes/0000320193/2017/10-K/0000320193-17-000070-xbrl.zip --plugin 'sphinx' --generate-sphinx-formula-linkbase ./arelle/plugin/US-GAAP_Ratios_Example.xsr --generated-sphinx-formulas-directory ./output_dir

US-GAAP_Ratios_Example.xsr

/*
 * This file is part of the XBRL-US ratios.
 */

xmlns:dei="http://xbrl.sec.gov/dei/2012-01-31"
xmlns="http://fasb.org/us-gaap/2012-01-31"

/*
 * References on XBRL-US Ratios:
 * (1) http://web.ku.edu/~eycarat/myssi/_pdf/2-Debreceny-XBRL%20Ratios%2020101213.pdf
 *     Debreceney, et al, 2011 KU XBRL Conference
 * (2) http://www.xbrlsite.com/Demos/Ontologies/2011-04-15/US-GAAP-KeyRatios.xml
 *     Hoffman, C, 2009
 */

report EntityRegistrantName
  dei:EntityRegistrantName[]

report DocumentType
  dei:DocumentType[]

report DocumentPeriodEndDate
  dei:DocumentPeriodEndDate[]

report CurrentRatio
  AssetsCurrent[] / LiabilitiesCurrent[]

report WorkingCapital
  AssetsCurrent[] - LiabilitiesCurrent[]

report CashRatio
  (CashAndCashEquivalentsAtCarryingValue[] + 
   MarketableSecuritiesCurrent[]) / 
  LiabilitiesCurrent[]

report DebtEquity
  (LiabilitiesCurrent[] + AccountsPayableInterestBearingNoncurrent[]) /
   (AssetsCurrent[] + LiabilitiesCurrent[])

report ReturnOnEquity
   ROE = NetIncomeLoss[];
   $ROE /
   (AssetsCurrent[period=$ROE::period::end-date] + 
    LiabilitiesCurrent[period=$ROE::period::end-date])

report SalesToAccountsReceivable
    Revenue = NetIncomeLoss[];
    $Revenue / AccountsReceivableNetCurrent[period=$Revenue::period::end-date]

report SalesToFixedAssets
    Revenue = NetIncomeLoss[];
    $Revenue / PropertyPlantAndEquipmentNet[period=$Revenue::period::end-date]

输出

[info] Activation of plug-in Sphinx 2.0 Processor successful, version 0.9. - sphinx 
Match annotation at loc 24(2,1)
Match annotationName at loc 24(2,1)
Exception raised:Expected annotationName (at char 24), (line:2, col:1)
Exception raised:Expected annotationName (at char 24), (line:2, col:1)

0 个答案:

没有答案