quantproject-developers Mailing List for QuantProject (Page 4)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Marco M. <mi...@us...> - 2011-08-21 12:42:23
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/VirtualQuotesProviding
In directory vz-cvs-3.sog:/tmp/cvs-serv13380
Added Files:
ContrarianVirtualQuoteProvider.cs
Log Message:
Added ContrarianVirtualQuoteProvider, providing quotes for a derivedVirtual ticker based on a given formula (the result is similar to shorting the underlying ticker)
--- NEW FILE: ContrarianVirtualQuoteProvider.cs ---
/*
QuantProject - Quantitative Finance Library
ContrarianVirtualQuoteProvider.cs
Copyright (C) 2011
Marco Milletti
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using QuantProject.Business.DataProviders;
namespace QuantProject.Business.DataProviders.VirtualQuotesProviding
{
/// <summary>
/// This class implements IVirtualQuotesProvider interface in such a way
/// that, given a real underlying ticker (A), it returns quotes based on the
/// given formula:
/// set a = return of A (underlying real ticker) in interval p;
/// set z = return of Z (virtual ticker) in p;
/// z = - a /(a + 1)
/// With this z, having set the following:
/// "pEA" = equity invested in A a the beginning of p;
/// "EAp" = equity invested in A a the end of p;
/// rA = EAp / pEA
/// "pEZ" = equity invested in Z a the beginning of p;
/// "ZAp" = equity invested in Z a the end of p;
/// We have the following equality:
/// rZ = EZp / pEZ = 1 / rA
/// </summary>
[Serializable]
public class ContrarianVirtualQuoteProvider : IVirtualQuotesProvider
{
private HistoricalBarProvider historicalBarProvider;
private HistoricalRawQuoteProvider historicalRawQuoteProvider;
private HistoricalAdjustedQuoteProvider historicalAdjustedQuoteProvider;
public ContrarianVirtualQuoteProvider(List<VirtualTicker> )
{
this.historicalBarProvider = historicalBarProvider;
this.historicalRawQuoteProvider = historicalRawQuoteProvider;
this.historicalAdjustedQuoteProvider = historicalAdjustedQuoteProvider;
}
protected override string getDescription()
{
return "adjustedBarProvider";
}
#region GetMarketValue
private double getAdjustmenFactor( string ticker , DateTime dateTime )
{
DateTime marketCloseDateTime = HistoricalEndOfDayTimer.GetMarketClose( dateTime );
double rawClose = this.historicalRawQuoteProvider.GetMarketValue(
ticker , marketCloseDateTime );
double adjustedClose = this.historicalAdjustedQuoteProvider.GetMarketValue(
ticker , marketCloseDateTime );
double adjustmentFactor = adjustedClose / rawClose;
return adjustmentFactor;
}
public override double GetMarketValue( string ticker , DateTime dateTime )
{
double adjustmentFactor = this.getAdjustmenFactor( ticker , dateTime );
double marketValue = double.NaN;
try
{
marketValue = this.historicalBarProvider.GetMarketValue(
ticker , dateTime ) * adjustmentFactor;
}
catch( MissingBarException missingBarException )
{
string forBreakPoint = missingBarException.Message; forBreakPoint += " ";
throw new TickerNotExchangedException( ticker , dateTime );
}
return marketValue;
}
#endregion GetMarketValue
public override bool WasExchanged( string ticker, DateTime dateTime )
{
bool wasExchanged =
this.historicalBarProvider.WasExchanged( ticker , dateTime );
return wasExchanged;
}
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 12:39:46
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/VirtualQuotesProviding
In directory vz-cvs-3.sog:/tmp/cvs-serv13314
Added Files:
ShortVirtualQuoteProvider.cs
Log Message:
Added ShortVirtualQuoteProvider, providing quotes for a derivedVirtual that are just the opposite of an underlying ticker (the derived virtual ticker is based on)
--- NEW FILE: ShortVirtualQuoteProvider.cs ---
/*
QuantProject - Quantitative Finance Library
ShortVirtualQuoteProvider.cs
Copyright (C) 2011
Marco Milletti
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using QuantProject.DataAccess.Tables;
using QuantProject.Business.DataProviders;
namespace QuantProject.Business.DataProviders.VirtualQuotesProviding
{
/// <summary>
/// This class implements IVirtualQuotesProvider interface in such a way
/// that virtual quotes for the given virtual ticker
/// are such that corresponding returns are just
/// the opposite of underlyingRealTickers'returns
/// (buying the virtual ticker is equivalent
/// to shorting the underlying real ticker)
/// </summary>
[Serializable]
public class ShortVirtualQuoteProvider : BasicDerivedVirtualQuoteProvider
{
private int numberOfMarketDaysForBaseFixingBeforeCurrentDate;
private DateTime closeDateTimeAsBase;
public ShortVirtualQuoteProvider(IList<DerivedVirtualTicker> derivedVirtualTickers,
HistoricalMarketValueProvider historicalMarketValueProvider,
int numberOfMarketDaysForBaseFixingBeforeCurrentDate) :
base(derivedVirtualTickers, historicalMarketValueProvider)
{
if(numberOfMarketDaysForBaseFixingBeforeCurrentDate <= 0)
throw new Exception("numberOfMarketDaysForBaseFixingBeforeCurrentDate has to be " +
"greater than 0!");
this.numberOfMarketDaysForBaseFixingBeforeCurrentDate =
numberOfMarketDaysForBaseFixingBeforeCurrentDate;
}
public ShortVirtualQuoteProvider(IList<DerivedVirtualTicker> derivedVirtualTickers,
HistoricalMarketValueProvider historicalMarketValueProvider,
DateTime closeDateTimeAsBase) :
base(derivedVirtualTickers, historicalMarketValueProvider)
{
this.numberOfMarketDaysForBaseFixingBeforeCurrentDate = 0;
this.closeDateTimeAsBase = closeDateTimeAsBase;
}
protected override DateTime getCloseDateTimeAsBase(string realTicker,
DateTime currentDateTime)
{
if(this.numberOfMarketDaysForBaseFixingBeforeCurrentDate != 0)
//the closeDateTime chosen as a base is a moving one
{
QuantProject.Data.DataTables.Quotes realTickerQuotes =
new QuantProject.Data.DataTables.Quotes(realTicker, currentDateTime.AddDays(-2 * this.numberOfMarketDaysForBaseFixingBeforeCurrentDate),
currentDateTime);
DateTime baseDate =
realTickerQuotes.GetPrecedingDate(currentDateTime, this.numberOfMarketDaysForBaseFixingBeforeCurrentDate);
this.closeDateTimeAsBase = new DateTime(baseDate.Year, baseDate.Month, baseDate.Day,
16, 0, 0);
}
return this.closeDateTimeAsBase;
}
protected override double getVirtualQuoteActually(double firstQuoteOfUnderlyingRealTicker,
double currentQuoteOfUnderlyingRealTicker,
double firstQuoteOfVirtualTicker)
{
double returnValue;
double returnForUnderlyingTicker =
(currentQuoteOfUnderlyingRealTicker - firstQuoteOfUnderlyingRealTicker) /
firstQuoteOfUnderlyingRealTicker;
returnValue = (1.0 - returnForUnderlyingTicker) *
firstQuoteOfVirtualTicker;
return returnValue;
}
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 12:36:53
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/VirtualQuotesProviding
In directory vz-cvs-3.sog:/tmp/cvs-serv12188
Added Files:
BasicDerivedVirtualQuoteProvider.cs
Log Message:
Added BasicDerivedVirtualQuoteProvider, for a basic abstract implementation of IVirtualQuotesProvider.
--- NEW FILE: BasicDerivedVirtualQuoteProvider.cs ---
/*
QuantProject - Quantitative Finance Library
BasicDerivedVirtualQuoteProvider.cs
Copyright (C) 2011
Marco Milletti
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using QuantProject.DataAccess.Tables;
using QuantProject.Business.DataProviders;
namespace QuantProject.Business.DataProviders.VirtualQuotesProviding
{
/// <summary>
/// This abstract class implements IVirtualQuotesProvider interface in such a way
/// that there is a function that returns a quote for each given virtual ticker.
/// The input data for the (abstract) function are:
/// - firstQuoteOfUnderlyingRealTicker,
/// - currentQuoteOfUnderlyingRealTicker,
/// - firstQuoteOfVirtualTicker
/// </summary>
[Serializable]
public abstract class BasicDerivedVirtualQuoteProvider : IVirtualQuotesProvider
{
protected HistoricalMarketValueProvider historicalMarketValueProvider;
protected IList<DerivedVirtualTicker> derivedVirtualTickers;
public BasicDerivedVirtualQuoteProvider(IList<DerivedVirtualTicker> derivedVirtualTickers,
HistoricalMarketValueProvider historicalMarketValueProvider)
{
this.derivedVirtualTickers = derivedVirtualTickers;
this.historicalMarketValueProvider = historicalMarketValueProvider;
}
protected virtual string getDescription()
{
return "drvdVrtlQuotesPrvdr";
}
//returns -1 if no item in the IList member
//contains virtualTicker; otherwise
//returns the index of the first item
//that contains virtualTicker
private int getIndexOfTheFirstItemContainingVirtualTicker(string virtualTicker)
{
int returnValue = -1;
for( int i = 0;
i < this.derivedVirtualTickers.Count && returnValue == -1;
i++ )
if( this.derivedVirtualTickers[i].VirtualCodeForTicker == virtualTicker )
returnValue = i;
return returnValue;
}
public virtual bool Contains( string virtualTicker )
{
bool returnValue = false;
int idxOfVirtualTicker =
this.getIndexOfTheFirstItemContainingVirtualTicker(virtualTicker);
if( idxOfVirtualTicker >= 0 )
returnValue = true;
return returnValue;
}
//analogous to WasExchanged method in HistoricalMarketValueProvider class
public virtual bool IsAvailable( string virtualTicker,
DateTime dateTime )
{
bool returnValue = false;
int idxOfItemContainingVirtualTicker =
this.getIndexOfTheFirstItemContainingVirtualTicker(virtualTicker);
if( idxOfItemContainingVirtualTicker >= 0 )
returnValue =
this.historicalMarketValueProvider.WasExchanged(
this.derivedVirtualTickers[idxOfItemContainingVirtualTicker].UnderlyingRealTicker,
dateTime);
return returnValue;
}
protected abstract double getVirtualQuoteActually(double firstQuoteOfUnderlyingRealTicker,
double currentQuoteOfUnderlyingRealTicker,
double firstQuoteOfVirtualTicker);
protected abstract DateTime getCloseDateTimeAsBase(string realTicker,
DateTime currentDateTime);
public virtual double GetVirtualQuote( string virtualTicker ,
DateTime dateTime,
HistoricalMarketValueProvider historicalMarketValueProvider)
{
double returnValue;
int idxOfDerivedVirtualTicker =
this.getIndexOfTheFirstItemContainingVirtualTicker(virtualTicker);
string realTicker =
this.derivedVirtualTickers[idxOfDerivedVirtualTicker].UnderlyingRealTicker;
DateTime closeDateTimeAsBase = this.getCloseDateTimeAsBase(realTicker, dateTime);
double firstQuoteOfUnderlyingRealTicker =
this.historicalMarketValueProvider.GetMarketValue(realTicker,
closeDateTimeAsBase);
double currentQuoteOfUnderlyingRealTicker =
this.historicalMarketValueProvider.GetMarketValue(realTicker,
dateTime);
double firstQuoteOfVirtualTicker =
this.derivedVirtualTickers[idxOfDerivedVirtualTicker].FirstVirtualQuote;
returnValue = this.getVirtualQuoteActually(firstQuoteOfUnderlyingRealTicker,
currentQuoteOfUnderlyingRealTicker,
firstQuoteOfVirtualTicker);
return returnValue;
}
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 12:34:11
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/VirtualQuotesProviding
In directory vz-cvs-3.sog:/tmp/cvs-serv12089
Added Files:
IVirtualQuotesProvider.cs
Log Message:
Added IVirtualQuotesProvider, interface to be implemented by objects providing virtual quotes for tickers whose quotes are not stored in the DB
--- NEW FILE: IVirtualQuotesProvider.cs ---
/*
QuantProject - Quantitative Finance Library
IVirtualQuotesProvider.cs
Copyright (C) 2011
Marco Milletti
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
using System;
namespace QuantProject.Business.DataProviders.VirtualQuotesProviding
{
/// <summary>
/// Interface to be implemented by objects providing
/// virtual quotes for tickers (real or not) whose
/// quotes are not stored in the DB
/// </summary>
public interface IVirtualQuotesProvider
{
/// <summary>
/// Returns a virtual quote for the given virtual ticker
/// </summary>
/// <param name="virtualTicker">Ticker for which virtual quotes
/// are provided (virtual = not stored in DB)</param>
/// <param name="dateTime"></param>
/// <param name="historicalMarketValueProvider">The historical market value provider
/// providing real quotes on which virtual quote are based</param>
/// <returns></returns>
double GetVirtualQuote( string virtualTicker ,
DateTime dateTime,
HistoricalMarketValueProvider historicalMarketValueProvider);
// /// <summary>
// /// returns the ticker with real quotes that
// /// are used by the provider for computing
// /// the virtual quote
// /// </summary>
// /// <param name="virtualTicker">The virtual ticker for which virtual quotes
// /// are provided (virtual = not stored in DB)</param>
// /// <returns></returns>
// string GetUnderlyingTicker ( string virtualTicker );
/// <summary>
/// returns bool if the ticker is contained in
/// the current IVirtualQuotesProvider
/// </summary>
/// <param name="virtualTicker">Ticker for which virtual quotes
/// are provided (virtual = not stored in DB)</param>
bool Contains ( string virtualTicker );
/// <summary>
/// True iif the quote of the given virtual ticker
/// is available at the given DateTime
/// (nalogous to WasExchanged method in HistoricalMarketValueProvider class)
/// </summary>
/// <param name="virtualTicker"></param>
/// <param name="dateTime"></param>
/// <returns></returns>
bool IsAvailable( string virtualTicker , DateTime dateTime );
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 12:32:13
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/VirtualQuotesProviding
In directory vz-cvs-3.sog:/tmp/cvs-serv12050
Added Files:
DerivedVirtualTicker.cs
Log Message:
Struct used for the definition of a virtual ticker (not real, that is to say not stored in the DB) derived from an underlying real ticker (stored in the DB)
--- NEW FILE: DerivedVirtualTicker.cs ---
/*
QuantProject - Quantitative Finance Library
DerivedVirtualTicker.cs
Copyright (C) 2011
Marco Milletti
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using QuantProject.DataAccess.Tables;
using QuantProject.Business.Timing;
namespace QuantProject.Business.DataProviders.VirtualQuotesProviding
{
/// <summary>
/// Struct used for the definition of a virtual ticker derived
/// from an underlying ticker (real)
/// </summary>
[Serializable]
public struct DerivedVirtualTicker
{
private string virtualCodeForTicker;
public string VirtualCodeForTicker
{
get
{
return this.virtualCodeForTicker;
}
}
private string underlyingRealTicker;
public string UnderlyingRealTicker
{
get
{
return this.underlyingRealTicker;
}
}
private double firstVirtualQuote;
public double FirstVirtualQuote
{
get
{
return this.firstVirtualQuote;
}
}
private void derivedVirtualTicker_checkParameters(string virtualCodeForTicker,
string underlyingRealTicker,
double firstVirtualQuote)
{
int numberOfQuotesOfVirtualTickerCodeInDB =
Quotes.GetNumberOfQuotes(virtualCodeForTicker);
if(numberOfQuotesOfVirtualTickerCodeInDB > 0)
throw new Exception("The code for virtual ticker is the same " +
"as a real ticker - with some quotes in DB: " +
"it's necessary to choose a different virtualCode " +
"for the creation of a valid DerivedVirtualTicker instance");
int numberOfQuotesOfUnderlyingRealTickerInDB =
Quotes.GetNumberOfQuotes(underlyingRealTicker);
if(numberOfQuotesOfUnderlyingRealTickerInDB == 0)
throw new Exception("The underlyingRealTicker has no quotes " +
"in the DB: " +
"it's necessary to choose another underlyingRealTicker code " +
"for the creation of a valid DerivedVirtualTicker instance");
if(firstVirtualQuote <= 0)
throw new Exception("The first - conventional - quote " +
"for the virtual ticker " +
"has to be greater than 0!");
}
public DerivedVirtualTicker( string virtualCodeForTicker,
string underlyingRealTicker,
double firstVirtualQuote)
{
this.virtualCodeForTicker = virtualCodeForTicker;
this.underlyingRealTicker = underlyingRealTicker;
this.firstVirtualQuote = firstVirtualQuote;
this.derivedVirtualTicker_checkParameters(virtualCodeForTicker,
underlyingRealTicker,
firstVirtualQuote);
}
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 12:28:48
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/VirtualQuotesProviding In directory vz-cvs-3.sog:/tmp/cvs-serv11954/VirtualQuotesProviding Log Message: Directory /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/VirtualQuotesProviding added to the repository |
|
From: Marco M. <mi...@us...> - 2011-08-21 11:46:16
|
Update of /cvsroot/quantproject/QuantProject/b3_Data
In directory vz-cvs-3.sog:/tmp/cvs-serv7434
Modified Files:
Data_SD.csproj
Log Message:
Updated Data project file
Index: Data_SD.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Data_SD.csproj,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Data_SD.csproj 16 Jan 2011 19:52:31 -0000 1.10
--- Data_SD.csproj 21 Aug 2011 11:46:14 -0000 1.11
***************
*** 70,73 ****
--- 70,74 ----
<Compile Include="Selectors\ITickerRemover.cs" />
<Compile Include="Selectors\ITickerSelector.cs" />
+ <Compile Include="Selectors\ITickerSelectorByDate.cs" />
<Compile Include="Selectors\ITickerSelectorByGroup.cs" />
<Compile Include="Selectors\SelectorByAbsolutePerformance.cs" />
***************
*** 76,79 ****
--- 77,81 ----
<Compile Include="Selectors\SelectorByCloseToCloseLinearCorrelation.cs" />
<Compile Include="Selectors\SelectorByCloseToCloseVolatility.cs" />
+ <Compile Include="Selectors\SelectorByGroupLiquidityAndPrice.cs" />
<Compile Include="Selectors\SelectorByIntradayQuotationAtEachMarketDay.cs" />
<Compile Include="Selectors\SelectorByLiquidity.cs" />
***************
*** 81,84 ****
--- 83,87 ----
<Compile Include="Selectors\SelectorByOpenToCloseLinearCorrelation.cs" />
<Compile Include="Selectors\SelectorByOpenToCloseVolatility.cs" />
+ <Compile Include="Selectors\SelectorByPE.cs" />
<Compile Include="Selectors\SelectorByQuotationAtAGivenPercentageOfDateTimes.cs" />
<Compile Include="Selectors\SelectorByQuotationAtEachMarketDay.cs" />
|
|
From: Marco M. <mi...@us...> - 2011-08-21 11:45:44
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors
In directory vz-cvs-3.sog:/tmp/cvs-serv7402/Selectors
Added Files:
SelectorByPE.cs
Log Message:
Added SelectorByPE, implementing ITickerSelector, for selection by using the PE ratio (Price Earnings ratio)
--- NEW FILE: SelectorByPE.cs ---
/*
QuantProject - Quantitative Finance Library
SelectorByPE.cs
Copyright (C) 2011
Marco Milletti
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Collections;
using System.Data;
using System.Windows.Forms;
using QuantProject.ADT.Histories;
using QuantProject.DataAccess.Tables;
using QuantProject.Data.DataTables;
namespace QuantProject.Data.Selectors
{
/// <summary>
/// Class for selection on tickers by using the popular PE ratio
/// </summary>
public class SelectorByPE : TickerSelector , ITickerSelector
{
private double minPE;
private double maxPE;
private int numDaysForFundamentalDataAvailability;
public SelectorByPE(DataTable setOfTickersToBeSelected,
DateTime firstQuoteDate,
DateTime lastQuoteDate,
double minPE,
double maxPE,
int maxNumberOfEligibleTickersToBeChosen,
bool orderInASCmode):
base(setOfTickersToBeSelected,
orderInASCmode,
firstQuoteDate,
lastQuoteDate,
maxNumberOfEligibleTickersToBeChosen)
{
this.minPE = minPE;
this.maxPE = maxPE;
this.numDaysForFundamentalDataAvailability = 45;
}
#region GetTableOfSelectedTickers
public DataTable GetTableOfSelectedTickers()
{
if(!this.setOfTickersToBeSelected.Columns.Contains("LastAvailableAveragePE"))
this.setOfTickersToBeSelected.Columns.Add("LastAvailableAveragePE", System.Type.GetType("System.Double"));
// returnValue.Columns.Add("AverageOpenPrice", System.Type.GetType("System.Double"));
// returnValue.Columns.Add("LastAvailableEarnings", System.Type.GetType("System.Double"));
foreach(DataRow row in this.setOfTickersToBeSelected.Rows)
{
try
{
row["LastAvailableAveragePE"] = FinancialValues.GetLastFinancialValueForTicker((string)row[0],
FinancialValueType.AveragePriceEarnings, 12, this.lastQuoteDate.AddDays(-this.numDaysForFundamentalDataAvailability));
}
catch(Exception ex){string str = ex.Message;}
}
string filterString =
"LastAvailableAveragePE is not null AND " +
"LastAvailableAveragePE >= " + this.minPE.ToString() +
" AND LastAvailableAveragePE <= " + this.maxPE.ToString();
DataTable getTickersByPE =
ExtendedDataTable.CopyAndSort(this.setOfTickersToBeSelected,
filterString, "LastAvailableAveragePE", this.isOrderedInASCMode);
ExtendedDataTable.DeleteRows(getTickersByPE, maxNumOfReturnedTickers);
string[] getTickersByPEForDebugging =
ExtendedDataTable.GetArrayOfStringFromRows(getTickersByPE);
return getTickersByPE;
}
#endregion GetTableOfSelectedTickers
public void SelectAllTickers()
{
;
}
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 11:43:29
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors
In directory vz-cvs-3.sog:/tmp/cvs-serv7296/Selectors
Added Files:
SelectorByGroupLiquidityAndPrice.cs
Log Message:
Added SelectorByGroupLiquidityAndPrice, implementing ITickerSelectorByDate, for selection on tickers by group, liquidity and price
--- NEW FILE: SelectorByGroupLiquidityAndPrice.cs ---
/*
QuantProject - Quantitative Finance Library
SelectorByGroupLiquidityAndPrice.cs
Copyright (C) 2011
Marco Milletti
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Collections;
using System.Data;
using System.Windows.Forms;
using QuantProject.DataAccess.Tables;
using QuantProject.Data.DataTables;
using QuantProject.Data.Selectors;
namespace QuantProject.Data.Selectors
{
/// <summary>
/// Class for selection on tickers by group, liquidity and price,
/// implementing ITickerSelectorByDate interface
/// </summary>
[Serializable]
public class SelectorByGroupLiquidityAndPrice : ITickerSelectorByDate
{
private string groupID;
private bool temporizedGroup;
private bool orderInASCmode;
private int lengthInDaysOfPreviousPeriodFromCurrentDate;
private int maxNumOfReturnedTickers;
private int numberOfTopRowsToDelete;
private int numDaysForAveragePriceComputation;
private double minPrice;
private DateTime dateTimeOfCurrentSelection;
private DataTable currentSelection;
/// <summary>
/// ITickerSelectorByDate class for selecting tickers
/// by group, liquidity and price
/// </summary>
/// <param name="groupID">Group containing
/// tickers that have to be selected</param>
/// <param name="temporizedGroup">choose true if the set of tickers belonging
/// to the group depends on time </param>
/// <param name="orderInASCmode">In each step of the selecting process,
/// if true, returned tickers
/// are ordered in Ascending mode - from less to most. If false
/// , returned tickers are ordered in descending mode - from most to less.</param>
/// <param name="lengthInDaysOfPreviousPeriodFromCurrentDate">The lenght in days
/// of the time window - before current time - the selection
/// process takes into account </param>
/// <param name="maxNumOfReturnedTickers">Max number of selected
/// tickers to be returned</param>
/// <returns></returns>
public SelectorByGroupLiquidityAndPrice(string groupID, bool temporizedGroup,
bool orderInASCmode,
int lengthInDaysOfPreviousPeriodFromCurrentDate,
int maxNumOfReturnedTickers,
int numberOfTopRowsToDelete,
int numDaysForAveragePriceComputation,
double minPrice)
{
this.groupID = groupID;
this.temporizedGroup = temporizedGroup;
this.orderInASCmode = orderInASCmode;
this.lengthInDaysOfPreviousPeriodFromCurrentDate =
lengthInDaysOfPreviousPeriodFromCurrentDate;
this.maxNumOfReturnedTickers = maxNumOfReturnedTickers;
this.numberOfTopRowsToDelete = numberOfTopRowsToDelete;
this.numDaysForAveragePriceComputation = numDaysForAveragePriceComputation;
this.minPrice = minPrice;
this.dateTimeOfCurrentSelection = new DateTime(1900,1,1,16,0,0);
}
private void getTableOfSelectedTickers_updateCurrentSelection(DateTime currentDate)
{
SelectorByGroup group;
if(this.temporizedGroup)
//the group is "temporized": returned set of tickers
// depends on time
group = new SelectorByGroup(this.groupID,
currentDate);
else//the group is not temporized
group = new SelectorByGroup(this.groupID);
DataTable tickersFromGroup = group.GetTableOfSelectedTickers();
string[] tickersFromGroupForDebugging =
ExtendedDataTable.GetArrayOfStringFromRows(tickersFromGroup);
SelectorByLiquidity mostLiquidSelector =
new SelectorByLiquidity( tickersFromGroup, false,
currentDate.AddDays(-this.lengthInDaysOfPreviousPeriodFromCurrentDate),
currentDate, 10, this.maxNumOfReturnedTickers, this.numberOfTopRowsToDelete);
DataTable dataTableMostLiquid = mostLiquidSelector.GetTableOfSelectedTickers();
string[] tickersFromMostLiquidForDebugging =
ExtendedDataTable.GetArrayOfStringFromRows(dataTableMostLiquid);
SelectorByAverageRawOpenPrice byPrice =
new SelectorByAverageRawOpenPrice(dataTableMostLiquid, false,
currentDate.AddDays(-this.lengthInDaysOfPreviousPeriodFromCurrentDate),
currentDate,
this.maxNumOfReturnedTickers,
this.minPrice, 10000, 0.00001, 10000);
this.currentSelection = byPrice.GetTableOfSelectedTickers();
this.dateTimeOfCurrentSelection = currentDate;
string[] tickersFromMinPriceForDebugging =
ExtendedDataTable.GetArrayOfStringFromRows(this.currentSelection);
}
public DataTable GetTableOfSelectedTickers(DateTime currentDate)
{
if(currentDate != this.dateTimeOfCurrentSelection ||
this.currentSelection == null)
this.getTableOfSelectedTickers_updateCurrentSelection(currentDate);
return this.currentSelection;
}
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 11:40:14
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors
In directory vz-cvs-3.sog:/tmp/cvs-serv6035/Selectors
Modified Files:
SelectorByQuotationAtAGivenPercentageOfDateTimes.cs
Log Message:
The class has been updated (minor changes)
Index: SelectorByQuotationAtAGivenPercentageOfDateTimes.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectorByQuotationAtAGivenPercentageOfDateTimes.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SelectorByQuotationAtAGivenPercentageOfDateTimes.cs 14 Nov 2008 15:51:18 -0000 1.2
--- SelectorByQuotationAtAGivenPercentageOfDateTimes.cs 21 Aug 2011 11:40:12 -0000 1.3
***************
*** 97,104 ****
private DataTable getTableOfSelectedTickers_givenDateTimes()
{
! DataTable dataTable =
! QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes(
! this.marketDateTimes , this.percentageOfDateTimes , this.setOfTickersToBeSelected , this.firstQuoteDate ,
! this.lastQuoteDate , this.intervalFrameInSeconds , this.maxNumOfReturnedTickers );
return dataTable;
}
--- 97,111 ----
private DataTable getTableOfSelectedTickers_givenDateTimes()
{
! DataTable dataTable;
! if( this.intervalFrameInSeconds == 0 )
! // EOD data, then quotes is needed
! dataTable = QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes(
! this.marketDateTimes , this.percentageOfDateTimes , this.setOfTickersToBeSelected , this.firstQuoteDate ,
! this.lastQuoteDate , this.maxNumOfReturnedTickers );
! else //bars is needed
! dataTable = QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes(
! this.marketDateTimes , this.percentageOfDateTimes , this.setOfTickersToBeSelected , this.firstQuoteDate ,
! this.lastQuoteDate , this.intervalFrameInSeconds , this.maxNumOfReturnedTickers );
!
return dataTable;
}
***************
*** 107,120 ****
if(this.marketIndex == "")
throw new Exception("You first need to set TickerSelector's property <<MarketIndex>>!");
!
if(this.setOfTickersToBeSelected == null)
! return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes(
! this.marketIndex, this.percentageOfDateTimes , this.groupID, this.firstQuoteDate, this.lastQuoteDate,
! this.intervalFrameInSeconds, this.maxNumOfReturnedTickers);
!
! else
! return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes(
! this.marketIndex, this.percentageOfDateTimes , this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate,
! this.intervalFrameInSeconds, this.maxNumOfReturnedTickers);
}
public DataTable GetTableOfSelectedTickers()
--- 114,147 ----
if(this.marketIndex == "")
throw new Exception("You first need to set TickerSelector's property <<MarketIndex>>!");
! DataTable returnValue;
if(this.setOfTickersToBeSelected == null)
! {
! if( this.intervalFrameInSeconds == 0 )
! // EOD data, then quotes is needed
! {
! DataTable setOfTickers =
! QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers(this.groupID);
! returnValue = QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes(
! this.marketIndex, this.percentageOfDateTimes , setOfTickers , this.firstQuoteDate, this.lastQuoteDate,
! this.maxNumOfReturnedTickers);
! }
! else//this.setOfTickersToBeSelected is null AND quotes is used
! returnValue = QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes(
! this.marketIndex, this.percentageOfDateTimes , this.groupID, this.firstQuoteDate, this.lastQuoteDate,
! this.intervalFrameInSeconds, this.maxNumOfReturnedTickers);
! }
! else//this.setOfTickersToBeSelected is not null
! {
! if( this.intervalFrameInSeconds == 0 )
! // EOD data, then quotes is needed
! returnValue = QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes(
! this.marketIndex, this.percentageOfDateTimes , this.setOfTickersToBeSelected , this.firstQuoteDate, this.lastQuoteDate,
! this.maxNumOfReturnedTickers);
! else//this.setOfTickersToBeSelected is not null and bars is used
! returnValue = QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes(
! this.marketIndex, this.percentageOfDateTimes , this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate,
! this.intervalFrameInSeconds, this.maxNumOfReturnedTickers);
! }
! return returnValue;
}
public DataTable GetTableOfSelectedTickers()
|
|
From: Marco M. <mi...@us...> - 2011-08-21 11:37:37
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors
In directory vz-cvs-3.sog:/tmp/cvs-serv5939/Selectors
Modified Files:
SelectorByNumOfMinGrowingIncomesInARow.cs
Log Message:
The class now uses FinancialValueType enum
Index: SelectorByNumOfMinGrowingIncomesInARow.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectorByNumOfMinGrowingIncomesInARow.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SelectorByNumOfMinGrowingIncomesInARow.cs 16 Jan 2011 18:26:07 -0000 1.1
--- SelectorByNumOfMinGrowingIncomesInARow.cs 21 Aug 2011 11:37:35 -0000 1.2
***************
*** 95,99 ****
incomesForCurrentTicker =
FinancialValues.GetLastFinancialValuesForTicker(currentTicker,
! 40, 12, this.lastQuoteDate.AddDays(-this.numDaysForFundamentalDataAvailability));
if( this.getTableOfSelectedTickers_areIncomesAllGreaterThanMinimum(incomesForCurrentTicker) )
{
--- 95,99 ----
incomesForCurrentTicker =
FinancialValues.GetLastFinancialValuesForTicker(currentTicker,
! FinancialValueType.NetIncome, 12, this.lastQuoteDate.AddDays(-this.numDaysForFundamentalDataAvailability));
if( this.getTableOfSelectedTickers_areIncomesAllGreaterThanMinimum(incomesForCurrentTicker) )
{
|
|
From: Marco M. <mi...@us...> - 2011-08-21 11:36:17
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors
In directory vz-cvs-3.sog:/tmp/cvs-serv5897/Selectors
Modified Files:
SelectorByGroup.cs
Log Message:
Now SelectorByGroup implements also ITickerSelectorByDate
Index: SelectorByGroup.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectorByGroup.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SelectorByGroup.cs 27 Mar 2010 17:31:33 -0000 1.3
--- SelectorByGroup.cs 21 Aug 2011 11:36:15 -0000 1.4
***************
*** 33,40 ****
/// Class for selection on tickers by groupId only or groupId and date
/// </summary>
! public class SelectorByGroup : ITickerSelector
{
private string groupID;
private DateTime date = new DateTime(1900,1,1);
/// <summary>
--- 33,42 ----
/// Class for selection on tickers by groupId only or groupId and date
/// </summary>
! [Serializable]
! public class SelectorByGroup : ITickerSelector, ITickerSelectorByDate
{
private string groupID;
private DateTime date = new DateTime(1900,1,1);
+ private bool temporizedGroup = false;
/// <summary>
***************
*** 53,56 ****
--- 55,71 ----
/// </summary>
/// <param name="groupID">Group's code for which tickers are to be selected</param>
+ /// <param name="temporizedGroup">If true, the selection depends on
+ /// the time of request</param>
+ public SelectorByGroup( string groupID, bool temporizedGroup )
+ {
+ this.groupID = groupID;
+ this.temporizedGroup = temporizedGroup;
+ }
+
+ /// <summary>
+ /// Creates an new instance of SelectorByGroup, in order
+ /// to get tickers contained in the given group
+ /// </summary>
+ /// <param name="groupID">Group's code for which tickers are to be selected</param>
/// <param name="date">The date at which tickers to be selected belong effectively
/// to the given group</param>
***************
*** 69,76 ****
--- 84,103 ----
return QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers( this.groupID, this.date );
}
+
+ public DataTable GetTableOfSelectedTickers(DateTime dateTime)
+ {
+ if(this.temporizedGroup)
+ //date has not be set by the user because it is still equal to default value
+ return QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers( this.groupID, dateTime );
+ else//if not temporized, the selection depends only on groupID
+ return QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers( this.groupID );
+ }
+
public void SelectAllTickers()
{
;
}
+
+
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 11:26:06
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors
In directory vz-cvs-3.sog:/tmp/cvs-serv5390/Selectors
Modified Files:
SelectorByCloseToCloseCorrelationToBenchmark.cs
Log Message:
SelectorByCloseToCloseCorrelationToBenchmark (selecting tickers with adj close quotes correlated to the adj close of a given benchmark) now implements only ITickerSelectorByDate
Index: SelectorByCloseToCloseCorrelationToBenchmark.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectorByCloseToCloseCorrelationToBenchmark.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SelectorByCloseToCloseCorrelationToBenchmark.cs 14 Jan 2008 23:14:41 -0000 1.5
--- SelectorByCloseToCloseCorrelationToBenchmark.cs 21 Aug 2011 11:26:03 -0000 1.6
***************
*** 32,41 ****
/// a given benchmark
/// </summary>
! public class SelectorByCloseToCloseCorrelationToBenchmark : TickerSelector, ITickerSelector
{
private string benchmark;
private bool addBenchmarkToTheGivenSetOfTickers;
/// <summary>
! /// Creates a new instance of the selector
/// </summary>
/// <param name="setOfTickersToBeSelected">The data table containing
--- 32,51 ----
/// a given benchmark
/// </summary>
! [Serializable]
! public class SelectorByCloseToCloseCorrelationToBenchmark : ITickerSelectorByDate
!
{
private string benchmark;
+ private bool orderInASCMode;
+ private int maxNumOfReturnedTickers;
+ private ITickerSelectorByDate tickerSelectorByDateForInitialTable;
+ private int lengthInDaysOfCorrelationPeriod;
private bool addBenchmarkToTheGivenSetOfTickers;
+ private DateTime dateTimeOfCurrentSelection;
+ private DataTable currentSelection;
+
+
/// <summary>
! /// Creates a new instance of the class
/// </summary>
/// <param name="setOfTickersToBeSelected">The data table containing
***************
*** 44,118 ****
/// <param name="benchmark">Benchmark code</param>
/// <param name="orderInASCmode">Ordering mode</param>
- /// <param name="firstQuoteDate">The first date for the interval</param>
- /// <param name="lastQuoteDate">The last date for the interval</param>
/// <param name="maxNumOfReturnedTickers">Max number of tickers to be returned</param>
! public SelectorByCloseToCloseCorrelationToBenchmark(DataTable setOfTickersToBeSelected,
string benchmark,
! bool orderInASCmode,
! DateTime firstQuoteDate,
! DateTime lastQuoteDate,
! long maxNumOfReturnedTickers,
! bool addBenchmarkToTheGivenSetOfTickers):
! base(setOfTickersToBeSelected,
! orderInASCmode,
! firstQuoteDate,
! lastQuoteDate,
! maxNumOfReturnedTickers)
{
! this.benchmark = benchmark;
this.addBenchmarkToTheGivenSetOfTickers = addBenchmarkToTheGivenSetOfTickers;
}
!
! /// <summary>
! /// Creates a new instance of the selector
! /// </summary>
! /// <param name="groupID">The group ID containing the tickers that have to be ordered by Pearson
! /// correlation coefficient to a given benchmark</param>
! /// <param name="benchmark">Benchmark to be used for computation of correlation coefficient</param>
! /// <param name="orderInASCmode">Ordering mode</param>
! /// <param name="firstQuoteDate">The first date for the interval</param>
! /// <param name="lastQuoteDate">The last date for the interval</param>
! /// <param name="maxNumOfReturnedTickers">Max number of tickers to be returned</param>
! /// <param name="addBenchmarkToTheGivenSetOfTickers">If TRUE, the benchmark is added to
! /// output table (with correlation
! /// equal to 1) </param>
! public SelectorByCloseToCloseCorrelationToBenchmark(string groupID,
! string benchmark,
! bool orderInASCmode,
! DateTime firstQuoteDate,
! DateTime lastQuoteDate,
! long maxNumOfReturnedTickers,
! bool addBenchmarkToTheGivenSetOfTickers):
! base(groupID,
! orderInASCmode,
! firstQuoteDate,
! lastQuoteDate,
! maxNumOfReturnedTickers)
! {
! this.benchmark = benchmark;
! this.addBenchmarkToTheGivenSetOfTickers = addBenchmarkToTheGivenSetOfTickers;
! }
!
!
! public DataTable GetTableOfSelectedTickers()
! {
! if(this.setOfTickersToBeSelected == null)
! return this.getTickersByCloseToCloseCorrelationToBenchmark(this.isOrderedInASCMode,
! this.groupID,this.benchmark,
! this.firstQuoteDate, this.lastQuoteDate,
! this.maxNumOfReturnedTickers);
!
! else
! return this.getTickersByCloseToCloseCorrelationToBenchmark(this.isOrderedInASCMode,
! this.setOfTickersToBeSelected,this.benchmark,
! this.firstQuoteDate, this.lastQuoteDate,
! this.maxNumOfReturnedTickers);
! }
! public void SelectAllTickers()
{
! ;
}
! private DataTable getTickersByCloseToCloseCorrelationToBenchmark( bool orderByASC,
DataTable setOfTickers, string benchmark,
DateTime firstQuoteDate,
--- 54,88 ----
/// <param name="benchmark">Benchmark code</param>
/// <param name="orderInASCmode">Ordering mode</param>
/// <param name="maxNumOfReturnedTickers">Max number of tickers to be returned</param>
! public SelectorByCloseToCloseCorrelationToBenchmark(ITickerSelectorByDate tickerSelectorByDateForInitialTable,
! int lengthInDaysOfCorrelationPeriod,
string benchmark,
! bool orderInASCMode,
! int maxNumOfReturnedTickers,
! bool addBenchmarkToTheGivenSetOfTickers)
{
! this.tickerSelectorByDateForInitialTable = tickerSelectorByDateForInitialTable;
! this.lengthInDaysOfCorrelationPeriod = lengthInDaysOfCorrelationPeriod;
! this.benchmark = benchmark;
! this.orderInASCMode = orderInASCMode;
! this.maxNumOfReturnedTickers = maxNumOfReturnedTickers;
this.addBenchmarkToTheGivenSetOfTickers = addBenchmarkToTheGivenSetOfTickers;
+ this.dateTimeOfCurrentSelection = new DateTime(1900,1,1,16,0,0);
}
!
! public DataTable GetTableOfSelectedTickers(DateTime dateTime)
{
! if(dateTime != this.dateTimeOfCurrentSelection ||
! this.currentSelection == null)
! this.getTableOfSelectedTickers_updateCurrentSelection(this.orderInASCMode,
! this.tickerSelectorByDateForInitialTable.GetTableOfSelectedTickers(dateTime),
! this.benchmark,
! dateTime.AddDays(-this.lengthInDaysOfCorrelationPeriod), dateTime,
! this.maxNumOfReturnedTickers);
!
! return this.currentSelection;
}
! private void getTableOfSelectedTickers_updateCurrentSelection( bool orderByASC,
DataTable setOfTickers, string benchmark,
DateTime firstQuoteDate,
***************
*** 122,135 ****
if(!setOfTickers.Columns.Contains("CloseToCloseCorrelationToBenchmark"))
setOfTickers.Columns.Add("CloseToCloseCorrelationToBenchmark", System.Type.GetType("System.Double"));
! float[] benchmarkQuotes = QuantProject.Data.DataTables.Quotes.GetArrayOfAdjustedCloseQuotes(benchmark, firstQuoteDate, lastQuoteDate);
foreach(DataRow row in setOfTickers.Rows)
{
! float[] tickerQuotes = QuantProject.Data.DataTables.Quotes.GetArrayOfAdjustedCloseQuotes((string)row[0],
firstQuoteDate, lastQuoteDate);
! row["CloseToCloseCorrelationToBenchmark"] =
! BasicFunctions.PearsonCorrelationCoefficient(benchmarkQuotes, tickerQuotes);
}
DataTable tableToReturn = ExtendedDataTable.CopyAndSort(setOfTickers,
! "CloseToCloseCorrelationToBenchmark>=0.0 OR " +
"CloseToCloseCorrelationToBenchmark<0.0",
"CloseToCloseCorrelationToBenchmark",
--- 92,110 ----
if(!setOfTickers.Columns.Contains("CloseToCloseCorrelationToBenchmark"))
setOfTickers.Columns.Add("CloseToCloseCorrelationToBenchmark", System.Type.GetType("System.Double"));
! double[] benchmarkQuotes = QuantProject.Data.DataTables.Quotes.GetDoubleArrayOfAdjustedCloseQuotes(benchmark, firstQuoteDate, lastQuoteDate);
! double correlation;
foreach(DataRow row in setOfTickers.Rows)
{
! double[] tickerQuotes = QuantProject.Data.DataTables.Quotes.GetDoubleArrayOfAdjustedCloseQuotes((string)row[0],
firstQuoteDate, lastQuoteDate);
! correlation = 0.0;
! if(benchmarkQuotes.Length == tickerQuotes.Length)
! correlation =
! BasicFunctions.PearsonCorrelationCoefficient(benchmarkQuotes, tickerQuotes);
!
! row["CloseToCloseCorrelationToBenchmark"] = correlation;
}
DataTable tableToReturn = ExtendedDataTable.CopyAndSort(setOfTickers,
! "CloseToCloseCorrelationToBenchmark>0.0 OR " +
"CloseToCloseCorrelationToBenchmark<0.0",
"CloseToCloseCorrelationToBenchmark",
***************
*** 142,163 ****
tableToReturn.Rows.Add(newRow);
}
! return tableToReturn;
! }
!
! private DataTable getTickersByCloseToCloseCorrelationToBenchmark( bool orderByASC,
! string groupID, string benchmark,
! DateTime firstQuoteDate,
! DateTime lastQuoteDate,
! long maxNumOfReturnedTickers)
! {
! DataTable tickersOfGroup = Tickers_tickerGroups.GetTickers(groupID);
! return this.getTickersByCloseToCloseCorrelationToBenchmark(orderByASC,
! tickersOfGroup, benchmark,
! firstQuoteDate,
! lastQuoteDate,
! maxNumOfReturnedTickers);
}
!
}
}
--- 117,139 ----
tableToReturn.Rows.Add(newRow);
}
! this.currentSelection = tableToReturn;
! this.dateTimeOfCurrentSelection = lastQuoteDate;
! string[] currentSelectionForDebugging =
! ExtendedDataTable.GetArrayOfStringFromRows(this.currentSelection);
}
! // private DataTable getTickersByCloseToCloseCorrelationToBenchmark( bool orderByASC,
! // string groupID, string benchmark,
! // DateTime firstQuoteDate,
! // DateTime lastQuoteDate,
! // long maxNumOfReturnedTickers)
! // {
! // DataTable tickersOfGroup = Tickers_tickerGroups.GetTickers(groupID);
! // return this.getTableOfSelectedTickers_updateCurrentSelection(orderByASC,
! // tickersOfGroup, benchmark,
! // firstQuoteDate,
! // lastQuoteDate,
! // maxNumOfReturnedTickers);
! // }
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 11:21:40
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors
In directory vz-cvs-3.sog:/tmp/cvs-serv5219/Selectors
Added Files:
ITickerSelectorByDate.cs
Log Message:
Added ITickerSelectorByDate interface for objects selecting tickers by given dates
--- NEW FILE: ITickerSelectorByDate.cs ---
/*
QuantProject - Quantitative Finance Library
ITickerSelectorByDate.cs
Copyright (C) 2011
Marco Milletti
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Data;
using QuantProject.Data.DataTables;
namespace QuantProject.Data.Selectors
{
/// <summary>
/// Selects tickers by a given date
/// </summary>
public interface ITickerSelectorByDate
{
DataTable GetTableOfSelectedTickers(DateTime dateTime);
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 10:31:44
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors
In directory vz-cvs-3.sog:/tmp/cvs-serv32199/Selectors
Modified Files:
TickerSelector.cs
Log Message:
Added new constructor using ITickerSelectorByDate as parameter
Index: TickerSelector.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/TickerSelector.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** TickerSelector.cs 27 Mar 2010 17:40:53 -0000 1.12
--- TickerSelector.cs 21 Aug 2011 10:31:42 -0000 1.13
***************
*** 27,30 ****
--- 27,31 ----
using System.Windows.Forms;
using QuantProject.DataAccess.Tables;
+ using QuantProject.Data.Selectors;
using QuantProject.Data.DataTables;
***************
*** 37,40 ****
--- 38,42 ----
{
protected DataTable setOfTickersToBeSelected = null;
+ protected ITickerSelectorByDate tickerSelectorByDate = null;
protected string groupID = "";
protected DateTime firstQuoteDate = QuantProject.ADT.ConstantsProvider.InitialDateTimeForDownload;
***************
*** 97,100 ****
--- 99,112 ----
}
+ public TickerSelector(ITickerSelectorByDate tickerSelectorByDate,
+ bool orderInASCmode,
+ DateTime firstQuoteDate,
+ DateTime lastQuoteDate,
+ long maxNumOfReturnedTickers)
+ {
+ this.tickerSelectorByDate = tickerSelectorByDate;
+ this.commonInitialization(orderInASCmode, firstQuoteDate,
+ lastQuoteDate, maxNumOfReturnedTickers);
+ }
public TickerSelector(string groupID,
bool orderInASCmode,
|
|
From: Marco M. <mi...@us...> - 2011-08-21 10:29:50
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables
In directory vz-cvs-3.sog:/tmp/cvs-serv32083/DataTables
Modified Files:
TickerDataTable.cs
Log Message:
Updated methods returning tickers having particular features
Index: TickerDataTable.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/TickerDataTable.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** TickerDataTable.cs 14 Nov 2008 15:51:51 -0000 1.12
--- TickerDataTable.cs 21 Aug 2011 10:29:48 -0000 1.13
***************
*** 192,199 ****
#region GetTickersQuotedInEachMarketDay
! private static void addColumnNumberOfQuotes(DataTable tableToAnalyze)
{
! if(!tableToAnalyze.Columns.Contains("NumberOfQuotes"))
! tableToAnalyze.Columns.Add("NumberOfQuotes", System.Type.GetType("System.Int32"));
}
--- 192,199 ----
#region GetTickersQuotedInEachMarketDay
! private static void addColumnNumberOfValues(DataTable tableToAnalyze)
{
! if(!tableToAnalyze.Columns.Contains("NumberOfValues"))
! tableToAnalyze.Columns.Add("NumberOfValues", System.Type.GetType("System.Int32"));
}
***************
*** 203,207 ****
DataRow newRow = tableToWhichRowIsToBeAdded.NewRow();
newRow[0]= rowToBeAdded[0];
! newRow["NumberOfQuotes"] = numberOfTradingDays;
tableToWhichRowIsToBeAdded.Rows.Add(newRow);
}
--- 203,207 ----
DataRow newRow = tableToWhichRowIsToBeAdded.NewRow();
newRow[0]= rowToBeAdded[0];
! newRow["NumberOfValues"] = numberOfTradingDays;
tableToWhichRowIsToBeAdded.Rows.Add(newRow);
}
***************
*** 225,229 ****
long maxNumOfReturnedTickers)
{
! TickerDataTable.addColumnNumberOfQuotes(setOfTickers);
DataTable returnValue = setOfTickers.Clone();
foreach(DataRow row in setOfTickers.Rows)
--- 225,229 ----
long maxNumOfReturnedTickers)
{
! TickerDataTable.addColumnNumberOfValues(setOfTickers);
DataTable returnValue = setOfTickers.Clone();
foreach(DataRow row in setOfTickers.Rows)
***************
*** 243,250 ****
DataRow newRow = tableToWhichRowIsToBeAdded.NewRow();
newRow[0]= rowToBeAdded[0];
! newRow["NumberOfBars"] = numberOfTradingDateTimes;
tableToWhichRowIsToBeAdded.Rows.Add(newRow);
}
private static void getTickersQuotedAtAGivenPercentageOfDateTimes_handleRow(
DataRow row , History marketDateTimes , double percentageOfDateTimes ,
--- 243,288 ----
DataRow newRow = tableToWhichRowIsToBeAdded.NewRow();
newRow[0]= rowToBeAdded[0];
! newRow["NumberOfValues"] = numberOfTradingDateTimes;
tableToWhichRowIsToBeAdded.Rows.Add(newRow);
}
+ private static History getTickersQuotedAtAGivenPercentageOfDateTimes_handleRow_getDateTimesTickerHistory( string ticker ,
+ DateTime firstDate , DateTime lastDate )
+ {
+ Quotes quotes = new Quotes( ticker , firstDate , lastDate );
+ History marketDaysOrDateTimes = new History();
+ foreach ( DataRow dataRow in quotes.Rows )
+ {
+ DateTime dateTime = (DateTime)dataRow[ Quotes.Date ];
+ DateTime dateTimeOpenOrClose = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day,
+ ConstantsProvider.OpenTime.Hour,
+ ConstantsProvider.OpenTime.Minute,
+ ConstantsProvider.OpenTime.Second);
+ marketDaysOrDateTimes.Add( dateTimeOpenOrClose , dateTimeOpenOrClose );
+ dateTimeOpenOrClose = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day,
+ ConstantsProvider.CloseTime.Hour,
+ ConstantsProvider.CloseTime.Minute,
+ ConstantsProvider.CloseTime.Second);
+ marketDaysOrDateTimes.Add( dateTimeOpenOrClose , dateTimeOpenOrClose );
+ }
+ return marketDaysOrDateTimes;
+ }
+
+
+ private static void getTickersQuotedAtAGivenPercentageOfDateTimes_handleRow(
+ DataRow row , History marketDateTimes , double percentageOfDateTimes ,
+ DateTime firstQuoteDate , DateTime lastQuoteDate ,
+ DataTable tableToWhichRowIsToBeAdded )
+ {
+ History dateTimesForTicker =
+ TickerDataTable.getTickersQuotedAtAGivenPercentageOfDateTimes_handleRow_getDateTimesTickerHistory(
+ (string)row[0], firstQuoteDate, lastQuoteDate );
+ if( dateTimesForTicker.ContainsAtAGivenPercentageDateTimesIn( marketDateTimes , percentageOfDateTimes ) )
+ //the current ticker has been effectively traded at the given percentage of times
+ //for the given market date times
+ TickerDataTable.getTickersQuotedAtAGivenPercentageOfDateTimes_addRow(
+ row , dateTimesForTicker.Count , tableToWhichRowIsToBeAdded );
+ }
+
private static void getTickersQuotedAtAGivenPercentageOfDateTimes_handleRow(
DataRow row , History marketDateTimes , double percentageOfDateTimes ,
***************
*** 260,271 ****
row , dateTimesForTicker.Count , tableToWhichRowIsToBeAdded );
}
!
!
! private static void addColumnNumberOfBars(DataTable tableToAnalyze)
{
! if(!tableToAnalyze.Columns.Contains("NumberOfBars"))
! tableToAnalyze.Columns.Add("NumberOfBars", System.Type.GetType("System.Int32"));
}
-
public static DataTable GetTickersQuotedAtAGivenPercentageOfDateTimes(string marketIndex, double percentageOfDateTimes,
DataTable setOfTickers,
--- 298,321 ----
row , dateTimesForTicker.Count , tableToWhichRowIsToBeAdded );
}
!
! public static DataTable GetTickersQuotedAtAGivenPercentageOfDateTimes(string marketIndex, double percentageOfDateTimes,
! DataTable setOfTickers,
! DateTime firstDateTime, DateTime lastDateTime,
! long maxNumOfReturnedTickers)
{
! if(percentageOfDateTimes <= 0 || percentageOfDateTimes > 100)
! throw new Exception ("invalid percentage");
!
! History marketDateTimesForIndex =
! Quotes.GetMarketDays(marketIndex, firstDateTime, lastDateTime);
! TickerDataTable.addColumnNumberOfValues(setOfTickers);
! DataTable returnValue = setOfTickers.Clone();
! foreach(DataRow row in setOfTickers.Rows)
! getTickersQuotedAtAGivenPercentageOfDateTimes_handleRow(
! row , marketDateTimesForIndex , percentageOfDateTimes ,
! firstDateTime , lastDateTime , returnValue );
! ExtendedDataTable.DeleteRows(returnValue, maxNumOfReturnedTickers);
! return returnValue;
}
public static DataTable GetTickersQuotedAtAGivenPercentageOfDateTimes(string marketIndex, double percentageOfDateTimes,
DataTable setOfTickers,
***************
*** 315,319 ****
throw new Exception ("invalid percentage");
! TickerDataTable.addColumnNumberOfBars(setOfTickers);
DataTable returnValue = setOfTickers.Clone();
foreach(DataRow row in setOfTickers.Rows)
--- 365,369 ----
throw new Exception ("invalid percentage");
! TickerDataTable.addColumnNumberOfValues(setOfTickers);
DataTable returnValue = setOfTickers.Clone();
foreach(DataRow row in setOfTickers.Rows)
***************
*** 324,328 ****
return returnValue;
}
!
#endregion GetTickersQuotedAtAGivenPercentageOfDateTimes
--- 374,394 ----
return returnValue;
}
! public static DataTable GetTickersQuotedAtAGivenPercentageOfDateTimes(History marketDateTimes, double percentageOfDateTimes,
! DataTable setOfTickers,
! DateTime firstDateTime, DateTime lastDateTime,
! long maxNumOfReturnedTickers)
! {
! if(percentageOfDateTimes <= 0 || percentageOfDateTimes > 100)
! throw new Exception ("invalid percentage");
!
! TickerDataTable.addColumnNumberOfValues(setOfTickers);
! DataTable returnValue = setOfTickers.Clone();
! foreach(DataRow row in setOfTickers.Rows)
! getTickersQuotedAtAGivenPercentageOfDateTimes_handleRow(
! row , marketDateTimes , percentageOfDateTimes ,
! firstDateTime , lastDateTime , returnValue );
! ExtendedDataTable.DeleteRows(returnValue, maxNumOfReturnedTickers);
! return returnValue;
! }
#endregion GetTickersQuotedAtAGivenPercentageOfDateTimes
|
|
From: Marco M. <mi...@us...> - 2011-08-21 10:27:59
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables
In directory vz-cvs-3.sog:/tmp/cvs-serv31985/DataTables
Modified Files:
Quotes.cs
Log Message:
Fixed some bugs in methods accessing Quotes
Index: Quotes.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** Quotes.cs 16 Jan 2011 18:28:18 -0000 1.40
--- Quotes.cs 21 Aug 2011 10:27:57 -0000 1.41
***************
*** 168,173 ****
--- 168,179 ----
"AverageTradedValue",
orderByASC);
+ string[] tableForDebugging =
+ ExtendedDataTable.GetArrayOfStringFromRows(getMostLiquidTicker);
ExtendedDataTable.DeleteRows(getMostLiquidTicker, maxNumOfReturnedTickers + numberOfTopRowsToDelete);
+ tableForDebugging =
+ ExtendedDataTable.GetArrayOfStringFromRows(getMostLiquidTicker);
ExtendedDataTable.DeleteRows(getMostLiquidTicker, 0, numberOfTopRowsToDelete - 1);
+ tableForDebugging =
+ ExtendedDataTable.GetArrayOfStringFromRows(getMostLiquidTicker);
return getMostLiquidTicker;
}
***************
*** 727,731 ****
/// <summary>
! /// returns dates when the ticker was exchanged, within a given
/// date interval
/// </summary>
--- 733,738 ----
/// <summary>
! /// returns dateTimes at openTime and at closeTime for
! /// each date the ticker was exchanged on, within a given
/// date interval
/// </summary>
***************
*** 738,749 ****
{
Quotes quotes = new Quotes( ticker , firstDate , lastDate );
- // DateTime[] marketDays = new DateTime[ quotes.Rows.Count ];
History marketDays = new History();
- int i = 0;
foreach ( DataRow dataRow in quotes.Rows )
{
! // marketDays[ i ] = (DateTime)dataRow[ Quotes.Date ];
! marketDays.Add( (DateTime)dataRow[ Quotes.Date ] , (DateTime)dataRow[ Quotes.Date ] );
! i++;
}
return marketDays;
--- 745,760 ----
{
Quotes quotes = new Quotes( ticker , firstDate , lastDate );
History marketDays = new History();
foreach ( DataRow dataRow in quotes.Rows )
{
! marketDays.Add( (DateTime)dataRow[ Quotes.Date ], (DateTime)dataRow[ Quotes.Date ] );
! //New version - to be tested
! // DateTime dateTime = (DateTime)dataRow[ Quotes.Date ];
! // DateTime dateTimeOpenOrClose = new DateTime(dateTime.Year, dateTime.Month,
! // dateTime.Day, 9, 30, 0);
! // marketDays.Add( dateTimeOpenOrClose , dateTimeOpenOrClose );
! // dateTimeOpenOrClose = new DateTime(dateTime.Year, dateTime.Month,
! // dateTime.Day, 16, 0, 0);
! // marketDays.Add( dateTimeOpenOrClose , dateTimeOpenOrClose );
}
return marketDays;
***************
*** 1128,1134 ****
#region RecalculateCloseToCloseRatios
! private float recalculateCloseToCloseRatios_getAdjCloseJustBeforeCurrentFirstClose()
{
! float returnValue = float.MinValue;
DateTime firstCurrentDate = (DateTime)this.Rows[0][Quotes.Date];
int daysBeforeCurrent = 1;
--- 1139,1145 ----
#region RecalculateCloseToCloseRatios
! private double recalculateCloseToCloseRatios_getAdjCloseJustBeforeCurrentFirstClose()
{
! double returnValue = double.MinValue;
DateTime firstCurrentDate = (DateTime)this.Rows[0][Quotes.Date];
int daysBeforeCurrent = 1;
***************
*** 1136,1140 ****
//there exist other quotes in the database that precede first current quote
{
! while(returnValue == float.MinValue)
{
try{
--- 1147,1151 ----
//there exist other quotes in the database that precede first current quote
{
! while(returnValue == double.MinValue)
{
try{
***************
*** 1165,1181 ****
public void RecalculateCloseToCloseRatios()
{
! float adjustedCloseJustBeforeTheCurrentFirstClose =
this.recalculateCloseToCloseRatios_getAdjCloseJustBeforeCurrentFirstClose();
for(int i = 0; i<this.Rows.Count; i++)
{
! if(i == 0 && adjustedCloseJustBeforeTheCurrentFirstClose > float.MinValue)
//there exists a valid quote just before the first current close
this.Rows[i][Quotes.AdjustedCloseToCloseRatio] =
! (float)this.Rows[i][Quotes.AdjustedClose] /
adjustedCloseJustBeforeTheCurrentFirstClose;
else if(i>0)
this.Rows[i][Quotes.AdjustedCloseToCloseRatio] =
! (float)this.Rows[i][Quotes.AdjustedClose] /
! (float)this.Rows[i - 1][Quotes.AdjustedClose];
}
}
--- 1176,1192 ----
public void RecalculateCloseToCloseRatios()
{
! double adjustedCloseJustBeforeTheCurrentFirstClose =
this.recalculateCloseToCloseRatios_getAdjCloseJustBeforeCurrentFirstClose();
for(int i = 0; i<this.Rows.Count; i++)
{
! if(i == 0 && adjustedCloseJustBeforeTheCurrentFirstClose > double.MinValue)
//there exists a valid quote just before the first current close
this.Rows[i][Quotes.AdjustedCloseToCloseRatio] =
! (double)this.Rows[i][Quotes.AdjustedClose] /
adjustedCloseJustBeforeTheCurrentFirstClose;
else if(i>0)
this.Rows[i][Quotes.AdjustedCloseToCloseRatio] =
! (double)this.Rows[i][Quotes.AdjustedClose] /
! (double)this.Rows[i - 1][Quotes.AdjustedClose];
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 10:07:25
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess
In directory vz-cvs-3.sog:/tmp/cvs-serv28524
Modified Files:
DataAccess_SD.csproj
Log Message:
Updated DataAccess project file
Index: DataAccess_SD.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataAccess_SD.csproj,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** DataAccess_SD.csproj 16 Jan 2011 19:52:32 -0000 1.8
--- DataAccess_SD.csproj 21 Aug 2011 10:07:23 -0000 1.9
***************
*** 72,75 ****
--- 72,76 ----
<Compile Include="Tables\Bars.cs" />
<Compile Include="Tables\FinancialValues.cs" />
+ <Compile Include="Tables\FinancialValueType.cs" />
<Compile Include="ValidationTypes.cs" />
<Compile Include="Tables\FaultyTickers.cs" />
|
|
From: Marco M. <mi...@us...> - 2011-08-21 10:06:57
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables
In directory vz-cvs-3.sog:/tmp/cvs-serv28472/Tables
Modified Files:
Quotes.cs
Log Message:
Some methods have been fixed in accessing Quotes table
Index: Quotes.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** Quotes.cs 16 Jan 2011 11:18:32 -0000 1.38
--- Quotes.cs 21 Aug 2011 10:06:55 -0000 1.39
***************
*** 106,110 ****
return dataTable.Rows.Count;
}
!
/// <summary>
/// Returns the adjusted close value for the given ticker at the specified date
--- 106,125 ----
return dataTable.Rows.Count;
}
!
! /// <summary>
! /// Returns the number of days at which the given ticker has quotes in the db
! /// </summary>
! /// <param name="ticker">ticker for which the number of days has to be returned</param>
! /// <returns></returns>
! public static int GetNumberOfDaysWithQuotes( string ticker, DateTime firstDate,
! DateTime lastDate)
! {
! DataTable dataTable = SqlExecutor.GetDataTable(
! "select * from quotes WHERE quTicker='" + ticker + "'" +
! " AND quDate BETWEEN " + SQLBuilder.GetDateConstant(firstDate) +
! " AND " + SQLBuilder.GetDateConstant(lastDate));
! return dataTable.Rows.Count;
! }
!
/// <summary>
/// Returns the adjusted close value for the given ticker at the specified date
***************
*** 113,123 ****
/// <param name="ticker">ticker for which the adj close has to be returned</param>
/// <returns></returns>
! public static float GetAdjustedClose( string ticker, DateTime date )
{
! DataTable dataTable = SqlExecutor.GetDataTable(
! "select quAdjustedClose from quotes where quTicker='" + ticker + "' " +
! "and quDate=" + SQLBuilder.GetDateConstant(date) );
! return (float)dataTable.Rows[0][0];
}
/// <summary>
/// Returns the raw (not adjusted) close for the given ticker at the specified date
--- 128,139 ----
/// <param name="ticker">ticker for which the adj close has to be returned</param>
/// <returns></returns>
! public static double GetAdjustedClose( string ticker, DateTime date )
{
! string strSQL = "select quAdjustedClose from quotes where quTicker='" + ticker + "' " +
! "and quDate=" + SQLBuilder.GetDateConstant(date);
! DataTable dataTable = SqlExecutor.GetDataTable(strSQL);
! return (double)dataTable.Rows[0][0];
}
+
/// <summary>
/// Returns the raw (not adjusted) close for the given ticker at the specified date
***************
*** 728,732 ****
DataTable dt;
string sql = "SELECT quotes.quTicker, " +
! "Avg([quVolume]) AS AverageTradedVolume " +
"FROM quotes WHERE quTicker ='" +
ticker + "' " +
--- 744,748 ----
DataTable dt;
string sql = "SELECT quotes.quTicker, " +
! "Avg(quVolume) AS AverageTradedVolume " +
"FROM quotes WHERE quTicker ='" +
ticker + "' " +
***************
*** 736,742 ****
dt = SqlExecutor.GetDataTable( sql );
if(dt.Rows.Count==0)
! return 0;
else
! return (double)dt.Rows[0]["AverageTradedVolume"];
}
--- 752,758 ----
dt = SqlExecutor.GetDataTable( sql );
if(dt.Rows.Count==0)
! return 0.0;
else
! return Convert.ToDouble(dt.Rows[0]["AverageTradedVolume"]);
}
***************
*** 902,905 ****
--- 918,949 ----
/// <summary>
+ /// returns the average adjusted close price for the given ticker,
+ /// at the specified time interval
+ /// </summary>
+ public static double GetAverageAdjustedClosePrice( string ticker,
+ DateTime firstQuoteDate,
+ DateTime lastQuoteDate)
+
+ {
+ double returnValue = double.MinValue;
+ DataTable dt;
+ string sql = "SELECT quotes.quTicker, " +
+ "Avg(quotes.quAdjustedClose) AS AverageAdjClosePrice " +
+ "FROM quotes " +
+ "WHERE quotes.quTicker ='" + ticker +
+ "' AND quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " +
+ "AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " +
+ "GROUP BY quotes.quTicker";
+ dt = SqlExecutor.GetDataTable( sql );
+ if(dt.Rows.Count > 0)
+ {
+ if( dt.Rows[0]["AverageAdjClosePrice"] is double )
+ //cast is possible
+ returnValue = (double)dt.Rows[0]["AverageAdjClosePrice"];
+ }
+ return returnValue;
+ }
+
+ /// <summary>
/// returns raw open price's standard deviation for the given ticker,
/// at the specified time interval
|
|
From: Marco M. <mi...@us...> - 2011-08-21 10:05:17
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables
In directory vz-cvs-3.sog:/tmp/cvs-serv28299/Tables
Modified Files:
FinancialValues.cs
Log Message:
Some methods have been fixed in accessing FinancialValues table
Index: FinancialValues.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/FinancialValues.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FinancialValues.cs 16 Jan 2011 18:10:30 -0000 1.2
--- FinancialValues.cs 21 Aug 2011 10:05:15 -0000 1.3
***************
*** 74,94 ****
}
/// <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);
--- 74,104 ----
}
+ private static int getInternalCode(FinancialValueType financialValueType)
+ {
+ int returnValue = 0;
+ string financialValueTypeString =
+ Enum.GetName(financialValueType.GetType(), financialValueType);
+ returnValue = (int)Enum.Parse(financialValueType.GetType(), financialValueTypeString);
+
+ return returnValue;
+ }
+
/// <summary>
/// Returns last available financial value for the given ticker
/// </summary>
/// <param name="ticker"></param>
! /// <param name="financialValueType"></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, FinancialValueType financialValueType,
int periodLengthInMonths,
DateTime atDate )
{
! int financialDataCode = getInternalCode(financialValueType);
! 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);
***************
*** 101,117 ****
/// </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";
--- 111,127 ----
/// </summary>
/// <param name="ticker"></param>
! /// <param name="financialValueType"></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, FinancialValueType financialValueType,
int periodLengthInMonths,
DateTime atDate )
{
! int financialDataCode = getInternalCode(financialValueType);
! string sqlString = "select * from financialValues where fvTiTicker = '" + ticker + "' " +
! "AND fvFdId = " + financialDataCode + " " +
! "AND fvPeriodLengthInMonths = " + periodLengthInMonths + " " +
! "AND fvEndingPeriodDate <= " + SQLBuilder.GetDateConstant(atDate) + " " +
"order by fvEndingPeriodDate";
***************
*** 123,138 ****
/// 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";
--- 133,148 ----
/// Returns last available financial values for all tickers
/// </summary>
! /// <param name="financialValueType"></param>
/// <param name="atDate">Last financial values with endingPeriodDate
/// previous than param atDate will be returned</param>
/// <returns></returns>
! public static DataTable GetLastFinancialValues(FinancialValueType financialValueType,
int periodLengthInMonths,
DateTime atDate )
{
! int financialDataCode = getInternalCode(financialValueType);
! string sqlString = "select * from financialValues where fvFdId = " + financialDataCode + " " +
! "AND fvPeriodLengthInMonths = " + periodLengthInMonths + " " +
! "AND fvEndingPeriodDate <= " + SQLBuilder.GetDateConstant(atDate) + " " +
"order by fvEndingPeriodDate";
***************
*** 148,193 ****
int periodLengthInMonths )
{
! string sql = "select * from financialValues where fvTiTicker='" + instrumentKey + "' " +
! "and fvPeriodLengthInMonths= " + periodLengthInMonths + " order by fvEndingPeriodDate";
return SqlExecutor.GetDataTable( sql );
}
!
! #region SetDataTable for tickerList
! // private static string setDataTable_getTickerListWhereClause_getSingleTickerWhereClause(
! // string ticker )
! // {
! // return "(" + FinancialValues.TickerFieldName + "='" + ticker + "')";
! // }
! // private static string setDataTable_getTickerListWhereClause( ICollection tickerCollection )
! // {
! // string returnValue = "";
! // foreach (string ticker in tickerCollection)
! // if ( returnValue == "" )
! // // this is the first ticker to handle
! // returnValue += setDataTable_getTickerListWhereClause_getSingleTickerWhereClause( ticker );
! // else
! // // this is not the first ticker to handle
! // returnValue += " or " +
! // setDataTable_getTickerListWhereClause_getSingleTickerWhereClause( ticker );
! // return "( " + returnValue + " )";
! // }
! // /// <summary>
! // /// Builds a Quotes data table containing a row for each ticker in the
! // /// collection, with the quotes for the given DateTime
! // /// </summary>
! // /// <param name="tickerCollection">Tickers whose quotes are to be fetched</param>
! // /// <param name="dateTime">Date for the quotes to be fetched</param>
! // /// <param name="dataTable">Output parameter</param>
! // public static void SetDataTable( ICollection tickerCollection , DateTime dateTime , DataTable dataTable)
! // {
! // string sql;
! // sql = "select * from quotes " +
! // "where " + setDataTable_getTickerListWhereClause( tickerCollection ) +
! // " and " + FinancialValues.Date + "=" + SQLBuilder.GetDateConstant( dateTime ) + " " +
! // "order by " + FinancialValues.TickerFieldName;
! //
! // SqlExecutor.SetDataTable( sql , dataTable );
! // }
! #endregion
}
}
--- 158,185 ----
int periodLengthInMonths )
{
! string sql = "select * from financialValues where fvTiTicker = '" + instrumentKey + "' " +
! "and fvPeriodLengthInMonths = " + periodLengthInMonths + " order by fvEndingPeriodDate";
return SqlExecutor.GetDataTable( sql );
}
! /// <summary>
! /// Returns financial value for the given ticker at the given date (exact match!)
! /// </summary>
! /// <param name="ticker"></param>
! /// <param name="financialValueType"></param>
! /// <param name="atDate">Financial value at the given date</param>
! /// <returns></returns>
! public static double GetFinancialValue( string ticker, FinancialValueType financialValueType,
! int periodLengthInMonths, DateTime atDate )
! {
! int financialDataCode = getInternalCode(financialValueType);
! string sqlString = "select * from financialValues where fvTiTicker = '" + ticker + "' " +
! "AND fvFdId = " + financialDataCode + " " +
! "AND fvPeriodLengthInMonths = " + periodLengthInMonths + " " +
! "AND fvEndingPeriodDate = " + SQLBuilder.GetDateConstant(atDate);
! DataTable dataTable = SqlExecutor.GetDataTable(sqlString);
!
! return (double)(dataTable.Rows[ 0 ][ "fvValue" ]);
! }
!
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 10:02:37
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables
In directory vz-cvs-3.sog:/tmp/cvs-serv27835/Tables
Added Files:
FinancialValueType.cs
Log Message:
Added FinancialValueType, Enum providing the codes used in the DB
as ID's for financial values enum
--- NEW FILE: FinancialValueType.cs ---
/*
QuantProject - Quantitative Finance Library
FinancialValueType.cs
Copyright (C) 2011
Marco Milletti
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
namespace QuantProject.DataAccess.Tables
{
/// <summary>
/// Enum providing the codes used in the DB
/// as ID for financial values
/// </summary>
public enum FinancialValueType
{
AveragePriceEarnings = 59 ,
BookValuePerShare = 63 ,
DebtEquityRatio = 64 ,
Depreciation = 54 ,
EBIT = 55 ,
EarningsPerShare = 56 ,
InterestCoverage = 67 ,
LongTermDebt = 31 ,
NetIncome = 40 ,
NetProfitMargin = 62 ,
PriceToBook = 61 ,
PriceToSales = 60 ,
Revenues = 1 ,
ROA = 66 ,
ROE = 65 ,
SharesOutstanding = 58 ,
TaxRateInPercentage = 57 ,
TotalCurrentAssets = 42 ,
TotalCurrentLiabilities = 44
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 09:59:44
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT
In directory vz-cvs-3.sog:/tmp/cvs-serv26149
Modified Files:
ADT_SD.csproj
Log Message:
Updated ADT project file
Index: ADT_SD.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ADT_SD.csproj,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** ADT_SD.csproj 13 Feb 2011 18:53:52 -0000 1.16
--- ADT_SD.csproj 21 Aug 2011 09:59:42 -0000 1.17
***************
*** 48,51 ****
--- 48,52 ----
<Compile Include="AssemblyInfo.cs" />
<Compile Include="BarComponent.cs" />
+ <Compile Include="Collections\DoubleArrayManager.cs" />
<Compile Include="ConstantsProvider.cs" />
<Compile Include="Econometrics\ILinearRegression.cs" />
***************
*** 111,114 ****
--- 112,116 ----
<Compile Include="Collections\Set.cs" />
<Compile Include="Timing\Date.cs" />
+ <Compile Include="Timing\DayOfMonth.cs" />
<Compile Include="Timing\Time.cs" />
</ItemGroup>
|
|
From: Marco M. <mi...@us...> - 2011-08-21 09:59:14
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT
In directory vz-cvs-3.sog:/tmp/cvs-serv26129
Modified Files:
ExtendedDateTime.cs
Log Message:
Added GetLastDateOfTheLastQuarter method
Index: ExtendedDateTime.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ExtendedDateTime.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ExtendedDateTime.cs 8 Nov 2008 20:27:25 -0000 1.8
--- ExtendedDateTime.cs 21 Aug 2011 09:59:11 -0000 1.9
***************
*** 170,173 ****
--- 170,210 ----
return isFirstTimeLessThenSecondTime;
}
+
+ /// <summary>
+ /// Returns the last date of the last quarter
+ /// </summary>
+ /// <param name="dateTime"></param>
+ /// <returns></returns>
+ public static DateTime GetLastDateOfTheLastQuarter( DateTime dateTime )
+ {
+ DateTime lastDateOfLastQuarter;
+ int currentMonth = dateTime.Month;
+ int year_lastDateOfLastQuarter = dateTime.Year;
+ int month_lastDateOfLastQuarter = 12;
+ int day_lastDateOfLastQuarter = 31;
+
+ if ( currentMonth >= 1 && currentMonth <=3 )
+ {
+ year_lastDateOfLastQuarter = dateTime.Year - 1;
+ }
+ else if ( currentMonth >= 4 && currentMonth <=6 )
+ {
+ month_lastDateOfLastQuarter = 3;
+ }
+ else if ( currentMonth >= 7 && currentMonth <=9 )
+ {
+ month_lastDateOfLastQuarter = 6;
+ day_lastDateOfLastQuarter = 30;
+ }
+ else if ( currentMonth >= 10 && currentMonth <=12 )
+ {
+ month_lastDateOfLastQuarter = 9;
+ day_lastDateOfLastQuarter = 30;
+ }
+ lastDateOfLastQuarter =
+ new DateTime(year_lastDateOfLastQuarter, month_lastDateOfLastQuarter,
+ day_lastDateOfLastQuarter, 16, 0, 0);
+ return lastDateOfLastQuarter;
+ }
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 09:57:35
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT
In directory vz-cvs-3.sog:/tmp/cvs-serv26025
Modified Files:
ExtendedDataTable.cs
Log Message:
Added some new methods for manipulating rows in DataTables
Index: ExtendedDataTable.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ExtendedDataTable.cs,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** ExtendedDataTable.cs 16 Jan 2011 19:50:23 -0000 1.13
--- ExtendedDataTable.cs 21 Aug 2011 09:57:33 -0000 1.14
***************
*** 116,132 ****
int numRows = table.Rows.Count;
double[] arrayOfDouble = new double[numRows];
! int index = 0;
! try
{
! for(; index!= numRows; index++)
! {
! arrayOfDouble[index] = (double) table.Rows[index][columnName];
}
!
! }
! catch(Exception ex)
! {
! string s = ex.ToString();
! index = numRows;
}
return arrayOfDouble;
--- 116,128 ----
int numRows = table.Rows.Count;
double[] arrayOfDouble = new double[numRows];
! for(int index = 0; index < numRows; index++)
{
! arrayOfDouble[index] = double.NaN;
! try{
! arrayOfDouble[index] = (double)table.Rows[index][columnName];
}
! catch(Exception ex){
! string s = ex.ToString();
! }
}
return arrayOfDouble;
***************
*** 277,287 ****
j = 0;
}
-
}
return hashTable;
-
}
!
}
}
--- 273,355 ----
j = 0;
}
}
return hashTable;
}
! #region GetArrayOfStringFromRows
! private static string getArrayOfStringFromRows_getColumnNames(DataTable table)
! {
! string returnValue = null;
! foreach(DataColumn dataColumn in table.Columns)
! returnValue = returnValue + dataColumn.ColumnName + "; ";
! return returnValue;
! }
!
! private static string getArrayOfStringFromRows_getRowValues(DataTable table,
! int currentRowIndex)
! {
! string returnValue = null;
! int numOfColumns = table.Columns.Count;
! for(int i = 0; i < numOfColumns; i++)
! returnValue = returnValue + table.Rows[currentRowIndex][i].ToString() + "; ";
! return returnValue;
! }
!
! /// <summary>
! /// Get an array of string (for debugging purposes):
! /// the string with index 0 contains the name of the columns of the
! /// data table;
! /// the other strings contain all the table's rows
! /// </summary>
! public static string[] GetArrayOfStringFromRows(DataTable table)
! {
! int numRows = table.Rows.Count;
! string[] arrayOfString = new string[numRows];
! int index = 0;
! try
! {
! for(; index!= numRows; index++)
! {
! if(index == 0)
! arrayOfString[index] = getArrayOfStringFromRows_getColumnNames(table);
! else
! arrayOfString[index] = getArrayOfStringFromRows_getRowValues(table, index);
! }
! }
! catch(Exception ex)
! {
! MessageBox.Show(ex.ToString());
! index = numRows;
! }
! return arrayOfString;
! }
! #endregion GetArrayOfStringFromRows
!
! /// <summary>
! /// Import in destinationTable all the rows in
! /// sourceTable.
! /// Destination and source tables have to share
! /// the same data - structure
! /// </summary>
! public static void ImportRowsFromFirstRowOfSource(DataTable sourceTable,
! DataTable destinationTable)
! {
! DataRow[] sourceRows = sourceTable.Select();
! for(int i = 0; i < sourceRows.Length; i++)
! destinationTable.ImportRow(sourceRows[i]);
! }
! /// <summary>
! /// Import in destinationTable all the rows in
! /// sourceTable.
! /// Destination and source tables have to share
! /// the same data - structure
! /// </summary>
! public static void ImportRowsFromLastRowOfSource(DataTable sourceTable,
! DataTable destinationTable)
! {
! DataRow[] sourceRows = sourceTable.Select();
! for(int i = sourceRows.Length - 1; i >= 0; i--)
! destinationTable.ImportRow(sourceRows[i]);
! }
}
}
|
|
From: Marco M. <mi...@us...> - 2011-08-21 09:56:10
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT
In directory vz-cvs-3.sog:/tmp/cvs-serv25949
Modified Files:
ConstantsProvider.cs
Log Message:
Updated ConstantsProvider
Index: ConstantsProvider.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ConstantsProvider.cs,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** ConstantsProvider.cs 30 Nov 2008 22:40:09 -0000 1.21
--- ConstantsProvider.cs 21 Aug 2011 09:56:08 -0000 1.22
***************
*** 1,3 ****
--- 1,4 ----
using System;
+ using QuantProject.ADT.Timing;
namespace QuantProject.ADT
***************
*** 47,50 ****
--- 48,55 ----
public static string SeparatorForWeights = ">";
//separator for separating ticker by its weight in GenomeRepresentation class
+ public static Time OpenTime = new Time(9, 30, 0);
+ //conventional open time (in reality, it depends on the market);
+ public static Time CloseTime = new Time(16, 0, 0);
+ //conventional close time (in reality, it depends on the market);
}
}
|