Sync up with changes from ARM64
This commit is contained in:
@@ -10,9 +10,11 @@ namespace MarketData.DataAccess
|
||||
public class PricingDA
|
||||
{
|
||||
public static readonly int ForwardLookingDays = 90;
|
||||
|
||||
private PricingDA()
|
||||
{
|
||||
}
|
||||
|
||||
public static bool AddSecurity(String symbol,String companyName)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -53,6 +55,7 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool SecurityExists(String symbol)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -90,6 +93,7 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> GetSymbolsNotIn(List<String> symbols)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -132,6 +136,7 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetPriceCountOn(DateTime date)
|
||||
{
|
||||
MySqlConnection sqlConnection=null;
|
||||
@@ -287,7 +292,6 @@ namespace MarketData.DataAccess
|
||||
if(null!=sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<String,DateTime> GetLatestDates(List<String> symbols)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -298,7 +302,7 @@ namespace MarketData.DataAccess
|
||||
|
||||
try
|
||||
{
|
||||
if(null == symbols || 0==symbols.Count)return latestDates;
|
||||
if(null ==symbols || 0==symbols.Count)return latestDates;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||
sb.Append(" select symbol, max(date) as date ");
|
||||
@@ -684,6 +688,7 @@ namespace MarketData.DataAccess
|
||||
|
||||
try
|
||||
{
|
||||
if(null == symbols || 0==symbols.Count)return dictionary;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||
sb.Append("select symbol, company from securitymaster where symbol in ");
|
||||
@@ -1208,7 +1213,6 @@ namespace MarketData.DataAccess
|
||||
// Get prices starting at "startDate" and "days" number of days going into future
|
||||
public static Prices GetPricesForward(String symbol,DateTime startDate,int days)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
MySqlConnection sqlConnection=null;
|
||||
MySqlDataReader sqlDataReader=null;
|
||||
MySqlCommand sqlCommand=null;
|
||||
@@ -1258,9 +1262,9 @@ namespace MarketData.DataAccess
|
||||
if(null!=sqlCommand) sqlCommand.Dispose();
|
||||
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
|
||||
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)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -1368,6 +1372,7 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static Prices GetPrices(String symbol, DateTime endDate)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -1418,6 +1423,7 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool InsertPrice(Price price)
|
||||
{
|
||||
Prices prices = new Prices();
|
||||
@@ -1425,6 +1431,7 @@ namespace MarketData.DataAccess
|
||||
DeletePrice(price.Symbol, price.Date);
|
||||
return InsertPrices(prices);
|
||||
}
|
||||
|
||||
public static bool InsertPrices(Prices prices)
|
||||
{
|
||||
MySqlConnection sqlConnection=null;
|
||||
@@ -1483,6 +1490,7 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DeletePrice(String symbol, DateTime date)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -1512,6 +1520,7 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DeletePriceOnOrAfter(String symbol, DateTime date)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -1541,6 +1550,7 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DeletePriceOnOrBefore(String symbol, DateTime date)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -1570,6 +1580,7 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private static bool DeletePrices(Prices prices, MySqlConnection sqlConnection, MySqlTransaction sqlTransaction)
|
||||
{
|
||||
for(int index=0;index<prices.Count;index++)
|
||||
@@ -1578,6 +1589,7 @@ namespace MarketData.DataAccess
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool DeletePrice(Price price, MySqlConnection sqlConnection, MySqlTransaction sqlTransaction)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
Reference in New Issue
Block a user