Changes for MGSHBacktest model.

Code cleanup.
This commit is contained in:
2025-02-10 07:57:00 -05:00
parent 36b10b4824
commit 0db4473632
16 changed files with 378 additions and 78 deletions

View File

@@ -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;
}
}
}