[Quantproject-developers] QuantProject/b2_DataAccess/Tables FinancialValues.cs, 1.1, 1.2
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2011-01-16 18:10:38
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31767 Modified Files: FinancialValues.cs Log Message: Added methods for retrieving fundamentals (financial values) for tickers Index: FinancialValues.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/FinancialValues.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FinancialValues.cs 20 Nov 2010 19:01:00 -0000 1.1 --- FinancialValues.cs 16 Jan 2011 18:10:30 -0000 1.2 *************** *** 49,53 **** this.financialValues = FinancialValues.GetTickerFinancialValues( ticker, periodLengthInMonths ); } ! /// <summary> /// It provides addition of the given financial values into table "financial values" --- 49,53 ---- this.financialValues = FinancialValues.GetTickerFinancialValues( ticker, periodLengthInMonths ); } ! /// <summary> /// It provides addition of the given financial values into table "financial values" *************** *** 73,77 **** } } ! /// <summary> /// returns the financial values DataTable for the given ticker --- 73,145 ---- } } ! ! /// <summary> ! /// Returns last available financial value for the given ticker ! /// </summary> ! /// <param name="ticker"></param> ! /// <param name="financialDataCode">Code for the financial value ! /// - stored in DB table </param> ! /// <param name="atDate">Last financial value at the first immediate ! /// date previous than param atDate will be returned</param> ! /// <returns></returns> ! public static double GetLastFinancialValueForTicker( string ticker, int financialDataCode, ! int periodLengthInMonths, ! DateTime atDate ) ! { ! string sqlString = "select * from financialValues where fvTiTicker='" + ticker + "' " + ! "AND fvFdId=" + financialDataCode + " " + ! "AND fvPeriodLengthInMonths=" + periodLengthInMonths + " " + ! "AND fvEndingPeriodDate<" + SQLBuilder.GetDateConstant(atDate) + " " + ! "order by fvEndingPeriodDate"; ! DataTable dataTable = SqlExecutor.GetDataTable(sqlString); ! int numOfRows = dataTable.Rows.Count; ! ! return (double)(dataTable.Rows[ numOfRows - 1 ][ "fvValue" ]); ! } ! /// <summary> ! /// Returns last available financial values for the given ticker ! /// </summary> ! /// <param name="ticker"></param> ! /// <param name="financialDataCode">Code for the financial value ! /// - stored in DB table </param> ! /// <param name="atDate">Last financial values with endingPeriodDate ! /// previous than param atDate will be returned</param> ! /// <returns></returns> ! public static DataTable GetLastFinancialValuesForTicker( string ticker, int financialDataCode, ! int periodLengthInMonths, ! DateTime atDate ) ! { ! string sqlString = "select * from financialValues where fvTiTicker='" + ticker + "' " + ! "AND fvFdId=" + financialDataCode + " " + ! "AND fvPeriodLengthInMonths=" + periodLengthInMonths + " " + ! "AND fvEndingPeriodDate<" + SQLBuilder.GetDateConstant(atDate) + " " + ! "order by fvEndingPeriodDate"; ! ! DataTable dataTable = SqlExecutor.GetDataTable(sqlString); ! ! return dataTable; ! } ! /// <summary> ! /// Returns last available financial values for all tickers ! /// </summary> ! /// <param name="financialDataCode">Code for the financial value ! /// - stored in DB table </param> ! /// <param name="atDate">Last financial values with endingPeriodDate ! /// previous than param atDate will be returned</param> ! /// <returns></returns> ! public static DataTable GetLastFinancialValues(int financialDataCode, ! int periodLengthInMonths, ! DateTime atDate ) ! { ! string sqlString = "select * from financialValues where fvFdId=" + financialDataCode + " " + ! "AND fvPeriodLengthInMonths=" + periodLengthInMonths + " " + ! "AND fvEndingPeriodDate<" + SQLBuilder.GetDateConstant(atDate) + " " + ! "order by fvEndingPeriodDate"; ! ! DataTable dataTable = SqlExecutor.GetDataTable(sqlString); ! ! return dataTable; ! } ! /// <summary> /// returns the financial values DataTable for the given ticker |