private void AddToStatement(FactContext context, string elementName, string value) { double result = 0; if (!double.TryParse(value, out result)) { return; // NaN } if (null == context) { return; // no time period } // look up financial statement, if there is one FinancialStatement statement; if (_statementCache.ContainsKey(context.HashKey)) { statement = _statementCache[context.HashKey]; } else { statement = new FinancialStatement { StartDate = context.StartDate, EndDate = context.EndDate, Ticker = this._filing.Ticker, Source = StatementBase.SourceEdgar } }; // try to set the value on the statement if (SetStatementValue(statement, elementName, result)) { _statementCache[context.HashKey] = statement; } }
/// <summary> /// Build a hash of all document contexts so we can easily refer to them. This is a kind of XBRL hack (rather than relying on XSLT, etc). /// </summary> /// <param name="contexts"></param> /// <returns></returns> private static Dictionary <string, FactContext> BuildContextHash(XmlNodeList contexts, string ticker, string source) { var hash = new Dictionary <string, FactContext>(); foreach (XmlNode node in contexts) { FactContext fc = new FactContext(node, ticker, source); hash.Add(fc.Name, fc); } // we went through every context return(hash); }
private void AddToStatement(FactContext context, string elementName, string value) { double result = 0; if (!double.TryParse(value, out result)) return; // NaN if (null == context) return; // no time period // look up financial statement, if there is one FinancialStatement statement; if (_statementCache.ContainsKey(context.HashKey)) statement = _statementCache[context.HashKey]; else statement = new FinancialStatement { StartDate = context.StartDate, EndDate = context.EndDate, Ticker = this._filing.Ticker, Source = StatementBase.SourceEdgar }; // try to set the value on the statement if (SetStatementValue(statement, elementName, result)) _statementCache[context.HashKey] = statement; }
/// <summary> /// Build a hash of all document contexts so we can easily refer to them. This is a kind of XBRL hack (rather than relying on XSLT, etc). /// </summary> /// <param name="contexts"></param> /// <returns></returns> private static Dictionary<string, FactContext> BuildContextHash(XmlNodeList contexts, string ticker, string source) { var hash = new Dictionary<string, FactContext>(); foreach (XmlNode node in contexts) { FactContext fc = new FactContext(node, ticker, source); hash.Add(fc.Name, fc); } // we went through every context return hash; }