greedo/python-xbrl: xbrl parser written in Python - GitHub
文章推薦指數: 80 %
Installation. The easiest way to install python-xbrl is with pip · Requirements. Python >= 2.6 or >= 3.3 · Initialization. To start using the library, first ... Skiptocontent {{message}} greedo / python-xbrl Public Notifications Fork 68 Star 198 xbrlparserwritteninPython💡 pypi.python.org/pypi/python-xbrl License Apache-2.0license 198 stars 68 forks Star Notifications Code Issues 15 Pullrequests 1 Actions Projects 0 Security Insights More Code Issues Pullrequests Actions Projects Security Insights greedo/python-xbrl Thiscommitdoesnotbelongtoanybranchonthisrepository,andmaybelongtoaforkoutsideoftherepository. master Branches Tags Couldnotloadbranches Nothingtoshow {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default 2 branches 7 tags Code Clone HTTPS GitHubCLI UseGitorcheckoutwithSVNusingthewebURL. WorkfastwithourofficialCLI. Learnmore. OpenwithGitHubDesktop DownloadZIP LaunchingGitHubDesktop Ifnothinghappens,downloadGitHubDesktopandtryagain. LaunchingGitHubDesktop Ifnothinghappens,downloadGitHubDesktopandtryagain. LaunchingXcode Ifnothinghappens,downloadXcodeandtryagain. LaunchingVisualStudioCode Yourcodespacewillopenonceready. Therewasaproblempreparingyourcodespace,pleasetryagain. Latestcommit greedo Mergepullrequest#54fromyosukesan/53_fix_test … 882a34f Jun20,2022 Mergepullrequest#54fromyosukesan/53_fix_test issue53:fixtest 882a34f Gitstats 223 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime examples add( Jan18,2018 tests issue53:fixtest Apr16,2021 xbrl PEP8cleanup Jan3,2017 .gitignore updatedparser Aug5,2014 .travis.yml removingpypisupportfornow Dec3,2015 AUTHORS.rst -FixesissuesdescribedinIssue#39 Jan3,2017 LICENSE UpdateLICENSE Aug13,2014 README.rst TheexampleintheREADMEhasbeenupdatedtoreflectthefactthat Dec31,2016 requirements.txt Bumplxmlfrom4.6.2to4.6.5 Dec13,2021 setup.cfg addingdeiparsing,relaxE501abit Jul19,2015 setup.py bumptoversion1.1.1 Dec27,2016 Viewcode Installation Requirements Initialization SimpleParsingWorkflow Testing Bugs Contribute License README.rst python-xbrlisalibraryforparsing xbrl documentsprovidingoutputasbothabasicmodelobjectandserialized objectsthur marshmallowfor renderingintostandardsformatslikeJSONorHTTPAPI Installation Theeasiestwaytoinstallpython-xbrliswithpip pipinstallpython-xbrl Orinstallthelatestdevversionfromgithub(orreplace@masterwitha [email protected]) pipinstallgit+https://github.com/greedo/python-xbrl.git@master Or gitclonehttps://github.com/greedo/python-xbrl.git Or Copythepython-xbrldirectoryintoyourpythonpath.Zip here Madesureyoursys.pathiscorrect. Requirements Python>=2.6or>=3.3 python-xbrlreliesonbeautifulsoup4 whichsitsontopofthepythonXMLparserlxml.Italsorequires marshmallowforserializingobjects. Formoredetailsseerequirements.txt ForPyPIsupportitisrecommendedyouusehttps://github.com/amauryfa/lxmlforlxmlasthisisaforkthatusescffiinsteadofthepythoncapi. Initialization Tostartusingthelibrary,firstimporttheXBRLParser fromxbrlimportXBRLParser,GAAP,GAAPSerializer SimpleParsingWorkflow FirstparsetheincomingXRBLfileintoanewXBRLbasicobject xbrl_parser=XBRLParser() xbrl=xbrl_parser.parse(open("sam-20131228.xml")) Thenyoucanparsethedocumentusingdifferentparsers gaap_obj=xbrl_parser.parseGAAP(xbrl,doc_date="20131228",context="current",ignore_errors=0) NowwehaveaGAAPmodelobjectthathastheGAAPparsedelements fromthedocument. Thismodelobjectsupportstheseveraldifferentfeaturesincluding: contextcurrent,year,andinstantcontextsaresupported.Ifavailableyoucanalsogetpreviousquarterinformationbynumberofdaysfromdocdate.Example:90,180,etc. Errorhandling.0raiseexceptionforallparsingerrorsandhaltparsing,1Supressallparsingerrorsandcontinueparsing,2Logallparsingerrorsandcontinueparsing YoucanserializetheGAAPmodelobjectintoaserializedobject acceptableforrendingintoastandardformatsuchasJSONorHTTPAPI. serializer=GAAPSerializer() result=serializer.dump(gaap_obj) Youcanalsojustviewthedataintheserializedobject printresult.data YoucanapplyvariousparserstothebaseXBRLParserobjecttoget differentdatathanjustGAAPdatafromthedocument.Inadditionas expectedyoucanalsocreatedifferentserializedobjectsonthe resultingparseddataobject. ExtractingDEIData dei_obj=xbrl_parser.parseDEI(xbrl) serializer=DEISerializer() result=serializer.dump(dei_obj) ExtractingCustomData custom_obj=xbrl_parser.parseCustom(xbrl) printcustom_obj() Testing Toruntheunittests,youneedpytest pipinstallpytest Onceyouhavethat,cdintotherootdirectoryofthisrepoand py.test--tb=line-vs Bugs ForanybugsyouencounterpleaseopenaGithub issue Contribute Checkforopenissuesoropenafreshissuetostartadiscussionaroundafeatureideaorabug. Ifyoufeeluncomfortableoruncertainaboutanissueoryourchanges,feelfreetoemail@greedoandhewillhappilyhelpyouviaemail,Skype,remotepairingorwhateveryouarecomfortablewith. ForktherepositoryonGitHubtostartmakingyourchangestothemasterbranch(orbranchoffofit). Writeatestwhichshowsthatthebugwasfixedorthatthefeatureworksasexpected. Sendapullrequestandbugthemaintaineruntilitgetsmergedandpublished.:)MakesuretoaddyourselftoAUTHORS. License LicensedtotheApacheSoftwareFoundation(ASF)underone ormorecontributorlicenseagreements.SeetheNOTICEfile distributedwiththisworkforadditionalinformation regardingcopyrightownership.TheASFlicensesthisfile toyouundertheApacheLicense,Version2.0(the "License");youmaynotusethisfileexceptincompliance withtheLicense.YoumayobtainacopyoftheLicenseat http://www.apache.org/licenses/LICENSE-2.0 Unlessrequiredbyapplicablelaworagreedtoinwriting, softwaredistributedundertheLicenseisdistributedonan "ASIS"BASIS,WITHOUTWARRANTIESORCONDITIONSOFANY KIND,eitherexpressorimplied.SeetheLicenseforthe specificlanguagegoverningpermissionsandlimitations underthelicense. About xbrlparserwritteninPython💡 pypi.python.org/pypi/python-xbrl Resources Readme License Apache-2.0license Stars 198 stars Watchers 18 watching Forks 68 forks Releases 5 Hoth Latest Dec27,2016 +4releases Packages0 Nopackagespublished Usedby52 +44 Contributors7 Languages Python 100.0% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.
延伸文章資訊
- 1Parsing XBRL with Python - CodeProject
As of April 2009, the SEC requires that corporations provide financial reports in XBRL format in ...
- 2greedo/python-xbrl: xbrl parser written in Python - GitHub
Installation. The easiest way to install python-xbrl is with pip · Requirements. Python >= 2.6 or...
- 3写给想学Python的你:如何用Python解析XBRL - 开课吧
写给想学Python的你:如何用Python解析XBRL · 1.介绍XBRL. 美国证券交易委员会(SEC)的一个主要作用是确保投资者获得可靠的信息,以便作出决定。 · 1.1XML、 ...
- 4在python中解析xbrl檔案 - 程式人生
【python】在python中解析xbrl檔案. 阿新• • 發佈:2020-11-25. 我正在研究一個XML解析器。 目標是解析許多不同的xml檔案,其中字首和標記保持一致,但名稱空間會發...
- 5通過Python 讀取XBRL 文件 - Aspose
要繼續閱讀XBRL 文檔,請確保您具有以下先決條件。 基於Microsoft Windows 或Linux 的操作系統。- Python 3.5 或更高版本。- Aspose.Finance 表...