quantproject-developers Mailing List for QuantProject (Page 36)
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: Glauco S. <gla...@us...> - 2008-09-29 21:13:22
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a1_Instruments In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13218/a1_Instruments Modified Files: Instrument.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: Instrument.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a1_Instruments/Instrument.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Instrument.cs 9 Jan 2005 23:25:26 -0000 1.5 --- Instrument.cs 29 Sep 2008 21:13:09 -0000 1.6 *************** *** 25,28 **** --- 25,29 ---- using QuantProject.ADT.Histories; using QuantProject.Data.DataProviders; + using QuantProject.Data.DataProviders.Quotes; using QuantProject.Business.Timing; *************** *** 57,61 **** public DateTime GetNextMarketDay( DateTime dateTime ) { ! History history = HistoricalDataProvider.GetOpenHistory( this.Key ); return history.GetNextDay( dateTime ); } --- 58,62 ---- public DateTime GetNextMarketDay( DateTime dateTime ) { ! History history = HistoricalQuotesProvider.GetOpenHistory( this.Key ); return history.GetNextDay( dateTime ); } *************** *** 63,67 **** public DateTime GetMarketDay( DateTime initialDateTime, int numberOfDaysAhead ) { ! History history = HistoricalDataProvider.GetOpenHistory( this.Key ); return history.GetDay(initialDateTime, numberOfDaysAhead ); } --- 64,68 ---- public DateTime GetMarketDay( DateTime initialDateTime, int numberOfDaysAhead ) { ! History history = HistoricalQuotesProvider.GetOpenHistory( this.Key ); return history.GetDay(initialDateTime, numberOfDaysAhead ); } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:13:08
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Caching In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12746/DataProviders/Caching Modified Files: Cache.cs ICache.cs SimpleCache.cs Log Message: no message Index: ICache.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Caching/ICache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ICache.cs 11 Jan 2006 18:41:55 -0000 1.1 --- ICache.cs 29 Sep 2008 21:12:47 -0000 1.2 *************** *** 33,38 **** public interface ICache { ! double GetQuote( string ticker , DateTime dateTime , QuoteField quoteField ); ! bool WasExchanged( string ticker , ExtendedDateTime extendedDateTime ); } } --- 33,39 ---- public interface ICache { ! double GetQuote( ! string ticker , DateTime dateTime , QuoteField quoteField ); ! bool WasExchanged( string ticker , DateTime dateTime ); } } Index: Cache.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Caching/Cache.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Cache.cs 31 May 2006 14:40:28 -0000 1.4 --- Cache.cs 29 Sep 2008 21:12:47 -0000 1.5 *************** *** 98,101 **** --- 98,102 ---- return this.getCachePage( ticker , dateTime.Year , quoteField ); } + #region removeUnusedPages private long removeUnusedPages_getMinPageRankToKeep() *************** *** 130,165 **** this.Remove( key ); } ! #endregion ! // private void getQuote_checkEarlyDateException( DateTime dateTime ) ! // { ! // if ( dateTime < ConstantsProvider.MinQuoteDateTime ) ! // throw new EarlyDateException( dateTime ); ! // } #region addPage - // private void addTicker( string ticker ) - // { - // if ( !this.ContainsKey( ticker ) ) - // { - // this.Add( ticker , new Hashtable() ); - // } - // } - // private void addYear( string ticker , int year ) - // { - // Hashtable quotesForTicker = this.getQuotes( ticker ); - // if ( !quotesForTicker.ContainsKey( year ) ) - // { - // quotesForTicker.Add( year , new Hashtable() ); - // } - // } - // private void addCachePage( string ticker , int year , QuoteField quoteField ) - // { - // Hashtable quotesForTickerAndYear = this.getQuotes( ticker , year ); - // if ( !quotesForTickerAndYear.ContainsKey( quoteField ) ) - // { - // CachePage cachePage = new CachePage( ticker , year , quoteField ); - // cachePage.LoadData(); - // quotesForTickerAndYear.Add( quoteField , cachePage ); - // } - // } private void addPage_actually( string ticker , int year , QuoteField quoteField ) { --- 131,137 ---- this.Remove( key ); } ! #endregion removeUnusedPages ! #region addPage private void addPage_actually( string ticker , int year , QuoteField quoteField ) { *************** *** 183,187 **** } #endregion ! public double GetQuote( string ticker , DateTime dateTime , QuoteField quoteField ) { double returnValue; --- 155,161 ---- } #endregion ! ! public double GetQuote( ! string ticker , DateTime dateTime , QuoteField quoteField ) { double returnValue; *************** *** 219,236 **** return returnValue; } ! public bool WasExchanged( string ticker , ExtendedDateTime extendedDateTime ) { - bool returnValue; // forces quote caching ! this.GetQuote( ticker , extendedDateTime.DateTime , QuoteField.Open ); ! if ( !((CachePage)this[ this.getKey( ticker , extendedDateTime.DateTime.Year , ! QuoteField.Open ) ] ).Quotes.ContainsKey( extendedDateTime.DateTime ) ) ! // the ticker was not exchanged at the given date ! returnValue = false; ! else ! // the ticker was exchanged at the given date ! returnValue = true; ! return returnValue; } } } --- 193,223 ---- return returnValue; } ! ! #region WasExchanged ! private bool wasExchanged_withCachingAlreadyForced( ! string ticker , DateTime dateTime ) ! { ! CachePage cachePage = this.getCachePage( ! ticker , dateTime , QuoteField.Open ); ! DateTime date = ExtendedDateTime.GetDate( dateTime ); ! bool wasExchanged = cachePage.Quotes.ContainsKey( date ); ! // if ( !cachePage.Quotes.ContainsKey( date ) ) ! // // the ticker was not exchanged at the given date ! // returnValue = false; ! // else ! // // the ticker was exchanged at the given date ! // returnValue = true; ! return wasExchanged; ! } ! public bool WasExchanged( ! string ticker , DateTime dateTime ) { // forces quote caching ! this.GetQuote( ticker , dateTime , QuoteField.Open ); ! bool wasExchanged = this.wasExchanged_withCachingAlreadyForced( ! ticker , dateTime ); ! return wasExchanged; } + #endregion WasExchanged } } Index: SimpleCache.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Caching/SimpleCache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleCache.cs 11 Jan 2006 18:44:23 -0000 1.1 --- SimpleCache.cs 29 Sep 2008 21:12:47 -0000 1.2 *************** *** 54,60 **** } public bool WasExchanged( string ticker , ! ExtendedDateTime extendedDateTime ) { ! return DataBase.WasExchanged( ticker , extendedDateTime ); } } --- 54,60 ---- } public bool WasExchanged( string ticker , ! DateTime dateTime ) { ! return DataBase.WasExchanged( ticker , dateTime ); } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:13:05
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12746/DataProviders Modified Files: Quote.cs Log Message: no message Index: Quote.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Quote.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Quote.cs 29 Nov 2004 16:19:16 -0000 1.2 --- Quote.cs 29 Sep 2008 21:12:48 -0000 1.3 *************** *** 33,37 **** private string ticker; private double value; ! private ExtendedDateTime extendedDateTime; public string Ticker --- 33,37 ---- private string ticker; private double value; ! private DateTime dateTime; public string Ticker *************** *** 47,54 **** } ! public ExtendedDateTime ExtendedDateTime { ! get { return this.extendedDateTime; } ! set { this.extendedDateTime = value; } } --- 47,54 ---- } ! public DateTime DateTime { ! get { return this.dateTime; } ! set { this.dateTime = value; } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:12:55
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12699 Modified Files: DataBase.cs QuoteField.cs Log Message: no message Index: QuoteField.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/QuoteField.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QuoteField.cs 9 Jan 2005 23:33:29 -0000 1.1 --- QuoteField.cs 29 Sep 2008 21:12:37 -0000 1.2 *************** *** 3,7 **** QuoteField.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- QuoteField.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 31,40 **** { Open, ! High, ! Low, ! Close, Volume, AdjustedClose, ! AdjustedCloseToCloseRatio } } --- 31,40 ---- { Open, ! High, ! Low, ! Close, Volume, AdjustedClose, ! AdjustedCloseToCloseRatio } } Index: DataBase.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataBase.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DataBase.cs 15 Jan 2006 23:35:09 -0000 1.8 --- DataBase.cs 29 Sep 2008 21:12:37 -0000 1.9 *************** *** 164,168 **** } public static bool WasExchanged( string ticker , ! ExtendedDateTime extendedDateTime ) { string sqlQuery = --- 164,168 ---- } public static bool WasExchanged( string ticker , ! DateTime dateTime ) { string sqlQuery = *************** *** 170,174 **** "from quotes where (quTicker='" + ticker + "') " + "and (quDate=" + ! SQLBuilder.GetDateConstant( extendedDateTime.DateTime ) + ")"; DataTable quotes = new DataTable(); try --- 170,174 ---- "from quotes where (quTicker='" + ticker + "') " + "and (quDate=" + ! SQLBuilder.GetDateConstant( dateTime ) + ")"; DataTable quotes = new DataTable(); try |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:12:42
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Histories In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12624/Histories Modified Files: History.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: History.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Histories/History.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** History.cs 19 Jan 2008 19:03:05 -0000 1.13 --- History.cs 29 Sep 2008 21:12:26 -0000 1.14 *************** *** 121,125 **** bool returnValue = true; foreach ( DateTime dateTime in comparingHistory.Keys ) ! if ( ! this.ContainsKey( dateTime ) ) returnValue = false; return returnValue; --- 121,125 ---- bool returnValue = true; foreach ( DateTime dateTime in comparingHistory.Keys ) ! if ( ! this.ContainsKey( ExtendedDateTime.GetDate( dateTime ) ) ) returnValue = false; return returnValue; |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:12:38
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Collections In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12624/Collections Modified Files: Set.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: Set.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Collections/Set.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Set.cs 20 Jul 2008 20:40:22 -0000 1.2 --- Set.cs 29 Sep 2008 21:12:26 -0000 1.3 *************** *** 29,32 **** --- 29,33 ---- /// A mathematical set /// </summary> + [Serializable] public class Set { |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:10:28
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11276 Modified Files: Presentation_SD.csproj Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: Presentation_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Presentation_SD.csproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Presentation_SD.csproj 19 Aug 2008 17:12:59 -0000 1.6 --- Presentation_SD.csproj 29 Sep 2008 21:10:20 -0000 1.7 *************** *** 38,41 **** --- 38,53 ---- </PropertyGroup> <ItemGroup> + <Reference Include="Interop.Excel"> + <HintPath>..\..\Interop.Excel.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + </Reference> + <Reference Include="Interop.Office"> + <HintPath>..\..\Interop.Office.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + </Reference> + <Reference Include="Interop.VBIDE"> + <HintPath>..\..\Interop.VBIDE.dll</HintPath> + <SpecificVersion>False</SpecificVersion> + </Reference> <Reference Include="System" /> <Reference Include="System.Configuration" /> *************** *** 48,63 **** <Private>True</Private> </Reference> - <Reference Include="Interop.VBIDE"> - <HintPath>..\..\Interop.VBIDE.dll</HintPath> - <Private>True</Private> - </Reference> - <Reference Include="Interop.Excel"> - <HintPath>..\..\Interop.Excel.dll</HintPath> - <Private>True</Private> - </Reference> - <Reference Include="Interop.Office"> - <HintPath>..\..\Interop.Office.dll</HintPath> - <Private>True</Private> - </Reference> </ItemGroup> <ItemGroup> --- 60,63 ---- *************** *** 99,102 **** --- 99,103 ---- <Name>b4_Business</Name> </ProjectReference> + <Folder Include="Reporting\MicrosoftExcel" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:09:40
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10765 Modified Files: Data_SD.csproj Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: Data_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Data_SD.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Data_SD.csproj 29 Aug 2007 10:34:58 -0000 1.2 --- Data_SD.csproj 29 Sep 2008 21:09:27 -0000 1.3 *************** *** 46,57 **** <ItemGroup> <Compile Include="AssemblyInfo.cs" /> <Compile Include="ExtendedDataTable.cs" /> <Compile Include="FilterBuilder.cs" /> - <Compile Include="DataProviders\HistoricalDataProvider.cs" /> <Compile Include="DataProviders\IDataStreamer.cs" /> - <Compile Include="DataProviders\NewExtendedDateTimeEventArgs.cs" /> <Compile Include="DataProviders\NewQuoteEventArgs.cs" /> <Compile Include="DataProviders\Quote.cs" /> - <Compile Include="DataProviders\Timer.cs" /> <Compile Include="DataProviders\Caching\Cache.cs" /> <Compile Include="DataTables\GroupQuotes.cs" /> --- 46,56 ---- <ItemGroup> <Compile Include="AssemblyInfo.cs" /> + <Compile Include="DataProviders\Quotes\HistoricalQuotesProvider.cs" /> + <Compile Include="DataProviders\Quotes\MarketStatusSwitch.cs" /> <Compile Include="ExtendedDataTable.cs" /> <Compile Include="FilterBuilder.cs" /> <Compile Include="DataProviders\IDataStreamer.cs" /> <Compile Include="DataProviders\NewQuoteEventArgs.cs" /> <Compile Include="DataProviders\Quote.cs" /> <Compile Include="DataProviders\Caching\Cache.cs" /> <Compile Include="DataTables\GroupQuotes.cs" /> *************** *** 101,104 **** --- 100,104 ---- <Name>b1_ADT</Name> </ProjectReference> + <Folder Include="DataProviders\Quotes" /> <Folder Include="Selectors\ByLinearIndipendence" /> </ItemGroup> |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:08:51
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Quotes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10258/DataProviders/Quotes Added Files: HistoricalQuotesProvider.cs MarketStatusSwitch.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- NEW FILE: MarketStatusSwitch.cs --- /* QuantProject - Quantitative Finance Library MarketStatusSwitch.cs Copyright (C) 2003 Glauco Siliprandi 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.Data.DataProviders.Quotes { /// <summary> /// Relevant time for the Quotes table /// </summary> public enum MarketStatusSwitch { Open, Close } } --- NEW FILE: HistoricalQuotesProvider.cs --- /* QuantProject - Quantitative Finance Library HistoricalQuotesProvider.cs Copyright (C) 2003 Glauco Siliprandi 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 QuantProject.ADT; using QuantProject.ADT.Histories; using QuantProject.Data.DataProviders.Caching; using QuantProject.DataAccess; using QuantProject.DataAccess.Tables; namespace QuantProject.Data.DataProviders.Quotes { // TO DO : rename this class HistoricalQuotesProvider, then // add a class HistoricalBarsProvider and introduce a // IHistoricalDataProvider to be implemented by the two classes /// <summary> /// Static methods to access the historical data /// </summary> public class HistoricalQuotesProvider { private static Hashtable cachedHistories = new Hashtable(); // private static Cache privateCache = new Cache(); private static ICache privateCache = new Cache(); private static DateTime minDate = DateTime.MinValue; private static DateTime maxDate = DateTime.MaxValue; private static DateTime timeForOpen = new DateTime( 1900 , 1 , 1 , 9 , 30 , 0 ); private static DateTime timeForClose = new DateTime( 1900 , 1 , 1 , 16 , 0 , 0 ); private static DateTime timeForOneHourAfterMarketClose = timeForClose.AddHours( 1 ); /// <summary> /// When defined, sets the minimum DateTime to be cached /// </summary> public static DateTime MinDate { get { return minDate; } set { minDate = value; } } /// <summary> /// When defined, sets the maximum DateTime to be cached /// </summary> public static DateTime MaxDate { get { return maxDate; } set { maxDate = value; } } /// <summary> /// Caching class /// </summary> public static ICache Cache { get { return privateCache; } set { privateCache = value; } } /// <summary> /// Provides historical data /// </summary> public HistoricalQuotesProvider() { // // TODO: Add constructor logic here // } private static void checkIfIsDate( DateTime dateTime ) { if ( !ExtendedDateTime.IsDate( dateTime ) ) throw new Exception( "The given dateTime contains time also. It must be a just date." ); } // to be deleted public static void Add( string instrumentKey ) { Hashtable barComponentHistories = new Hashtable(); cachedHistories.Add( instrumentKey , barComponentHistories ); } /// <summary> /// Adds a new instrument quote history to be cached in memory /// </summary> /// <param name="instrument">Instrument to be monitored</param> /// <param name="barComponent">Bar component to be monitored (Open, High, Low, Close or Volume)</param> public static void Add( string instrumentKey , QuoteField quoteField ) { if ( !cachedHistories.ContainsKey( instrumentKey ) ) cachedHistories.Add( instrumentKey , new Hashtable() ); ((Hashtable) cachedHistories[ instrumentKey ]).Add( quoteField , quoteField ); } // //public static void // // public static void SetCachedHistories( // DateTime startDateTime , DateTime endDateTime ) // { // ArrayList keyArray = new ArrayList(); // foreach (string instrumentKey in cachedHistories.Keys) // keyArray.Add( instrumentKey ); // foreach (string instrumentKey in keyArray ) // { // Hashtable barComponents = new Hashtable(); // foreach (BarComponent barComponent in // (( Hashtable )cachedHistories[ instrumentKey ]).Keys ) // barComponents.Add( barComponent , barComponent ); // Hashtable histories = DataBase.GetHistories( // instrumentKey , barComponents , startDateTime , endDateTime ); // cachedHistories[ instrumentKey ] = histories; // } // } // private static History getHistory( string instrumentKey , QuoteField quoteField ) { if ( ( !cachedHistories.Contains( instrumentKey ) ) || ( !((Hashtable)cachedHistories[ instrumentKey ]).Contains( quoteField ) ) ) { Add( instrumentKey , quoteField ); ((Hashtable)cachedHistories[ instrumentKey ])[ quoteField ] = DataBase.GetHistory( instrumentKey , quoteField ); } return (History)((Hashtable)cachedHistories[ instrumentKey ])[ quoteField ]; } private static History getHistory( string ticker , QuoteField quoteField , DateTime firstDate , DateTime lastDate ) { History returnValue = new History(); DateTime currentDate = firstDate; while ( currentDate <= lastDate ) { returnValue.Add( currentDate , privateCache.GetQuote( ticker , currentDate , quoteField ) ); currentDate = currentDate.AddDays( 1 ); } return returnValue; } public static History GetOpenHistory( string instrumentKey ) { return getHistory( instrumentKey , QuoteField.Open ); } public static History GetCloseHistory( string instrumentKey ) { return getHistory( instrumentKey , QuoteField.Close ); } public static History GetHighHistory( string instrumentKey ) { return getHistory( instrumentKey , QuoteField.High ); } public static History GetLowHistory( string instrumentKey ) { return getHistory( instrumentKey , QuoteField.Low ); } public static History GetAdjustedCloseHistory( string instrumentKey ) { return getHistory( instrumentKey , QuoteField.AdjustedClose ); } public static History GetAdjustedCloseHistory( string ticker , DateTime firstDate , DateTime lastDate ) { return getHistory( ticker , QuoteField.AdjustedClose , firstDate , lastDate ); } private static History cache_getHistory( string instrumentKey , QuoteField quoteField ) { History returnValue; if ( ( MinDate != DateTime.MinValue ) && ( MaxDate != DateTime.MaxValue ) ) // the script has set a min date value and a max date value for the historical quotes returnValue = DataBase.GetHistory( instrumentKey , quoteField , MinDate , MaxDate ); else // the script has NOT set a min date value and a max date value for the historical quotes returnValue = DataBase.GetHistory( instrumentKey , quoteField ); return returnValue; } private static void cache( string instrumentKey , QuoteField quoteField ) { if ( !cachedHistories.ContainsKey( instrumentKey ) ) // no component at all for the instrument instrumentKey has been cached yet cachedHistories.Add( instrumentKey , new Hashtable() ); History quoteHistory = cache_getHistory( instrumentKey , quoteField ); ((Hashtable)cachedHistories[ instrumentKey ]).Add( quoteField , quoteHistory ); } #region GetAdjustedMarketValue private static double getAdjustedMarketValue_actually( string instrumentKey , DateTime date , MarketStatusSwitch marketStatusSwitch ) { double adjustedMarketValue; double adjustedClose = privateCache.GetQuote( instrumentKey , date , QuoteField.AdjustedClose ); if ( marketStatusSwitch == MarketStatusSwitch.Close ) // the requested quote is at market close adjustedMarketValue = adjustedClose; else { // the requested quote is at market open double rawOpen = privateCache.GetQuote( instrumentKey , date , QuoteField.Open ); double rawClose = privateCache.GetQuote( instrumentKey , date , QuoteField.Close ); adjustedMarketValue = rawOpen * adjustedClose / rawClose; } return adjustedMarketValue; // double rawOpen = privateCache.GetQuote( // instrumentKey , date , QuoteField.Open ); // double rawClose = privateCache.GetQuote( instrumentKey , // extendedDateTime.DateTime , QuoteField.Close ); // double returnValue = // rawOpen * adjustedClose / rawClose; // if ( extendedDateTime.BarComponent == BarComponent.Close ) // returnValue = adjustedClose; // else // // extendedDateTime.BarComponent is equal to BarComponent.Open // { // double open = privateCache.GetQuote( instrumentKey , // extendedDateTime.DateTime , QuoteField.Open ); // double close = privateCache.GetQuote( instrumentKey , // extendedDateTime.DateTime , QuoteField.Close ); // returnValue = open * adjustedClose / close; // } } /// <summary> /// Returns the adjusted market value for the given ticker, /// at the given DateTime /// </summary> /// <param name="instrumentKey">instrument identifier</param> /// <param name="dateTime"></param> /// <returns></returns> public static double GetAdjustedMarketValue( string instrumentKey , DateTime date , MarketStatusSwitch marketStatusSwitch ) { HistoricalQuotesProvider.checkIfIsDate( date ); double returnValue = HistoricalQuotesProvider.getAdjustedMarketValue_actually( instrumentKey , date , marketStatusSwitch ); return returnValue; } #endregion GetAdjustedMarketValue #region GetRawMarketValue private static double getRawMarketValue_actually( string ticker , DateTime date , MarketStatusSwitch marketStatusSwitch ) { double rawMarketValue; if ( marketStatusSwitch == MarketStatusSwitch.Open ) // the requested quote is at market open rawMarketValue = privateCache.GetQuote( ticker , date , QuoteField.Open ); else // the requested quote is at market close rawMarketValue = privateCache.GetQuote( ticker , date , QuoteField.Close ); return rawMarketValue; } /// <summary> /// Returns the raw market value for the given ticker, /// at the given DateTime /// </summary> /// <param name="ticker">instrument identifier</param> /// <param name="dateTime"></param> /// <returns></returns> public static double GetRawMarketValue( string ticker , DateTime date , MarketStatusSwitch marketStatusSwitch ) { HistoricalQuotesProvider.checkIfIsDate( date ); double rawMarketValue = HistoricalQuotesProvider.getRawMarketValue_actually( ticker , date , marketStatusSwitch ); return rawMarketValue; } #endregion GetRawMarketValue // public static bool WasExchanged( string instrumentKey , ExtendedDateTime extendedDateTime ) // { // ExtendedDateTime atClose = new ExtendedDateTime( // extendedDateTime.DateTime , BarComponent.Close ); // double marketValue = GetRawMarketValue( instrumentKey , // atClose ); // forces caching if needed // History instrumentQuotes = // (History)((Hashtable)cachedHistories[ instrumentKey ])[ QuoteField.Close ]; // bool returnValue = instrumentQuotes.ContainsKey( extendedDateTime.DateTime ); // return returnValue; // } public static bool WasExchanged( string ticker , DateTime dateTime ) { return privateCache.WasExchanged( ticker , dateTime ); } /// <summary> /// returns the quotes DataTable for the given ticker /// </summary> /// <param name="instrumentKey">ticker whose quotes are to be returned</param> /// <returns></returns> public static DataTable GetTickerQuotes( string instrumentKey ) { return QuantProject.DataAccess.Tables.Quotes.GetTickerQuotes( instrumentKey ); } #region GetQuotes #region getQuotes_actually private static QuantProject.Data.DataTables.Quotes getQuotesDataTable( ICollection tickerCollection , DateTime dateTime ) { DateTime date = ExtendedDateTime.GetDate( dateTime ); QuantProject.Data.DataTables.Quotes dtQuotes = new QuantProject.Data.DataTables.Quotes( tickerCollection , date ); return dtQuotes; } private static double getQuotes_getAdjustedQuote( DataRow dataRow , DateTime date , MarketStatusSwitch marketStatusSwitch ) { double returnValue; /// TO DO: evaluate to use a Quote class, that derives from the DataRow class /// and use properties instead of dataRow accessing if ( marketStatusSwitch == MarketStatusSwitch.Close ) // the requested quote is at market close returnValue = (double)dataRow[ QuantProject.Data.DataTables.Quotes.AdjustedClose ]; else // the requested quote is at market open returnValue = (double)dataRow[ QuantProject.Data.DataTables.Quotes.Open ] * (double)dataRow[ QuantProject.Data.DataTables.Quotes.AdjustedClose ] / (double)dataRow[ QuantProject.Data.DataTables.Quotes.Close ]; return returnValue; } private static Hashtable getAdjustedQuotes_actually( ICollection tickerCollection , DateTime date , MarketStatusSwitch marketStatusSwitch ) { QuantProject.Data.DataTables.Quotes dtQuotes = HistoricalQuotesProvider.getQuotesDataTable( tickerCollection , date ); Hashtable returnValue = new Hashtable(); foreach (DataRow dataRow in dtQuotes.Rows) returnValue.Add( dataRow[ QuantProject.Data.DataTables.Quotes.TickerFieldName ] , HistoricalQuotesProvider.getQuotes_getAdjustedQuote( dataRow , date , marketStatusSwitch ) ); return returnValue; } #endregion getQuotes_actually /// <summary> /// Returns the hashtable containing, for each ticker, the /// quote for the given extended date time /// </summary> /// <param name="tickerCollection">List of tickers whose quotes are to be fetched</param> /// <param name="extendedDateTime"></param> /// <returns></returns> public static Hashtable GetAdjustedQuotes( ICollection tickerCollection , DateTime date , MarketStatusSwitch marketStatusSwitch ) { HistoricalQuotesProvider.checkIfIsDate( date ); Hashtable htQuotes = HistoricalQuotesProvider.getAdjustedQuotes_actually( tickerCollection , date , marketStatusSwitch ); return htQuotes; } #endregion GetQuotes } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:07:36
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Quotes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9694/Quotes Log Message: Directory /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Quotes added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:06:41
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9167/DataProviders Removed Files: HistoricalDataProvider.cs NewExtendedDateTimeEventArgs.cs Timer.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- NewExtendedDateTimeEventArgs.cs DELETED --- --- Timer.cs DELETED --- --- HistoricalDataProvider.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:03:46
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6264 Modified Files: Business_SD.csproj Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Business_SD.csproj 14 Aug 2008 23:44:43 -0000 1.28 --- Business_SD.csproj 29 Sep 2008 21:03:22 -0000 1.29 *************** *** 38,45 **** </PropertyGroup> <ItemGroup> - <Reference Include="Interop.Excel"> - <HintPath>..\..\Interop.Excel.dll</HintPath> - <SpecificVersion>False</SpecificVersion> - </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> --- 38,41 ---- *************** *** 47,67 **** <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> - <Reference Include="Interop.VBIDE"> - <HintPath>..\..\Interop.VBIDE.dll</HintPath> - <Private>True</Private> - </Reference> - <Reference Include="Interop.Office"> - <HintPath>..\..\Interop.Office.dll</HintPath> - <Private>True</Private> - </Reference> <Reference Include="System.Runtime.Serialization.Formatters.Soap" /> </ItemGroup> <ItemGroup> ! <Compile Include="a05_Timing\EndOfDayHistory.cs" /> ! <Compile Include="a07_DataProviders\HistoricalQuoteProvider.cs" /> <Compile Include="a07_DataProviders\TickerNotExchangedException.cs" /> <Compile Include="a1_Financial\a2_Accounting\AccountProviding\IAccountProvider.cs" /> <Compile Include="a1_Financial\a2_Accounting\AccountProviding\InteractiveBrokerAccountProvider.cs" /> <Compile Include="a1_Financial\a2_Accounting\AccountProviding\SimpleAccountProvider.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\StatisticsSummaryRows\AverageReturnOnDayOfWeekWithOpenPositions.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\StatisticsSummaryRows\AverageReturnOnDayWithOpenPositions.cs" /> --- 43,57 ---- <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> <Reference Include="System.Runtime.Serialization.Formatters.Soap" /> </ItemGroup> <ItemGroup> ! <Compile Include="a05_Timing\Timer.cs" /> ! <Compile Include="a07_DataProviders\HistoricalMarketValueProvider.cs" /> <Compile Include="a07_DataProviders\TickerNotExchangedException.cs" /> <Compile Include="a1_Financial\a2_Accounting\AccountProviding\IAccountProvider.cs" /> <Compile Include="a1_Financial\a2_Accounting\AccountProviding\InteractiveBrokerAccountProvider.cs" /> <Compile Include="a1_Financial\a2_Accounting\AccountProviding\SimpleAccountProvider.cs" /> + <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\DateTimeSelectorsForEquityLine\IDateTimeSelectorForEquityLine.cs" /> + <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\DateTimeSelectorsForEquityLine\SelectorForMaketClose.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\StatisticsSummaryRows\AverageReturnOnDayOfWeekWithOpenPositions.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\StatisticsSummaryRows\AverageReturnOnDayWithOpenPositions.cs" /> *************** *** 73,76 **** --- 63,67 ---- <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AverageNumberOfTransactionsPerDay.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\Tables\StatisticsSummary.cs" /> + <Compile Include="a1_Financial\a2_Accounting\Transactions\TimedTransaction.cs" /> <Compile Include="a2_Strategies\Benchmark.cs" /> <Compile Include="a2_Strategies\Eligibles\ByPriceLessVolatileOTCAlwaysQuoted.cs" /> *************** *** 83,89 **** <Compile Include="a2_Strategies\Eligibles\IEligiblesSelector.cs" /> <Compile Include="a2_Strategies\EndOfDayStrategies\BasicEndOfDayStrategyForBacktester.cs" /> <Compile Include="a2_Strategies\EndOfDayStrategies\SymmetricEndOfDayStrategyForBacktester.cs" /> <Compile Include="a2_Strategies\EndOfDayStrategyBackTester.cs" /> - <Compile Include="a2_Strategies\IEndOfDayStrategyForBacktester.cs" /> <Compile Include="a2_Strategies\InSample\BruteForceChooser.cs" /> <Compile Include="a2_Strategies\InSample\ConstantWeightedPositionsChooser.cs" /> --- 74,81 ---- <Compile Include="a2_Strategies\Eligibles\IEligiblesSelector.cs" /> <Compile Include="a2_Strategies\EndOfDayStrategies\BasicEndOfDayStrategyForBacktester.cs" /> + <Compile Include="a2_Strategies\EndOfDayStrategies\EndOfDayStrategy.cs" /> + <Compile Include="a2_Strategies\EndOfDayStrategies\EndOfDayTimerHandler.cs" /> <Compile Include="a2_Strategies\EndOfDayStrategies\SymmetricEndOfDayStrategyForBacktester.cs" /> <Compile Include="a2_Strategies\EndOfDayStrategyBackTester.cs" /> <Compile Include="a2_Strategies\InSample\BruteForceChooser.cs" /> <Compile Include="a2_Strategies\InSample\ConstantWeightedPositionsChooser.cs" /> *************** *** 92,95 **** --- 84,89 ---- <Compile Include="a2_Strategies\InSample\GeneticChooser.cs" /> <Compile Include="a2_Strategies\InSample\IInSampleChooser.cs" /> + <Compile Include="a2_Strategies\IStrategy.cs" /> + <Compile Include="a2_Strategies\IStrategyForBacktester.cs" /> <Compile Include="a2_Strategies\Logging\BackTestLog.cs" /> <Compile Include="a2_Strategies\Logging\DummyLogItem.cs" /> *************** *** 140,162 **** <Compile Include="a0_Validation\Validators\OHLCvalidator.cs" /> <Compile Include="a0_Validation\Validators\RangeToRangeValidator.cs" /> - <Compile Include="a05_Timing\EndOfDayDateTime.cs" /> - <Compile Include="a05_Timing\EndOfDaySpecificTime.cs" /> - <Compile Include="a05_Timing\EndOfDayTimingEventArgs.cs" /> <Compile Include="a05_Timing\HistoricalEndOfDayTimer.cs" /> - <Compile Include="a05_Timing\IEndOfDayTimer.cs" /> <Compile Include="a05_Timing\IndexBasedEndOfDayTimer.cs" /> <Compile Include="a07_DataProviders\HistoricalAdjustedQuoteProvider.cs" /> <Compile Include="a07_DataProviders\HistoricalEndOfDayDataStreamer.cs" /> <Compile Include="a07_DataProviders\HistoricalRawQuoteProvider.cs" /> - <Compile Include="a07_DataProviders\IHistoricalQuoteProvider.cs" /> <Compile Include="a1_Financial\a1_Instruments\Instrument.cs" /> <Compile Include="a1_Financial\a1_Instruments\Instruments.cs" /> - <Compile Include="a1_Financial\a1_Instruments\QuoteCache.cs" /> <Compile Include="a1_Financial\a2_Accounting\Account.cs" /> - <Compile Include="a1_Financial\a2_Accounting\AccountReportRecord.cs" /> <Compile Include="a1_Financial\a2_Accounting\Accounts.cs" /> <Compile Include="a1_Financial\a2_Accounting\Portfolio.cs" /> <Compile Include="a1_Financial\a2_Accounting\Position.cs" /> - <Compile Include="a1_Financial\a2_Accounting\TimedTransaction.cs" /> <Compile Include="a1_Financial\a2_Accounting\Transaction.cs" /> <Compile Include="a1_Financial\a2_Accounting\TransactionType.cs" /> --- 134,148 ---- *************** *** 190,194 **** <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\Tables\Summary.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\Tables\Transactions.cs" /> - <Compile Include="a1_Financial\a2_Accounting\Transactions\EndOfDayTransaction.cs" /> <Compile Include="a1_Financial\a2_Accounting\Transactions\TransactionHistory.cs" /> <Compile Include="a1_Financial\a3_Ordering\HistoricalEndOfDayOrderExecutor.cs" /> --- 176,179 ---- *************** *** 219,223 **** <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\IntegerSummaryRow.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\PercentageSummaryRow.cs" /> - <Compile Include="a2_Strategies\IEndOfDayStrategy.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\SharpeRatio.cs" /> <Compile Include="a1_Financial\a2_Accounting\EquityLine.cs" /> --- 204,207 ---- *************** *** 257,260 **** --- 241,245 ---- </ProjectReference> <Folder Include="a1_Financial\a2_Accounting\AccountProviding" /> + <Folder Include="a1_Financial\a2_Accounting\h5_Reporting\DateTimeSelectorsForEquityLine" /> <Folder Include="a1_Financial\a2_Accounting\h5_Reporting\StatisticsSummaryRows" /> <Folder Include="a2_Strategies\EndOfDayStrategies" /> |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:03:09
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5292/a2_Strategies Added Files: IStrategy.cs IStrategyForBacktester.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- NEW FILE: IStrategyForBacktester.cs --- /* QuantProject - Quantitative Finance Library IStrategyForBacktester.cs Copyright (C) 2007 Glauco Siliprandi 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.ADT.Messaging; using QuantProject.Business.Strategies.Logging; namespace QuantProject.Business.Strategies { public delegate void NewLogItemEventHandler( Object sender , NewLogItemEventArgs eventArgs ); /// <summary> /// Interface to be implemented by end of day strategies that are /// to be used by the EndOfDayStrategyBackTester /// </summary> public interface IStrategyForBacktester : IStrategy , ILogDescriptor , IMessageSender { /// <summary> /// use this property to signal to the end of day backtester that at current time /// a long execution is expected, so that it will decide to stop the execution if /// maxRunningHours have already expired. If this property returns false, the /// end of day backtesters goes on with its work (that should be all out /// of sample and then pretty fast). If you want the backtester to stop /// whenever maxRunningHours have elapsed, then set this property /// to always return true /// </summary> bool StopBacktestIfMaxRunningHoursHasBeenReached{ get; } event NewLogItemEventHandler NewLogItem; } } --- NEW FILE: IStrategy.cs --- /* QuantProject - Quantitative Finance Library IStrategy.cs Copyright (C) 2003 Glauco Siliprandi 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.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Transactions; using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Timing; namespace QuantProject.Business.Strategies { /// <summary> /// Interface to be implemented by end of day strategies /// </summary> public interface IStrategy { void NewDateTimeEventHandler( Object sender , DateTime dateTime ); Account Account{get;set;} } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:03:08
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5292/a2_Strategies/EndOfDayStrategies Added Files: EndOfDayStrategy.cs EndOfDayTimerHandler.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- NEW FILE: EndOfDayTimerHandler.cs --- /* QuantProject - Quantitative Finance Library EndOfDayStrategy.cs Copyright (C) 2008 Glauco Siliprandi 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.Timing; namespace QuantProject.Business.Strategies { /// <summary> /// Abstract class to be extended by end of day timer handlers /// </summary> public abstract class EndOfDayTimerHandler { public EndOfDayTimerHandler() { } #region NewDateTimeEventHandler protected abstract void marketOpenEventHandler( Object sender , DateTime dateTime ) ; protected abstract void marketCloseEventHandler( Object sender , DateTime dateTime ) ; protected abstract void oneHourAfterMarketCloseEventHandler( Object sender , DateTime dateTime ) ; public virtual void NewDateTimeEventHandler( Object sender , DateTime dateTime ) { if ( HistoricalEndOfDayTimer.IsMarketOpen( dateTime ) ) this.marketOpenEventHandler( sender , dateTime ); if ( HistoricalEndOfDayTimer.IsMarketClose( dateTime ) ) this.marketCloseEventHandler( sender , dateTime ); if ( HistoricalEndOfDayTimer.IsOneHourAfterMarketClose( dateTime ) ) this.oneHourAfterMarketCloseEventHandler( sender , dateTime ); } #endregion NewDateTimeEventHandler } } --- NEW FILE: EndOfDayStrategy.cs --- /* QuantProject - Quantitative Finance Library EndOfDayStrategy.cs Copyright (C) 2008 Glauco Siliprandi 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.Financial.Accounting; namespace QuantProject.Business.Strategies { /// <summary> /// Abstract class to be implemented by an end of day strategy /// </summary> public abstract class EndOfDayStrategy : EndOfDayTimerHandler , IStrategy { protected Account account; public Account Account { get { return this.account; } set { this.account = value; } } public EndOfDayStrategy() { } } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:03:03
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Transactions In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5292/a1_Financial/a2_Accounting/Transactions Added Files: TimedTransaction.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- NEW FILE: TimedTransaction.cs --- /* QuantProject - Quantitative Finance Library TimedTransaction.cs Copyright (C) 2003 Glauco Siliprandi 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.ADT; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; namespace QuantProject.Business.Financial.Accounting.Transactions { /// <summary> /// Transaction to be used with strategies /// </summary> [Serializable] public class TimedTransaction : Transaction { private DateTime dateTime; public DateTime DateTime { get { return this.dateTime; } } public TimedTransaction( TransactionType transactionType , Double transactionAmount , DateTime dateTime ) : base( transactionType , transactionAmount ) { //base( transactionType , transactionAmount ); this.dateTime = dateTime; } public TimedTransaction( TransactionType transactionType , Instrument instrument , long quantity , double instrumentPrice , DateTime dateTime ) : base( transactionType , instrument , quantity , instrumentPrice ) { this.dateTime = dateTime; } static public TransactionType GetTransactionType( OrderType orderType ) { TransactionType returnValue; switch ( orderType ) { case OrderType.LimitBuy: returnValue = TransactionType.BuyLong; break; case OrderType.MarketBuy: returnValue = TransactionType.BuyLong; break; case OrderType.LimitCover: returnValue = TransactionType.Cover; break; case OrderType.MarketCover: returnValue = TransactionType.Cover; break; case OrderType.LimitSell: returnValue = TransactionType.Sell; break; case OrderType.MarketSell: returnValue = TransactionType.Sell; break; case OrderType.LimitSellShort: returnValue = TransactionType.SellShort; break; case OrderType.MarketSellShort: returnValue = TransactionType.SellShort; break; //this line should never be reached! default: returnValue = TransactionType.AddCash; break; } return returnValue; } public override string ToString() { return base.ToString() + "\n DateTime: " + this.dateTime.ToString(); } } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:03:00
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5292/a07_DataProviders Added Files: HistoricalMarketValueProvider.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- NEW FILE: HistoricalMarketValueProvider.cs --- /* QuantProject - Quantitative Finance Library HistoricalMarketValueProvider.cs Copyright (C) 2007 Glauco Siliprandi 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.ADT.Histories; using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Timing; using QuantProject.Data.DataProviders.Quotes; namespace QuantProject.Business.DataProviders { /// <summary> /// Abstract base class for historical market values providers /// </summary> [Serializable] public abstract class HistoricalMarketValueProvider : ILogDescriptor { public string Description { get { return "QtPrvdr_" + this.getDescription(); } } public HistoricalMarketValueProvider() { } protected abstract string getDescription(); public abstract double GetMarketValue( string ticker , DateTime dateTime ); /// <summary> /// True iif the given ticker was traded at the given DateTime /// </summary> /// <param name="ticker"></param> /// <param name="dateTime"></param> /// <returns></returns> public bool WasExchanged( string ticker , DateTime dateTime ) { bool wasExchanged = HistoricalQuotesProvider.WasExchanged( ticker , dateTime ); return wasExchanged; } #region GetQuotes #region addQuoteActually private double getMarketValue( string ticker , DateTime dateTime ) { double marketValue = this.GetMarketValue( ticker , dateTime ); return marketValue; } private void addQuoteActually( string ticker , DateTime dateTime , History quotes ) { double marketValue = this.getMarketValue( ticker , dateTime ); quotes.Add( dateTime , marketValue ); } #endregion addQuoteActually private void addMarketValue( string ticker , int historyIndex , History history , History quotes ) { DateTime currentDateTime = (DateTime)history.GetByIndex( historyIndex ); if ( this.WasExchanged( ticker , currentDateTime ) ) { this.addQuoteActually( ticker , currentDateTime , quotes ); } else throw new TickerNotExchangedException( ticker , currentDateTime ); } public History GetMarketValues( string ticker , History history ) { History quotes = new History(); for ( int i = 0 ; i < history.Count ; i++ ) this.addMarketValue( ticker , i , history , quotes ); return quotes; } #endregion GetQuotes } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:02:57
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5292/a05_Timing Added Files: Timer.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- NEW FILE: Timer.cs --- /* QuantProject - Quantitative Finance Library Timer.cs Copyright (C) 2008 Glauco Siliprandi 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.ADT; namespace QuantProject.Business.Timing { public delegate void NewDateTimeEventHandler( Object sender , DateTime dateTime ); /// <summary> /// Class to be extended by timers for simulations /// </summary> [Serializable] public abstract class Timer { public event NewDateTimeEventHandler NewDateTime; protected bool isActive; // true iff the timer is started and not stopped protected DateTime currentDateTime; public bool IsActive { get { return this.isActive; } } public Timer() { } protected abstract void initializeTimer(); protected abstract void moveNext(); /// <summary> /// The last date time sent out /// </summary> /// <returns></returns> public virtual DateTime GetCurrentDateTime() { if ( !this.isActive ) throw new Exception( "Either Start() has not been invoked yet, or " + "Stop() has already been invoked" ); return this.currentDateTime; } #region Start #region activateTimer private void activateTimer() { this.initializeTimer(); this.isActive = true; } #endregion activateTimer /// <summary> /// Starts the time walking simulation /// </summary> private void callEvents() { if ( this.NewDateTime != null ) this.NewDateTime( this , new DateTime( this.currentDateTime.Year , this.currentDateTime.Month , this.currentDateTime.Day , this.currentDateTime.Hour , this.currentDateTime.Minute , this.currentDateTime.Second ) ); // if ( ( this.MarketOpen != null ) && ( this.currentTime.EndOfDaySpecificTime == // EndOfDaySpecificTime.MarketOpen ) ) // this.MarketOpen( this , new EndOfDayTimingEventArgs( this.currentTime ) ); // if ( ( this.FiveMinutesBeforeMarketClose != null ) && ( this.currentTime.EndOfDaySpecificTime == // EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ) ) // this.FiveMinutesBeforeMarketClose( this , new EndOfDayTimingEventArgs( this.currentTime ) ); // if ( ( this.MarketClose != null ) && ( this.currentTime.EndOfDaySpecificTime == // EndOfDaySpecificTime.MarketClose ) ) // this.MarketClose( this , new EndOfDayTimingEventArgs( this.currentTime ) ); // if ( ( this.OneHourAfterMarketClose != null ) && ( this.currentTime.EndOfDaySpecificTime == // EndOfDaySpecificTime.OneHourAfterMarketClose ) ) // this.OneHourAfterMarketClose( this , new EndOfDayTimingEventArgs( this.currentTime ) ); } /// <summary> /// The timer is instructed to begin to fire timing events /// </summary> public virtual void Start() { this.activateTimer(); while ( this.isActive ) { this.callEvents(); this.moveNext(); } } #endregion Start /// <summary> /// The timer is instructed to stop to fire timing events /// </summary> public void Stop() { this.isActive = false; } } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:00:01
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/DateTimeSelectorsForEquityLine In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2077/DateTimeSelectorsForEquityLine Log Message: Directory /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/DateTimeSelectorsForEquityLine added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-09-29 20:54:40
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30003/a2_Strategies Removed Files: IEndOfDayStrategy.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- IEndOfDayStrategy.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2008-09-29 20:54:39
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a1_Instruments In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30003/a1_Financial/a1_Instruments Removed Files: QuoteCache.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- QuoteCache.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2008-09-29 20:54:38
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Transactions In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30003/a1_Financial/a2_Accounting/Transactions Removed Files: EndOfDayTransaction.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- EndOfDayTransaction.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2008-09-29 20:54:36
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30003/a1_Financial/a2_Accounting Removed Files: AccountReportRecord.cs TimedTransaction.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- TimedTransaction.cs DELETED --- --- AccountReportRecord.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2008-09-29 20:54:33
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30003/a07_DataProviders Removed Files: IHistoricalQuoteProvider.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- IHistoricalQuoteProvider.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2008-09-29 20:54:32
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30003/a05_Timing Removed Files: EndOfDayTimingEventArgs.cs IEndOfDayTimer.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- IEndOfDayTimer.cs DELETED --- --- EndOfDayTimingEventArgs.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2008-09-29 20:49:47
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24339/a2_Strategies Removed Files: IEndOfDayStrategyForBacktester.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. --- IEndOfDayStrategyForBacktester.cs DELETED --- |