/************************************************************************/ #region Constructor (internal) /// <summary> /// Initializes a new instance of the <see cref="SecurityInfoCollection"/> class. /// </summary> /// <param name="secListNode">The xml node for the security list</param> /// <param name="owner">The statement that owns this collection.</param> internal SecurityPositionCollection(XmlNode secListNode, CommonStatementBase owner) { list = new List <SecurityPositionBase>(); if (secListNode != null) { foreach (XmlNode childNode in secListNode.ChildNodes) { switch (childNode.Name) { case MutualFundSecurityPosition.NodeName: Add(new MutualFundSecurityPosition(childNode, owner)); break; case StockSecurityPosition.NodeName: Add(new StockSecurityPosition(childNode, owner)); break; case OptionSecurityPosition.NodeName: Add(new OptionSecurityPosition(childNode, owner)); break; case DebtSecurityPosition.NodeName: Add(new DebtSecurityPosition(childNode, owner)); break; case OtherSecurityPosition.NodeName: Add(new OtherSecurityPosition(childNode, owner)); break; } } } }
/************************************************************************/ #region Constructor (internal) /// <summary> /// Initializes a new instance of the <see cref="SecurityPositionBase"/> class. /// </summary> /// <param name="rootNode">The root node from which to find data for this class.</param> /// <param name="defaultCurrency">The default currency.</param> /// <param name="owner">The statement that owns this position.</param> internal SecurityPositionBase(XmlNode rootNode, CommonStatementBase owner) { // Null values here indicate programmer error. ValidateNull(rootNode, nameof(rootNode)); ValidateNull(owner, nameof(owner)); Id = new SecurityId(GetNestedNode(rootNode, SecurityId.NodeName)); HeldInAccount = GetNodeValue(rootNode, nameof(HeldInAccount)); PositionType = GetNodeValue(rootNode, nameof(PositionType)); Units = GetDecimalValue(rootNode, nameof(Units)); UnitPrice = GetDecimalValue(rootNode, nameof(UnitPrice)); MarketValue = GetDecimalValue(rootNode, nameof(MarketValue)); DateAsOf = GetNullableDateTimeValue(rootNode, nameof(DateAsOf)); Currency = new CurrencyAggregate(rootNode, owner); }
/************************************************************************/ #region Constructor (internal) /// <summary> /// Initializes a new instance of the <see cref="DebtSecurityPosition"/> class. /// </summary> /// <param name="rootNode">The root node from which to find data for this class.</param> /// <param name="owner">The statement that owns this position.</param> internal DebtSecurityPosition(XmlNode rootNode, CommonStatementBase owner) : base(rootNode, owner) { }
/************************************************************************/ #region Constructor (internal) /// <summary> /// Initializes a new instance of the <see cref="MutualFundSecurityPosition"/> class. /// </summary> /// <param name="rootNode">The root node from which to find data for this class.</param> /// <param name="owner">The statement that owns this position.</param> internal MutualFundSecurityPosition(XmlNode rootNode, CommonStatementBase owner) : base(rootNode, owner) { }