Code cleanup.
This commit is contained in:
@@ -735,6 +735,11 @@ namespace MarketData.Generator.CMMomentum
|
||||
// ****************************************************************************************************************************************
|
||||
// **************************************************************** S E S S I O N M A N A G E M E N T ***********************************
|
||||
// ****************************************************************************************************************************************
|
||||
/// <summary>
|
||||
/// Restore the session file from disk.
|
||||
/// Take note that we do not restore AnalysisDate from the session file. The analysis date must always reflect the current analysis date.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public CMSessionParams RestoreSession()
|
||||
{
|
||||
try
|
||||
@@ -746,7 +751,6 @@ namespace MarketData.Generator.CMMomentum
|
||||
TradeDate = sessionParams.TradeDate;
|
||||
if (TradeDate.Date < AnalysisDate.Date) TradeDate = AnalysisDate;
|
||||
StartDate = sessionParams.StartDate;
|
||||
AnalysisDate = sessionParams.AnalysisDate;
|
||||
Parameters = sessionParams.CMParams;
|
||||
ActivePositions = sessionParams.ActivePositions;
|
||||
AllPositions = sessionParams.AllPositions;
|
||||
|
||||
@@ -22,6 +22,24 @@ namespace MarketData.Generator.CMMomentum
|
||||
{
|
||||
CMCandidate cmCandidate = new CMCandidate();
|
||||
|
||||
// No trade symbols
|
||||
if (null!=cmParams.NoTradeSymbolsList&&cmParams.NoTradeSymbolsList.Any(x => x.Equals(symbol)))
|
||||
{
|
||||
cmCandidate.Violation = true;
|
||||
cmCandidate.Reason = String.Format("Candidate in the No-Trade list.");
|
||||
cmCandidate.ReasonCategory = String.Format("Candidate in the No-Trade list.");
|
||||
return cmCandidate;
|
||||
}
|
||||
|
||||
// Check if the symbol is held in any open positions
|
||||
if (null != symbolsHeld && symbolsHeld.Any(x => x.Equals(symbol, StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
cmCandidate.Violation = true;
|
||||
cmCandidate.Reason = String.Format("Already held.");
|
||||
cmCandidate.ReasonCategory = String.Format("Already held.");
|
||||
return cmCandidate;
|
||||
}
|
||||
|
||||
Fundamental fundamental = FundamentalDA.GetFundamentalMaxDate(symbol, tradeDate);
|
||||
if (null == fundamental)
|
||||
{
|
||||
@@ -37,22 +55,7 @@ namespace MarketData.Generator.CMMomentum
|
||||
cmCandidate.ReasonCategory = String.Format("MarketCapLowerLimit constraint violation.");
|
||||
return cmCandidate;
|
||||
}
|
||||
// Check if the symbol is held in any open positions
|
||||
if (null != symbolsHeld && symbolsHeld.Any(x => x.Equals(symbol)))
|
||||
{
|
||||
cmCandidate.Violation = true;
|
||||
cmCandidate.Reason = String.Format("Already held.");
|
||||
cmCandidate.ReasonCategory = String.Format("Already held.");
|
||||
return cmCandidate;
|
||||
}
|
||||
// No trade symbols
|
||||
if (null!=cmParams.NoTradeSymbolsList&&cmParams.NoTradeSymbolsList.Any(x => x.Equals(symbol)))
|
||||
{
|
||||
cmCandidate.Violation = true;
|
||||
cmCandidate.Reason = String.Format("Candidate in the No-Trade list.");
|
||||
cmCandidate.ReasonCategory = String.Format("Candidate in the No-Trade list.");
|
||||
return cmCandidate;
|
||||
}
|
||||
|
||||
// Equity check
|
||||
CompanyProfile companyProfile = CompanyProfileDA.GetCompanyProfile(symbol);
|
||||
if (!companyProfile.IsEquity)
|
||||
|
||||
Reference in New Issue
Block a user