![]() |
VOOZH | about |
dotnet add package XbrlW --version 6.1.0
NuGet\Install-Package XbrlW -Version 6.1.0
<PackageReference Include="XbrlW" Version="6.1.0" />
<PackageVersion Include="XbrlW" Version="6.1.0" />Directory.Packages.props
<PackageReference Include="XbrlW" />Project file
paket add XbrlW --version 6.1.0
#r "nuget: XbrlW, 6.1.0"
#:package XbrlW@6.1.0
#addin nuget:?package=XbrlW&version=6.1.0Install as a Cake Addin
#tool nuget:?package=XbrlW&version=6.1.0Install as a Cake Tool
Import the Xbrl namespace and components by placing the following code at the top of your code document:
using Xbrl;
An Xbrl document can be opened through a byte Stream. This stream can be sourced from a locally saved file or through the "SecuritiesExchangeCommission.Edgar" NuGet solution package. I've used the named NuGet package here:
//Search for a 10-K XBRL document and then download to a Stream
EdgarSearch es = await EdgarSearch.CreateAsync("INTC", "10-K");
EdgarSearchResult esr = es.GetFirstResultOfFilingType("10-K");
Stream s = await esr.DownloadXbrlDocumentAsync();
//Read the XBRL document
XbrlInstanceDocument doc = XbrlInstanceDocument.Create(s);
//List all facts
foreach (XbrlFact fact in doc.Facts)
{
Console.WriteLine(fact.Label + ": " + fact.Value.ToString("#,##0.00");
}
Each Context Reference contains five properties:
Id - The ID of the Context Ref. This is used by Facts to reference their time period.
TimeType - Specifies the time type for this context reference (either a period with a start or end date, or a "snapshop" on a specific day)
InstantDate - If the time type is instant ("snapshot"), this marks the date of the snapshot.
StartDate - If the time type is period (a period of time), this marks the period begin date.
EndDate - If the time type is period (a period of time), this marks the period end date.
Example of listing all properties of each context reference in an Instance Document:
//List all context references
foreach (XbrlContext context in doc.Contexts)
{
Console.WriteLine("ID: " + context.Id);
Console.WriteLine("Time Type: " + context.TimeType.ToString());
if (context.TimeType == XbrlTimeType.Instant)
{
Console.WriteLine("Instant Date: " + context.InstantDate.ToShortDateString());
}
else if (context.TimeType == XbrlTimeType.Period)
{
Console.WriteLine("Start Date: " + context.StartDate.ToShortDateString());
Console.WriteLine("End Date: " + context.EndDate.ToShortDateString());
}
}
The XbrlInstanceDocument class provides the GetContextById method to search through the array of Context References and return the match.
You can pass the ContextId string to this method to return the XbrlContext object.
For example:
//Get a fact's Context Reference
XbrlContext context = doc.GetContextById(doc.Facts[0].ContextId);
Many companies will include multiple facts of the same type in their document, each for a different fiscal period. For example, including the annual revenue of 2014, 2015, and 2016, all with them same label name. This package also provides a helper class to assist with extracting of current facts, related directly to this period.
Import the helper class by placing this at the top of your code file:
using Xbrl.Helpers;
This will add an extension method to an XbrlInstanceDocument object called GetValueFromPriorities. This method will look for facts that are only relevent to the documents current time period. You can provide multiple labels to search for and the method will search for a fact with the first label, move onto the next if it was unable to find one, and so forth.
For example, if a company either labeled their Current Assets from their balance sheet as "AssetsCurrent" or "CurrentAssets", we would use the following code to return this fact.
XbrlFact current_assets = doc.GetValueFromPriorities("CurrentAssets", "AssetsCurrent");
Companies use different terms and keywords to refer to common items on their financial statements. The XBRL package also provides a way to convert an XBRL Instance Document into a "common" financial statement with data that is commonly found in every set of financial statemnets like Revenue, Net Income, Assets, Equity, etc.
Place this line at the top of you code file:
using Xbrl.FinancialStatement;
Importing the namespace with the code below adds an extension method to the XbrlInstanceDocument class. Below is an example of converting an XbrlInstanceDocument into a Financial Statement.
FinancialStatement fs = doc.CreateFinancialStatement();
This was originally forked from: Tim Hanewich's XBRL repository. The original documentation above is still functional but the code behind the scenes has been optimized to leverage XPath via the XML document accessible within XbrlInstanceDocument:
using Xbrl.XbrlInstanceDocumentHelper;
XbrlInstanceDocument doc = //Use prior documentation to instantiate instance
XmlNode FactNode = doc.xmlDocument.SelectSingleNode("//*[local-name()='Assets'",doc.xmlNamespaceManager);
XbrlFact fact = FactNode.ToFact(doc.xmlNamespaceManager);
Preferred Dividends, Earnings Per Share Basic & Diluted
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on XbrlW:
| Package | Downloads |
|---|---|
|
EdgarCacheFramework
Minimizes external requests to Yahoo and SEC EDGAR XBRL filings by caching searched results in a code first, run-time generated SQLite database. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 6.1.0 | 814 | 11/7/2022 | |
| 6.0.0 | 710 | 11/2/2022 | 6.0.0 is deprecated because it has critical bugs. |
Optimized fact finding and added financial statement parsing for Preferred Dividends