Fix Feeds. InsiderTransactions, ETFHoldings, Yahoo Price Feed

This commit is contained in:
2024-03-04 19:28:21 -05:00
parent dc893be526
commit c4fa727c54
7 changed files with 596 additions and 352 deletions

View File

@@ -54,6 +54,59 @@ namespace MarketData.DataAccess
if (null != sqlConnection) sqlConnection.Close();
}
}
public static InsiderTransactions GetLatestInsiderTransactions()
{
MySqlConnection sqlConnection = null;
MySqlDataReader sqlDataReader = null;
MySqlCommand sqlCommand =null;
InsiderTransactions insiderTransactions=new InsiderTransactions();
String strQuery = null;
try
{
StringBuilder sb = new StringBuilder();
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
sb.Append("SELECT symbol,filing_date,transaction_date,insider_name,ownership_type,securities,nature_of_transaction,number_or_value_acquired_disposed,price,form,sec_accession_number,form_row_number,modified FROM insidertransaction WHERE TRANSACTION_DATE=(SELECT MAX(TRANSACTION_DATE) FROM insidertransaction WHERE TRANSACTION_DATE<=NOW() LIMIT 1)");
strQuery = sb.ToString(); ;
sqlCommand = new MySqlCommand(strQuery, sqlConnection);
sqlCommand.CommandTimeout = SqlUtils.COMMAND_TIMEOUT;
sqlDataReader = sqlCommand.ExecuteReader();
while (sqlDataReader.Read())
{
InsiderTransaction insiderTransaction=new InsiderTransaction();
insiderTransaction.Symbol=sqlDataReader.GetString(0);
insiderTransaction.FilingDate=sqlDataReader.GetDateTime(1);
insiderTransaction.TransactionDate=sqlDataReader.GetDateTime(2);
insiderTransaction.InsiderName=sqlDataReader.GetString(3);
insiderTransaction.OwnershipType=sqlDataReader.GetString(4);
insiderTransaction.Securities=sqlDataReader.GetString(5);
insiderTransaction.NatureOfTransaction=sqlDataReader.GetString(6);
if(!sqlDataReader.IsDBNull(7))insiderTransaction.NumberOrValueAcquiredDisposed=sqlDataReader.GetDouble(7);
else insiderTransaction.NumberOrValueAcquiredDisposed=Double.NaN;
if(!sqlDataReader.IsDBNull(8))insiderTransaction.Price=sqlDataReader.GetDouble(8);
else insiderTransaction.Price=Double.NaN;
insiderTransaction.Form=sqlDataReader.GetString(9);
insiderTransaction.SECAccessionNumber=sqlDataReader.GetString(10);
insiderTransaction.FormRowNumber=sqlDataReader.GetString(11);
insiderTransaction.Modified=sqlDataReader.GetDateTime(12);
insiderTransactions.Add(insiderTransaction);
}
return insiderTransactions;
}
catch (Exception exception)
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("GetLatestInsiderTransactions Exception: {0}",exception.ToString()));
return null;
}
finally
{
if(null!=sqlCommand)sqlCommand.Dispose();
if (null != sqlDataReader) sqlDataReader.Close();
if (null != sqlConnection) sqlConnection.Close();
}
}
public static InsiderTransactions GetInsiderTransactions(String symbol)
{
MySqlConnection sqlConnection = null;
@@ -107,6 +160,7 @@ namespace MarketData.DataAccess
}
}
public static bool InsertInsiderTransactions(InsiderTransactions insiderTransactions)
{
MySqlConnection sqlConnection = null;