Example #1
0
        public DividendHistory(DividendTypes dividendType, ISecurityInstrument instrument,
            DateTime exDividendDate, DateTime settlementDate, Price unitPrice, decimal scripRatio)
            : this(instrument)
        {
            if (dividendType == DividendTypes.Cash && (unitPrice == null || unitPrice.IsZero))
                throw new ApplicationException("The unit price can not be null for cash dividend");
            else if (dividendType == DividendTypes.Scrip && scripRatio == 0M)
                throw new ApplicationException("The scrip ratio can not be 0 for scrip dividend");

            this.DividendType = dividendType;
            this.ExDividendDate = exDividendDate;
            this.SettlementDate = settlementDate;
            this.UnitPrice = unitPrice;
            this.ScripRatio = scripRatio;
        }
Example #2
0
 public DividendHistoryDetails(IDividendHistory history)
 {
     if (history != null)
     {
         this.IsStockDiv = history.NeedsStockDividend;
         this.Key = history.Key;
         this.DividendType = history.DividendType;
         this.Fund = history.Instrument;
         this.FundID = history.Instrument.Key;
         this.ExDividendDate = history.ExDividendDate;
         this.SettlementDate = history.SettlementDate;
         this.UnitPrice = history.UnitPrice != null ? history.UnitPrice.Quantity : 0M;
         this.ScripRatio = history.ScripRatio;
         this.ExtDescription = history.Description;
         this.IsExecuted = history.IsExecuted;
         this.IsInitialised = history.IsInitialised;
         this.IsGelicht = history.IsGelicht;
         this.DividendTaxStyle = (int)history.TypeOfDividendTax;
         this.TaxPercentage = history.TaxPercentage;
         this.StockDivIsin = history.StockDivIsin;
         this.TotalDividendDeposited = history.TotalNumberOfUnits;
         this.TotalUnitsInPossession = this.IsStockDiv ? history.StockDividends.Get(e => e.TotalUnits).GetS(e => e.DisplayString) : history.CashDividends.Get(e => e.TotalUnits).GetS(e => e.DisplayString);
         this.TotalDividendAmount = this.IsStockDiv ? history.StockDividends.Get(e => e.TotalDividendAmount).GetS(e => e.DisplayString) : history.CashDividends.Get(e => e.TotalDividendAmount).GetS(e => e.DisplayString);
     }
 }