Initial Commit
This commit is contained in:
93
MarketData/MarketDataLib/MarketDataModel/DividendHistory.cs
Executable file
93
MarketData/MarketDataLib/MarketDataModel/DividendHistory.cs
Executable file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MarketData.Utils;
|
||||
|
||||
namespace MarketData.MarketDataModel
|
||||
{
|
||||
public class DivExDateItem
|
||||
{
|
||||
public DivExDateItem()
|
||||
{
|
||||
}
|
||||
public String Symbol
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public DateTime DivExDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
public class DividendHistory : List<DividendHistoryItem>
|
||||
{
|
||||
public DividendHistory()
|
||||
{
|
||||
}
|
||||
public DividendHistory(List<DividendHistoryItem> items)
|
||||
{
|
||||
foreach(DividendHistoryItem item in items)Add(item);
|
||||
}
|
||||
public bool HasConsecutivePayments(int requiredConsecutiveMonths)
|
||||
{
|
||||
if(0==Count||Count<requiredConsecutiveMonths+1)return false;
|
||||
DateGenerator dateGenerator=new DateGenerator();
|
||||
DateTime initialDate=this[0].DivExDate;
|
||||
for(int index=1;index<requiredConsecutiveMonths+1;index++)
|
||||
{
|
||||
initialDate-=new TimeSpan(DateTime.DaysInMonth(initialDate.Year,initialDate.Month),0,0,0);
|
||||
if(!initialDate.Month.Equals(this[index].DivExDate.Month))return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public class DividendHistoryItem
|
||||
{
|
||||
public DividendHistoryItem()
|
||||
{
|
||||
}
|
||||
public String Symbol
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public String DividendType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public double? CashAmount
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public DateTime? DeclarationDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public DateTime? RecordDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public DateTime? PaymentDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public DateTime DivExDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public DateTime Modified
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user