Remove Profiling in some DAs

This commit is contained in:
2025-04-15 01:22:27 -04:00
parent eb9d45f4bd
commit 79e6fab88e
5 changed files with 12 additions and 70 deletions

View File

@@ -10,7 +10,6 @@ namespace MarketData.DataAccess
// ********************************************* I N C O M E S T A T E M E N T **************************************
public static bool CheckIncomeStatementModifiedOn(String symbol, DateTime modified,IncomeStatement.PeriodType periodType)
{
Profiler profiler = new Profiler();
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
MySqlCommand sqlCommand=null;
@@ -43,12 +42,10 @@ namespace MarketData.DataAccess
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
public static List<DateTime> GetIncomeStatementDates(String symbol,IncomeStatement.PeriodType periodType)
{
Profiler profiler = new Profiler();
List<DateTime> incomeStatementDates = new List<DateTime>();
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
@@ -83,12 +80,10 @@ namespace MarketData.DataAccess
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
public static DateTime? GetLatestIncomeStatementDate(String symbol,IncomeStatement.PeriodType periodType)
{
Profiler profiler = new Profiler();
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
MySqlCommand sqlCommand=null;
@@ -123,12 +118,10 @@ namespace MarketData.DataAccess
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
public static IncomeStatement GetIncomeStatement(String symbol,IncomeStatement.PeriodType periodType)
{
Profiler profiler = new Profiler();
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
MySqlCommand sqlCommand=null;
@@ -177,7 +170,6 @@ namespace MarketData.DataAccess
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
public static TimeSeriesCollection GetRevenue(String symbol,IncomeStatement.PeriodType period)
@@ -221,13 +213,11 @@ namespace MarketData.DataAccess
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
// Profit Margin is calculated as a percentage.
public static TimeSeriesCollection GetProfitMargin(String symbol,IncomeStatement.PeriodType period=IncomeStatement.PeriodType.Annual)
{
Profiler profiler = new Profiler();
TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection();
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
@@ -271,13 +261,11 @@ namespace MarketData.DataAccess
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
// Profit Margin is calculated as a percentage.
public static TimeSeriesCollection GetProfitMarginMaxAsOf(String symbol,DateTime maxDate, IncomeStatement.PeriodType period = IncomeStatement.PeriodType.Annual)
{
Profiler profiler = new Profiler();
TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection();
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
@@ -322,12 +310,10 @@ namespace MarketData.DataAccess
if (null != sqlCommand) sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
public static IncomeStatement GetIncomeStatement(String symbol,DateTime asof,IncomeStatement.PeriodType periodType)
{
Profiler profiler = new Profiler();
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
MySqlCommand sqlCommand=null;
@@ -374,12 +360,10 @@ namespace MarketData.DataAccess
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
public static IncomeStatement GetIncomeStatementMaxAsOf(String symbol,DateTime asof,IncomeStatement.PeriodType periodType)
{
Profiler profiler = new Profiler();
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
MySqlCommand sqlCommand=null;
@@ -427,12 +411,10 @@ namespace MarketData.DataAccess
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
public static bool InsertIncomeStatements(List<IncomeStatement> incomeStatements)
{
Profiler profiler = new Profiler();
MySqlConnection sqlConnection = null;
MySqlTransaction sqlTransaction = null;
String strQuery = null;
@@ -495,7 +477,6 @@ namespace MarketData.DataAccess
{
if (null != sqlTransaction) sqlTransaction.Dispose();
if (null != sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()}(ms)");
}
}
private static bool DeleteIncomeStatements(List<IncomeStatement> incomeStatements, MySqlConnection sqlConnection, MySqlTransaction sqlTransaction)