Refactor unit tests for CNNGenerateOutputFileBollinger and CNNGenerateOutputFileBollingerWithVIX

This commit is contained in:
2026-03-11 11:21:25 -04:00
parent 8715bed4cf
commit 2923971656
3 changed files with 44 additions and 10 deletions

View File

@@ -191,18 +191,19 @@ namespace MarketData.CNNProcessing
if(null==NoiseArray)NoiseArray=new double[]{0.00};
if(testCase.TypeGenerate.Equals(TestCase.GenerateType.BollingerBand))
{
testCase.PathFileNames.Add(CreateFileName("T",testCase.Symbol,testCase.DayCount,0,0,0,TestCase.CaseType.Test,TestCase.GenerateType.BollingerBand,testCase.PurchaseDate));
testCase.PathFileNames.Add(CreateFileName(testCase.HomePath,testCase.Symbol,testCase.DayCount,0,0,0,TestCase.CaseType.Test,TestCase.GenerateType.BollingerBand,testCase.PurchaseDate));
ProcessBollingerBandData(testCase,PenWidthArray[0],NoiseArray[0]);
}
else if(testCase.TypeGenerate.Equals(TestCase.GenerateType.BollingerBandWithVIX))
{
testCase.PathFileNames.Add(CreateFileName("T",testCase.Symbol,testCase.DayCount,0,0,0,TestCase.CaseType.Test,TestCase.GenerateType.BollingerBandWithVIX,testCase.PurchaseDate));
testCase.PathFileNames.Add(CreateFileName(testCase.HomePath,testCase.Symbol,testCase.DayCount,0,0,0,TestCase.CaseType.Test,TestCase.GenerateType.BollingerBandWithVIX,testCase.PurchaseDate));
ProcessBollingerBandDataWithVolatility(testCase,PenWidthArray[0],NoiseArray[0]);
}
}
private String CreateFileName(String strFolderPath,String symbol,int dayCount,int index,int penIndex,int noiseIndex,TestCase.CaseType caseType,TestCase.GenerateType generateType,DateTime purchaseDate)
{
if(!strFolderPath.EndsWith("/"))strFolderPath+="/";
return String.Format("{0}{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}d.jpg",strFolderPath,symbol,index,penIndex,noiseIndex,caseType.ToString(),generateType.ToString(),Utility.DateToLong(purchaseDate),dayCount);
}

View File

@@ -11,16 +11,25 @@ namespace MarketData.CNNProcessing
public class TestCases : List<TestCase>
{
}
public class TestCase
{
public enum CaseType{Training,Test,Validation};
public enum GenerateType{Price,BollingerBand,BollingerBandWithVIX};
public enum OutputType{OutputFile,OutputStream}
private readonly List<Stream> streams=new List<Stream>();
private readonly List<String> pathFileNames=new List<String>();
private readonly List<String> responses=new List<String>();
public String HomePath { get; set;} = Directory.GetCurrentDirectory();
/// <summary>
/// ProcessData item
/// TestCase
/// </summary>
///<param name="symbol">Symbol</param>
///<param name="startDate">The start datee.</param>
@@ -38,18 +47,31 @@ namespace MarketData.CNNProcessing
}
public String Symbol{get;set;}
public DateTime PurchaseDate{get;set;}
public DateTime HistDate{get;set;}
public CaseType TypeCase{get;set;}
public int DayCount{get;private set;}
public GenerateType TypeGenerate{get;set;}
public OutputType TypeOutput{get;set;}
public List<Stream> Streams{get{return streams;}} // This will get set automatically depending on OutputType
public List<Stream> Streams{get{return streams;}} // This will get set automatically depending on OutputType
public List<String> PathFileNames{get{return pathFileNames;}} // This will get set automaticall depending on OutputType
public List<String> Responses{get{return responses;}}
public Stream LastStream{get{return Streams.Count>0?Streams[Streams.Count-1]:null;}}
public String LastPathFileName{get{return PathFileNames.Count>0?PathFileNames[PathFileNames.Count-1]:null;}}
public String LastResponse{get{return Responses.Count>0?Responses[Responses.Count-1]:null;}}
public override String ToString()
{
StringBuilder sb=new StringBuilder();