Changes for MGSHBacktest model.
Code cleanup.
This commit is contained in:
@@ -99,6 +99,7 @@ namespace MarketData.MarketDataModel
|
||||
{
|
||||
return this.Min(x => x.TradeDate);
|
||||
}
|
||||
|
||||
public DateTime GetMinTradeDate(String symbol)
|
||||
{
|
||||
DateTime minDate=Utility.Epoch;
|
||||
@@ -271,5 +272,26 @@ namespace MarketData.MarketDataModel
|
||||
if(!portfolioTrade.SellDate.Equals(Utility.Epoch)&&price.Date>portfolioTrade.SellDate) return null;
|
||||
return portfolioTrade.Shares*portfolioTrade.Price;
|
||||
}
|
||||
|
||||
// Collections
|
||||
|
||||
public NVPCollections ToNVPCollections()
|
||||
{
|
||||
NVPCollections nvpCollections=new NVPCollections();
|
||||
foreach(PortfolioTrade portfolioTrade in this)
|
||||
{
|
||||
nvpCollections.Add(portfolioTrade.ToNVPCollection());
|
||||
}
|
||||
return nvpCollections;
|
||||
}
|
||||
public static PortfolioTrades FromNVPCollections(NVPCollections nvpCollections)
|
||||
{
|
||||
PortfolioTrades portfolioTrades=new PortfolioTrades();
|
||||
foreach(NVPCollection nvpCollection in nvpCollections)
|
||||
{
|
||||
portfolioTrades.Add(PortfolioTrade.FromNVPCollection(nvpCollection));
|
||||
}
|
||||
return portfolioTrades;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user