public static DataSet GetSpreads(FilterConditions filterConditions) { DataTable filteredDataTable = OCHelper.AddRecordsToDataTable(filterConditions); DataSet dataSet = new DataSet(); DataSet dataSetCE = new DataSet(); DataSet dataSetPE = new DataSet(); if (filterConditions.ContractType.Equals(enumContractType.CE.ToString())) { dataSetCE = CalculateSpreads(filteredDataTable, enumContractType.CE.ToString(), filterConditions); dataSet = OCHelper.MergeDataSets(dataSet, dataSetCE); } if (filterConditions.ContractType.Equals(enumContractType.PE.ToString())) { dataSetPE = CalculateSpreads(filteredDataTable, enumContractType.PE.ToString(), filterConditions); dataSet = OCHelper.MergeDataSets(dataSet, dataSetPE); } if (filterConditions.ContractType.Equals("ALL")) { dataSetCE = CalculateSpreads(filteredDataTable, enumContractType.CE.ToString(), filterConditions); dataSet = OCHelper.MergeDataSets(dataSet, dataSetCE); dataSetPE = CalculateSpreads(filteredDataTable, enumContractType.PE.ToString(), filterConditions); dataSet = OCHelper.MergeDataSets(dataSet, dataSetPE); } return(dataSet); }
private static DataSet GetFilterAllStrategies(FilterConditions filterConditions) { DataSet dataSetResult = new DataSet(); DataTable filteredDataTable = OCHelper.AddRecordsToDataTable(filterConditions); DataSet dataSetCEBF = new DataSet(); DataSet dataSetPEBF = new DataSet(); DataSet dataSetPEIC = new DataSet(); dataSetCEBF = Butterfly.GetButterflySpreadStrategies(filteredDataTable, enumContractType.CE.ToString(), filterConditions); dataSetResult = OCHelper.MergeDataSets(dataSetResult, dataSetCEBF); dataSetPEBF = Butterfly.GetButterflySpreadStrategies(filteredDataTable, enumContractType.PE.ToString(), filterConditions); dataSetResult = OCHelper.MergeDataSets(dataSetResult, dataSetPEBF); dataSetPEIC = IronCondorClass.CalculateIronCondors(filteredDataTable, filterConditions); dataSetResult = OCHelper.MergeDataSets(dataSetResult, dataSetPEIC); return(dataSetResult); }