Code cleanup
This commit is contained in:
@@ -635,7 +635,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -654,7 +654,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms).");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms).");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,7 +688,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -714,7 +714,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,7 +769,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took{profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took{profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,7 +837,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -857,7 +857,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,7 +877,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -896,7 +896,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -915,7 +915,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -935,7 +935,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -954,7 +954,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -973,7 +973,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -992,7 +992,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1010,7 +1010,7 @@ namespace MarketData.Services
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End}(ms)");
|
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ namespace MarketData.Generator.Momentum
|
|||||||
double gainLossClosedPositions=0.00;
|
double gainLossClosedPositions=0.00;
|
||||||
double exposure=0.00;
|
double exposure=0.00;
|
||||||
double marketValue=0.00;
|
double marketValue=0.00;
|
||||||
// if(HolidayDA.IsMarketHoliday(currentDate)) continue;
|
|
||||||
ModelPerformanceItem performanceItem=new ModelPerformanceItem();
|
ModelPerformanceItem performanceItem=new ModelPerformanceItem();
|
||||||
foreach(MarketData.Generator.Momentum.Position openPosition in openPositions)
|
foreach(MarketData.Generator.Momentum.Position openPosition in openPositions)
|
||||||
{
|
{
|
||||||
@@ -190,7 +189,8 @@ namespace MarketData.Generator.Momentum
|
|||||||
AllPositions.DisplayTopFive();
|
AllPositions.DisplayTopFive();
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG, "************** T O P L O S S E R S *************");
|
MDTrace.WriteLine(LogLevel.DEBUG, "************** T O P L O S S E R S *************");
|
||||||
AllPositions.DisplayBottomFive();
|
AllPositions.DisplayBottomFive();
|
||||||
DisplayBalanceFromPositions();
|
// DisplayBalanceFromPositions();
|
||||||
|
DisplayLatestModelPerformance(paramPathSessionFileName);
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StartDate:{0}",Utility.DateTimeToStringMMHDDHYYYY(StartDate)));
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StartDate:{0}",Utility.DateTimeToStringMMHDDHYYYY(StartDate)));
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("TradeDate:{0}",Utility.DateTimeToStringMMHDDHYYYY(TradeDate)));
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("TradeDate:{0}",Utility.DateTimeToStringMMHDDHYYYY(TradeDate)));
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("AnalysisDate:{0}",Utility.DateTimeToStringMMHDDHYYYY(AnalysisDate)));
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("AnalysisDate:{0}",Utility.DateTimeToStringMMHDDHYYYY(AnalysisDate)));
|
||||||
@@ -588,6 +588,26 @@ namespace MarketData.Generator.Momentum
|
|||||||
// *********************************************************************************************************************************************************************
|
// *********************************************************************************************************************************************************************
|
||||||
// ************************************************************ E N D B U Y P O S I T I O N S ***********************************************
|
// ************************************************************ E N D B U Y P O S I T I O N S ***********************************************
|
||||||
// *********************************************************************************************************************************************************************
|
// *********************************************************************************************************************************************************************
|
||||||
|
private void DisplayLatestModelPerformance(String pathSessionFileName)
|
||||||
|
{
|
||||||
|
ModelPerformanceSeries performanceSeries=GetModelPerformance(pathSessionFileName);
|
||||||
|
if(null==performanceSeries || 0==performanceSeries.Count)return;
|
||||||
|
MDTrace.WriteLine("Date,Exposure,MarketValue,GainLossDoD,GainLoss,CumulativeGainLoss,R,(1+R),CumProd,CumProd-1,ClosedPositions");
|
||||||
|
ModelPerformanceItem modelPerformanceItem = performanceSeries[performanceSeries.Count-1]; // get the last record
|
||||||
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",\"{6}\",\"{7}\",\"{8}\",\"{9}\",\"{10}\"",
|
||||||
|
modelPerformanceItem.Date.ToShortDateString(),
|
||||||
|
Utility.FormatCurrency(modelPerformanceItem.Exposure),
|
||||||
|
Utility.FormatCurrency(modelPerformanceItem.MarketValue),
|
||||||
|
Utility.FormatCurrency(modelPerformanceItem.GainLossDOD),
|
||||||
|
Utility.FormatCurrency(modelPerformanceItem.GainLoss),
|
||||||
|
Utility.FormatCurrency(modelPerformanceItem.CumulativeGainLoss),
|
||||||
|
Utility.FormatNumber(modelPerformanceItem.R,4),
|
||||||
|
Utility.FormatNumber(modelPerformanceItem.OnePlusR,4),
|
||||||
|
Utility.FormatNumber(modelPerformanceItem.CumProd,4),
|
||||||
|
Utility.FormatNumber(modelPerformanceItem.CumProdMinusOne,4),
|
||||||
|
modelPerformanceItem.ClosedPositions));
|
||||||
|
}
|
||||||
|
|
||||||
private void DisplayBalance()
|
private void DisplayBalance()
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG,"*******************************************");
|
MDTrace.WriteLine(LogLevel.DEBUG,"*******************************************");
|
||||||
|
|||||||
Reference in New Issue
Block a user