Add profiling to selected DAs
This commit is contained in:
@@ -10,6 +10,7 @@ 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;
|
||||
@@ -42,10 +43,12 @@ 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;
|
||||
@@ -80,10 +83,12 @@ 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;
|
||||
@@ -118,10 +123,12 @@ 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;
|
||||
@@ -170,10 +177,12 @@ 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)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection();
|
||||
MySqlConnection sqlConnection = null;
|
||||
MySqlDataReader sqlDataReader = null;
|
||||
@@ -212,11 +221,13 @@ 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;
|
||||
@@ -260,11 +271,13 @@ 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;
|
||||
@@ -309,10 +322,12 @@ 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;
|
||||
@@ -359,10 +374,12 @@ 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;
|
||||
@@ -410,10 +427,12 @@ 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;
|
||||
@@ -476,6 +495,7 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user