Remove Profiling in PricingDA

This commit is contained in:
2025-04-24 20:35:01 -04:00
parent 63f6f5a9f5
commit 5afbcf5bf4

View File

@@ -8,9 +8,11 @@ namespace MarketData.DataAccess
public class PricingDA public class PricingDA
{ {
public static readonly int ForwardLookingDays = 90; public static readonly int ForwardLookingDays = 90;
private PricingDA() private PricingDA()
{ {
} }
public static bool AddSecurity(String symbol,String companyName) public static bool AddSecurity(String symbol,String companyName)
{ {
MySqlConnection sqlConnection = null; MySqlConnection sqlConnection = null;
@@ -51,6 +53,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close(); if (null != sqlConnection) sqlConnection.Close();
} }
} }
public static bool SecurityExists(String symbol) public static bool SecurityExists(String symbol)
{ {
MySqlConnection sqlConnection = null; MySqlConnection sqlConnection = null;
@@ -88,6 +91,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close(); if (null != sqlConnection) sqlConnection.Close();
} }
} }
public static List<String> GetSymbolsNotIn(List<String> symbols) public static List<String> GetSymbolsNotIn(List<String> symbols)
{ {
MySqlConnection sqlConnection = null; MySqlConnection sqlConnection = null;
@@ -130,6 +134,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close(); if (null != sqlConnection) sqlConnection.Close();
} }
} }
public static int GetPriceCountOn(DateTime date) public static int GetPriceCountOn(DateTime date)
{ {
MySqlConnection sqlConnection=null; MySqlConnection sqlConnection=null;
@@ -1206,7 +1211,6 @@ namespace MarketData.DataAccess
// Get prices starting at "startDate" and "days" number of days going into future // Get prices starting at "startDate" and "days" number of days going into future
public static Prices GetPricesForward(String symbol,DateTime startDate,int days) public static Prices GetPricesForward(String symbol,DateTime startDate,int days)
{ {
Profiler profiler = new Profiler();
MySqlConnection sqlConnection=null; MySqlConnection sqlConnection=null;
MySqlDataReader sqlDataReader=null; MySqlDataReader sqlDataReader=null;
MySqlCommand sqlCommand=null; MySqlCommand sqlCommand=null;
@@ -1256,9 +1260,9 @@ namespace MarketData.DataAccess
if(null!=sqlCommand) sqlCommand.Dispose(); if(null!=sqlCommand) sqlCommand.Dispose();
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();} if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
if(null!=sqlConnection) sqlConnection.Close(); if(null!=sqlConnection) sqlConnection.Close();
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[GetPricesForward] Done, took {0}(ms)",profiler.End()));
} }
} }
public static Prices GetPricesOnOrBefore(String symbol,DateTime startDate) public static Prices GetPricesOnOrBefore(String symbol,DateTime startDate)
{ {
MySqlConnection sqlConnection = null; MySqlConnection sqlConnection = null;
@@ -1366,6 +1370,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close(); if (null != sqlConnection) sqlConnection.Close();
} }
} }
public static Prices GetPrices(String symbol, DateTime endDate) public static Prices GetPrices(String symbol, DateTime endDate)
{ {
MySqlConnection sqlConnection = null; MySqlConnection sqlConnection = null;
@@ -1416,6 +1421,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close(); if (null != sqlConnection) sqlConnection.Close();
} }
} }
public static bool InsertPrice(Price price) public static bool InsertPrice(Price price)
{ {
Prices prices = new Prices(); Prices prices = new Prices();
@@ -1423,6 +1429,7 @@ namespace MarketData.DataAccess
DeletePrice(price.Symbol, price.Date); DeletePrice(price.Symbol, price.Date);
return InsertPrices(prices); return InsertPrices(prices);
} }
public static bool InsertPrices(Prices prices) public static bool InsertPrices(Prices prices)
{ {
MySqlConnection sqlConnection=null; MySqlConnection sqlConnection=null;
@@ -1481,6 +1488,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close(); if (null != sqlConnection) sqlConnection.Close();
} }
} }
public static bool DeletePrice(String symbol, DateTime date) public static bool DeletePrice(String symbol, DateTime date)
{ {
MySqlConnection sqlConnection = null; MySqlConnection sqlConnection = null;
@@ -1510,6 +1518,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close(); if (null != sqlConnection) sqlConnection.Close();
} }
} }
public static bool DeletePriceOnOrAfter(String symbol, DateTime date) public static bool DeletePriceOnOrAfter(String symbol, DateTime date)
{ {
MySqlConnection sqlConnection = null; MySqlConnection sqlConnection = null;
@@ -1539,6 +1548,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close(); if (null != sqlConnection) sqlConnection.Close();
} }
} }
public static bool DeletePriceOnOrBefore(String symbol, DateTime date) public static bool DeletePriceOnOrBefore(String symbol, DateTime date)
{ {
MySqlConnection sqlConnection = null; MySqlConnection sqlConnection = null;
@@ -1568,6 +1578,7 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close(); if (null != sqlConnection) sqlConnection.Close();
} }
} }
private static bool DeletePrices(Prices prices, MySqlConnection sqlConnection, MySqlTransaction sqlTransaction) private static bool DeletePrices(Prices prices, MySqlConnection sqlConnection, MySqlTransaction sqlTransaction)
{ {
for(int index=0;index<prices.Count;index++) for(int index=0;index<prices.Count;index++)
@@ -1576,6 +1587,7 @@ namespace MarketData.DataAccess
} }
return true; return true;
} }
private static bool DeletePrice(Price price, MySqlConnection sqlConnection, MySqlTransaction sqlTransaction) private static bool DeletePrice(Price price, MySqlConnection sqlConnection, MySqlTransaction sqlTransaction)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();