quantproject-developers Mailing List for QuantProject (Page 120)
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...> - 2005-01-09 23:42:15
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a1_Instruments In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15367/b4_Business/a1_Financial/a1_Instruments Modified Files: QuoteCache.cs Log Message: The SetCache method has been removed Index: QuoteCache.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a1_Instruments/QuoteCache.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QuoteCache.cs 23 Aug 2004 22:36:47 -0000 1.2 --- QuoteCache.cs 9 Jan 2005 23:42:02 -0000 1.3 *************** *** 49,59 **** } ! public static void SetCache( DateTime startDateTime , DateTime endDateTime ) ! { ! foreach ( Object[] array in quoteIdentifierList ) ! HistoricalDataProvider.Add( ((Instrument) array[ 0 ]).Key , (BarComponent) array[ 1 ] ); ! HistoricalDataProvider.SetCachedHistories( ! startDateTime , endDateTime ); ! } public static History GetOpenHistory( string instrumentKey ) --- 49,59 ---- } ! // public static void SetCache( DateTime startDateTime , DateTime endDateTime ) ! // { ! // foreach ( Object[] array in quoteIdentifierList ) ! // HistoricalDataProvider.Add( ((Instrument) array[ 0 ]).Key , (BarComponent) array[ 1 ] ); ! // HistoricalDataProvider.SetCachedHistories( ! // startDateTime , endDateTime ); ! // } public static History GetOpenHistory( string instrumentKey ) |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:35:59
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13908/b4_Business/a1_Financial/a2_Accounting Modified Files: Portfolio.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced - the GetMarketValue method uses an IDataStreamer now Index: Portfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Portfolio.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Portfolio.cs 29 Dec 2004 17:11:57 -0000 1.4 --- Portfolio.cs 9 Jan 2005 23:35:47 -0000 1.5 *************** *** 25,30 **** --- 25,32 ---- using System.Diagnostics; using QuantProject.ADT; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Timing; + using QuantProject.Data.DataProviders; namespace QuantProject.Business.Financial.Accounting *************** *** 126,137 **** #endregion ! public double GetMarketValue( EndOfDayDateTime endOfDayDateTime ) { double totalValue = 0; foreach (Position position in this.Values) ! totalValue += position.Instrument.GetMarketValue( endOfDayDateTime ) * position.Quantity; return totalValue; } - public override string ToString() { --- 128,148 ---- #endregion ! public double GetMarketValue( EndOfDayDateTime endOfDayDateTime , ! IHistoricalQuoteProvider historicalQuoteProvider ) { double totalValue = 0; foreach (Position position in this.Values) ! totalValue += historicalQuoteProvider.GetMarketValue( ! position.Instrument.Key , endOfDayDateTime ) * position.Quantity; ! return totalValue; ! } ! public double GetMarketValue( IDataStreamer dataStreamer ) ! { ! double totalValue = 0; ! foreach (Position position in this.Values) ! totalValue += dataStreamer.GetCurrentBid( ! position.Instrument.Key ) * position.Quantity; return totalValue; } public override string ToString() { |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:33:38
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13229/b2_DataAccess Added Files: QuoteField.cs Log Message: Fields for the Quote table --- NEW FILE: QuoteField.cs --- /* QuantProject - Quantitative Finance Library QuoteField.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.DataAccess { /// <summary> /// Fields for the Quote table /// </summary> public enum QuoteField { Open, High, Low, Close, Volume, AdjustedClose, AdjustedCloseToCloseRatio } } |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:32:01
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12780/b4_Business/a07_DataProviders Added Files: HistoricalAdjustedQuoteProvider.cs Log Message: Returns historical adjusted quotes --- NEW FILE: HistoricalAdjustedQuoteProvider.cs --- /* QuantProject - Quantitative Finance Library HistoricalAdjustedQuoteProvider.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.Timing; using QuantProject.Data.DataProviders; namespace QuantProject.Business.DataProviders { /// <summary> /// Returns historical adjusted quotes /// </summary> public class HistoricalAdjustedQuoteProvider : IHistoricalQuoteProvider { public HistoricalAdjustedQuoteProvider() { } public double GetMarketValue( string instrumentKey , EndOfDayDateTime endOfDayDateTime ) { return HistoricalDataProvider.GetAdjustedMarketValue( instrumentKey , endOfDayDateTime.GetNearestExtendedDateTime() ); } } } |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:31:10
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12537/b4_Business/a07_DataProviders Added Files: HistoricalRawQuoteProvider.cs Log Message: Returns historical raw quotes --- NEW FILE: HistoricalRawQuoteProvider.cs --- /* QuantProject - Quantitative Finance Library HistoricalRawQuoteProvider.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.Timing; using QuantProject.Data.DataProviders; namespace QuantProject.Business.DataProviders { /// <summary> /// Returns historical raw quotes /// </summary> public class HistoricalRawQuoteProvider : IHistoricalQuoteProvider { public HistoricalRawQuoteProvider() { } public double GetMarketValue( string instrumentKey , EndOfDayDateTime endOfDayDateTime ) { return HistoricalDataProvider.GetRawMarketValue( instrumentKey , endOfDayDateTime.GetNearestExtendedDateTime() ); } } } |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:29:51
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12071/b4_Business/a07_DataProviders Added Files: IHistoricalQuoteProvider.cs Log Message: Interface to be implemented by historical quote providers --- NEW FILE: IHistoricalQuoteProvider.cs --- /* QuantProject - Quantitative Finance Library IHistoricalQuoteProvider.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.Data; using QuantProject.ADT; using QuantProject.ADT.Histories; using QuantProject.Data.DataTables; using QuantProject.Business.Timing; namespace QuantProject.Business.DataProviders { /// <summary> /// Interface to be implemented by historical quote providers /// </summary> public interface IHistoricalQuoteProvider { /// <summary> /// Returns the historical market value for the given instrument at the given time /// </summary> /// <param name="instrumentKey">instrument identifier</param> /// <param name="endOfDayDateTime">end of day date time for the market evaluation</param> /// <returns></returns> double GetMarketValue( string instrumentKey , EndOfDayDateTime endOfDayDateTime ); } } |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:28:39
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11718/b4_Business/a1_Financial/a3_Ordering Modified Files: OrderManager.cs Log Message: - GetInstrumentPrice has been removed - IDataStreamer is used now Index: OrderManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering/OrderManager.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OrderManager.cs 29 Nov 2004 16:15:37 -0000 1.3 --- OrderManager.cs 9 Jan 2005 23:28:30 -0000 1.4 *************** *** 42,50 **** } ! public virtual double GetInstrumentPrice( Order order ) ! { ! return HistoricalDataProvider.GetMarketValue( order.Instrument.Key , ! order.EndOfDayDateTime.GetNearestExtendedDateTime() ); ! } #region "GetTransaction" --- 42,50 ---- } ! // public virtual double GetInstrumentPrice( Order order ) ! // { ! // return HistoricalDataProvider.GetMarketValue( order.Instrument.Key , ! // order.EndOfDayDateTime.GetNearestExtendedDateTime() ); ! // } #region "GetTransaction" *************** *** 75,84 **** } ! public TimedTransaction GetTransaction( Order order ) { ! double instrumentPrice = this.GetInstrumentPrice( order ); TimedTransaction transaction = new TimedTransaction( getTransactionType( order ) , order.Instrument , ! order.Quantity , order.Instrument.GetMarketValue( order.EndOfDayDateTime ) , order.EndOfDayDateTime.GetNearestExtendedDateTime() ); return transaction; --- 75,86 ---- } ! public TimedTransaction GetTransaction( Order order , ! IDataStreamer dataStreamer ) { ! double instrumentPrice = dataStreamer.GetCurrentBid( ! order.Instrument.Key ); TimedTransaction transaction = new TimedTransaction( getTransactionType( order ) , order.Instrument , ! order.Quantity , instrumentPrice , order.EndOfDayDateTime.GetNearestExtendedDateTime() ); return transaction; *************** *** 86,94 **** #endregion ! public TransactionHistory GetTransactions( ArrayList orders ) { TransactionHistory transactionHistory = new TransactionHistory(); foreach (Order order in orders) ! transactionHistory.Add( this.GetTransaction( order ) ); return transactionHistory; } --- 88,98 ---- #endregion ! public TransactionHistory GetTransactions( ArrayList orders , ! IDataStreamer dataStreamer ) { TransactionHistory transactionHistory = new TransactionHistory(); foreach (Order order in orders) ! transactionHistory.Add( this.GetTransaction( order , ! dataStreamer ) ); return transactionHistory; } |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:26:14
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11190/b7_Scripts/SimpleTesting/OneRank Modified Files: OneRank.cs Log Message: - GetMarketValue has been removed - GetMaxBuyableQuantity uses an IDataStreamer now Index: OneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank/OneRank.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OneRank.cs 26 Dec 2004 17:43:53 -0000 1.5 --- OneRank.cs 9 Jan 2005 23:25:44 -0000 1.6 *************** *** 23,31 **** using System; ! using QuantProject.Data.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; namespace QuantProject.Scripts.SimpleTesting --- 23,33 ---- using System; ! using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; + using QuantProject.Data.DataProviders; + namespace QuantProject.Scripts.SimpleTesting *************** *** 39,43 **** private DateTime lastDateTime; ! public static long MaxBuyableShares( string ticker , double cashAmount, IDataStreamer dataStreamer ) --- 41,46 ---- private DateTime lastDateTime; ! private IHistoricalQuoteProvider historicalQuoteProvider = ! new HistoricalAdjustedQuoteProvider(); public static long MaxBuyableShares( string ticker , double cashAmount, IDataStreamer dataStreamer ) *************** *** 63,69 **** EndOfDayDateTime( this.account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , EndOfDaySpecificTime.MarketClose ); ! double yesterdayMarketValueAtClose = HistoricalDataProvider.GetMarketValue( ! this.account.Key , ! yesterdayAtClose.GetNearestExtendedDateTime() ); if ( ( todayMarketValueAtClose > yesterdayMarketValueAtClose ) && ( !this.account.Contains( this.account.Key ) ) ) --- 66,71 ---- EndOfDayDateTime( this.account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , EndOfDaySpecificTime.MarketClose ); ! double yesterdayMarketValueAtClose = this.historicalQuoteProvider.GetMarketValue( ! this.account.Key , yesterdayAtClose ); if ( ( todayMarketValueAtClose > yesterdayMarketValueAtClose ) && ( !this.account.Contains( this.account.Key ) ) ) |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:25:37
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a1_Instruments In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11146/b4_Business/a1_Financial/a1_Instruments Modified Files: Instrument.cs Log Message: - GetMarketValue has been removed - GetMaxBuyableQuantity uses an IDataStreamer now Index: Instrument.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a1_Instruments/Instrument.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Instrument.cs 29 Nov 2004 16:10:24 -0000 1.4 --- Instrument.cs 9 Jan 2005 23:25:26 -0000 1.5 *************** *** 43,56 **** } ! public double GetMarketValue( EndOfDayDateTime endOfDayDateTime ) ! { ! return HistoricalDataProvider.GetMarketValue( this.Key , endOfDayDateTime.DateTime , ! endOfDayDateTime.GetNearestBarComponent() ); ! } ! public long GetMaxBuyableQuantity( double availableAmount , ! EndOfDayDateTime endOfDayDateTime ) { ! return (long) Math.Floor( availableAmount / this.GetMarketValue( endOfDayDateTime ) ); } --- 43,56 ---- } ! // public double GetMarketValue( EndOfDayDateTime endOfDayDateTime ) ! // { ! // return HistoricalDataProvider.GetMarketValue( this.Key , endOfDayDateTime.DateTime , ! // endOfDayDateTime.GetNearestBarComponent() ); ! // } ! // public long GetMaxBuyableQuantity( double availableAmount , ! IDataStreamer dataStreamer ) { ! return (long) Math.Floor( availableAmount / dataStreamer.GetCurrentBid( this.Key ) ); } |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:15:33
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8783/b4_Business/a1_Financial/a3_Ordering Modified Files: HistoricalEndOfDayOrderExecutor.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced Index: HistoricalEndOfDayOrderExecutor.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering/HistoricalEndOfDayOrderExecutor.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HistoricalEndOfDayOrderExecutor.cs 13 Dec 2004 01:44:42 -0000 1.2 --- HistoricalEndOfDayOrderExecutor.cs 9 Jan 2005 23:15:21 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- using QuantProject.Data.DataProviders; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Transactions; *************** *** 38,45 **** { private IEndOfDayTimer timer; ! public HistoricalEndOfDayOrderExecutor( IEndOfDayTimer timer ) { this.timer = timer; } --- 39,49 ---- { private IEndOfDayTimer timer; + private IHistoricalQuoteProvider historicalQuoteProvider; ! public HistoricalEndOfDayOrderExecutor( IEndOfDayTimer timer , ! IHistoricalQuoteProvider historicalQuoteProvider ) { this.timer = timer; + this.historicalQuoteProvider = historicalQuoteProvider; } *************** *** 49,55 **** public void Execute( Order order ) { ! double instrumentPrice = HistoricalDataProvider.GetMarketValue( order.Instrument.Key , ! this.timer.GetCurrentTime().DateTime , ! this.timer.GetCurrentTime().GetNearestBarComponent() ); EndOfDayTransaction endOfDayTransaction = new EndOfDayTransaction( TimedTransaction.GetTransactionType( order.Type ) , order.Instrument , --- 53,58 ---- public void Execute( Order order ) { ! double instrumentPrice = this.historicalQuoteProvider.GetMarketValue( order.Instrument.Key , ! this.timer.GetCurrentTime() ); EndOfDayTransaction endOfDayTransaction = new EndOfDayTransaction( TimedTransaction.GetTransactionType( order.Type ) , order.Instrument , |
|
From: Glauco S. <gla...@us...> - 2005-01-09 23:15:33
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8783/b4_Business/a07_DataProviders Modified Files: HistoricalEndOfDayDataStreamer.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced Index: HistoricalEndOfDayDataStreamer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/HistoricalEndOfDayDataStreamer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HistoricalEndOfDayDataStreamer.cs 13 Dec 2004 01:45:17 -0000 1.2 --- HistoricalEndOfDayDataStreamer.cs 9 Jan 2005 23:15:19 -0000 1.3 *************** *** 27,31 **** using QuantProject.Data.DataProviders; ! namespace QuantProject.Business.Timing { /// <summary> --- 27,31 ---- using QuantProject.Data.DataProviders; ! namespace QuantProject.Business.DataProviders { /// <summary> *************** *** 37,40 **** --- 37,41 ---- private IEndOfDayTimer endOfDayTimer; + private IHistoricalQuoteProvider historicalQuoteProvider; private EndOfDayDateTime startDateTime; *************** *** 53,59 **** } ! public HistoricalEndOfDayDataStreamer( IEndOfDayTimer endOfDayTimer ) { this.endOfDayTimer = endOfDayTimer; this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( this.marketOpenEventHandler ); --- 54,62 ---- } ! public HistoricalEndOfDayDataStreamer( IEndOfDayTimer endOfDayTimer , ! IHistoricalQuoteProvider historicalQuoteProvider ) { this.endOfDayTimer = endOfDayTimer; + this.historicalQuoteProvider = historicalQuoteProvider; this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( this.marketOpenEventHandler ); *************** *** 68,73 **** public double GetCurrentBid( string ticker ) { ! return HistoricalDataProvider.GetMarketValue( ticker , ! this.endOfDayTimer.GetCurrentTime().GetNearestExtendedDateTime() ); } --- 71,76 ---- public double GetCurrentBid( string ticker ) { ! return historicalQuoteProvider.GetMarketValue( ticker , ! this.endOfDayTimer.GetCurrentTime() ); } *************** *** 79,84 **** public double GetCurrentAsk( string ticker ) { ! return HistoricalDataProvider.GetMarketValue( ticker , ! this.endOfDayTimer.GetCurrentTime().GetNearestExtendedDateTime() ); } --- 82,87 ---- public double GetCurrentAsk( string ticker ) { ! return historicalQuoteProvider.GetMarketValue( ticker , ! this.endOfDayTimer.GetCurrentTime() ); } |
|
From: Glauco S. <gla...@us...> - 2005-01-09 22:36:28
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32071/b3_Data/DataProviders Modified Files: HistoricalDataProvider.cs Log Message: - BarComponent has been replaced by QuoteField - SetCachedHistories has been removed - GetMarketValue has been removed - GetAdjustedMarketValue has been added - GetRawMarketValue has been added Index: HistoricalDataProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/HistoricalDataProvider.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HistoricalDataProvider.cs 15 Dec 2004 23:24:08 -0000 1.5 --- HistoricalDataProvider.cs 9 Jan 2005 22:36:19 -0000 1.6 *************** *** 57,88 **** /// <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 , BarComponent barComponent ) { if ( !cachedHistories.ContainsKey( instrumentKey ) ) cachedHistories.Add( instrumentKey , new Hashtable() ); ((Hashtable) cachedHistories[ instrumentKey ]).Add( ! barComponent , barComponent ); ! } ! ! //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; ! } } public static History GetOpenHistory( string instrumentKey ) { --- 57,88 ---- /// <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; + // } + // } + // public static History GetOpenHistory( string instrumentKey ) { *************** *** 91,165 **** } ! private static History getHistory( string instrumentKey , BarComponent barComponent ) { if ( ( !cachedHistories.Contains( instrumentKey ) ) || ! ( !((Hashtable)cachedHistories[ instrumentKey ]).Contains( barComponent ) ) ) { ! Add( instrumentKey , barComponent ); ! ((Hashtable)cachedHistories[ instrumentKey ])[ barComponent ] = ! DataBase.GetHistory( instrumentKey , barComponent ); } ! return (History)((Hashtable)cachedHistories[ instrumentKey ])[ barComponent ]; } public static History GetCloseHistory( string instrumentKey ) { ! if ( ( !cachedHistories.Contains( instrumentKey ) ) || ! ( !((Hashtable)cachedHistories[ instrumentKey ]).Contains( BarComponent.Close ) ) ) ! { ! Add( instrumentKey , BarComponent.Close ); ! ((Hashtable)cachedHistories[ instrumentKey ])[ BarComponent.Close ] = ! DataBase.GetHistory( instrumentKey , BarComponent.Close ); ! } ! return (History)((Hashtable)cachedHistories[ instrumentKey ])[ ! BarComponent.Close ]; } public static History GetHighHistory( string instrumentKey ) { ! return getHistory( instrumentKey , BarComponent.High ); } public static History GetLowHistory( string instrumentKey ) { ! return getHistory( instrumentKey , BarComponent.Low ); } ! private static void cache( string instrumentKey , BarComponent barComponent ) { if ( !cachedHistories.ContainsKey( instrumentKey ) ) // no component at all for the instrument instrumentKey has been cached yet cachedHistories.Add( instrumentKey , new Hashtable() ); ! ((Hashtable)cachedHistories[ instrumentKey ]).Add( barComponent , ! DataBase.GetHistory( instrumentKey , barComponent ) ); } ! public static double GetMarketValue( string instrumentKey , ExtendedDateTime extendedDateTime ) { if ( !cachedHistories.ContainsKey( instrumentKey ) || !(((Hashtable)cachedHistories[ instrumentKey ]).ContainsKey( ! extendedDateTime.BarComponent)) ) // the instrument instrumentKey has not been cached yet, for the given bar component ! cache( instrumentKey , extendedDateTime.BarComponent ); ! return Convert.ToDouble( ( (History) ((Hashtable) ! cachedHistories[ instrumentKey ])[ extendedDateTime.BarComponent ] ).GetByIndex( ! ( (History) ((Hashtable) cachedHistories[ instrumentKey ])[ extendedDateTime.BarComponent ] ! ).IndexOfKeyOrPrevious( extendedDateTime.DateTime ) ) ); } public static bool WasExchanged( string instrumentKey , ExtendedDateTime extendedDateTime ) { ! double marketValue = GetMarketValue( instrumentKey , extendedDateTime ); // forces caching if needed return ( (History) ((Hashtable) ! cachedHistories[ instrumentKey ])[ extendedDateTime.BarComponent ] ).ContainsKey( extendedDateTime.DateTime ); } - public static double GetMarketValue( string instrumentKey , DateTime dateTime , - BarComponent barComponent ) - { - //DateTime dateTime = - return GetMarketValue( instrumentKey , new ExtendedDateTime( dateTime , barComponent ) ); - } - /// <summary> /// returns the quotes DataTable for the given ticker --- 91,219 ---- } ! 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 ]; } 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 ); } ! 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() ); ! ((Hashtable)cachedHistories[ instrumentKey ]).Add( quoteField , ! DataBase.GetHistory( instrumentKey , quoteField ) ); } ! // public static double GetMarketValue( string instrumentKey , ExtendedDateTime extendedDateTime ) ! // { ! // double returnValue; ! // if ( !cachedHistories.ContainsKey( instrumentKey ) || ! // !(((Hashtable)cachedHistories[ instrumentKey ]).ContainsKey( ! // extendedDateTime.QuoteField)) ) ! // // the instrument instrumentKey has not been cached yet, for the given bar component ! // cache( instrumentKey , extendedDateTime.QuoteField ); ! // returnValue = Convert.ToDouble( ! // ( (History) ((Hashtable) ! // cachedHistories[ instrumentKey ])[ extendedDateTime.QuoteField ] ).GetByIndex( ! // ( (History) ((Hashtable) cachedHistories[ instrumentKey ])[ extendedDateTime.QuoteField ] ! // ).IndexOfKeyOrPrevious( extendedDateTime.DateTime ) ) ); ! // return returnValue; ! // } ! // public static double GetMarketValue( string instrumentKey , DateTime dateTime , ! // QuoteField barComponent ) ! // { ! // //DateTime dateTime = ! // return GetMarketValue( instrumentKey , new ExtendedDateTime( dateTime , barComponent ) ); ! // } ! // ! private static double getQuote( string instrumentKey , DateTime dateTime , QuoteField quoteField ) { + double returnValue; if ( !cachedHistories.ContainsKey( instrumentKey ) || !(((Hashtable)cachedHistories[ instrumentKey ]).ContainsKey( ! quoteField )) ) // the instrument instrumentKey has not been cached yet, for the given bar component ! cache( instrumentKey , quoteField ); ! returnValue = Convert.ToDouble( ( (History) ((Hashtable) ! cachedHistories[ instrumentKey ])[ quoteField ] ).GetByIndex( ! ( (History) ((Hashtable) cachedHistories[ instrumentKey ])[ quoteField ] ! ).IndexOfKeyOrPrevious( dateTime ) ) ); ! return returnValue; ! } ! /// <summary> ! /// Returns the adjusted market value for the given ticker, at the given ExtendedDateTime ! /// </summary> ! /// <param name="instrumentKey">instrument identifier</param> ! /// <param name="extendedDateTime"></param> ! /// <returns></returns> ! public static double GetAdjustedMarketValue( string instrumentKey , ExtendedDateTime extendedDateTime ) ! { ! double returnValue; ! double adjustedClose = getQuote( instrumentKey , ! extendedDateTime.DateTime , QuoteField.AdjustedClose ); ! if ( extendedDateTime.BarComponent == BarComponent.Close ) ! returnValue = adjustedClose; ! else ! // extendedDateTime.BarComponent is equal to BarComponent.Open ! { ! double open = getQuote( instrumentKey , ! extendedDateTime.DateTime , QuoteField.Open ); ! double close = getQuote( instrumentKey , ! extendedDateTime.DateTime , QuoteField.Close ); ! returnValue = open * adjustedClose / close; ! } ! return returnValue; ! } ! /// <summary> ! /// Returns the raw market value for the given ticker, at the given ExtendedDateTime ! /// </summary> ! /// <param name="instrumentKey">instrument identifier</param> ! /// <param name="extendedDateTime"></param> ! /// <returns></returns> ! public static double GetRawMarketValue( string instrumentKey , ExtendedDateTime extendedDateTime ) ! { ! double returnValue; ! if ( extendedDateTime.BarComponent == BarComponent.Close ) ! returnValue = getQuote( instrumentKey , ! extendedDateTime.DateTime , QuoteField.Close ); ! else ! // extendedDateTime.BarComponent is equal to BarComponent.Open ! returnValue = getQuote( instrumentKey , ! extendedDateTime.DateTime , QuoteField.Open ); ! return returnValue; } 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 return ( (History) ((Hashtable) ! cachedHistories[ instrumentKey ])[ QuoteField.Close ] ).ContainsKey( extendedDateTime.DateTime ); } /// <summary> /// returns the quotes DataTable for the given ticker |
|
From: Glauco S. <gla...@us...> - 2005-01-09 22:23:53
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29005/b7_Scripts/SimpleTesting/OneRank Modified Files: EndOfDayOneRank.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced Index: EndOfDayOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank/EndOfDayOneRank.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EndOfDayOneRank.cs 29 Nov 2004 14:35:40 -0000 1.1 --- EndOfDayOneRank.cs 9 Jan 2005 22:23:44 -0000 1.2 *************** *** 24,27 **** --- 24,28 ---- using QuantProject.ADT; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Accounting; *************** *** 39,42 **** --- 40,45 ---- private string ticker; private Account account; + private IHistoricalQuoteProvider historicalQuoteProvider = + new HistoricalAdjustedQuoteProvider(); private void fiveMinutesBeforeMarketCloseHandler( *************** *** 44,50 **** { if ( this.account.GetMarketValue( this.ticker ) <= ! HistoricalDataProvider.GetMarketValue( this.ticker , ! this.account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , ! BarComponent.Close ) ) { // today's closing value is lower or equal than yesterday's closing value --- 47,54 ---- { if ( this.account.GetMarketValue( this.ticker ) <= ! this.historicalQuoteProvider.GetMarketValue( this.ticker , ! new EndOfDayDateTime( ! this.account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , ! EndOfDaySpecificTime.MarketClose ) ) ) { // today's closing value is lower or equal than yesterday's closing value |
|
From: Glauco S. <gla...@us...> - 2005-01-09 22:22:45
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28813/b2_DataAccess Modified Files: DataBase.cs Log Message: - BarComponent has been replaced by QuoteField - the GetHistories method has been removed Index: DataBase.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataBase.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DataBase.cs 3 Jan 2004 16:13:49 -0000 1.4 --- DataBase.cs 9 Jan 2005 22:22:36 -0000 1.5 *************** *** 47,72 **** /// <summary> ! /// Returns the field name corresponding to the bar component /// </summary> ! /// <param name="barComponent">Discriminates among Open, High, Low and Closure</param> ! /// <returns>Field name corresponding to the bar component</returns> ! private static string getFieldName( BarComponent barComponent ) { string fieldName = ""; ! switch ( barComponent ) { ! case BarComponent.Open: fieldName = "quOpen"; break; ! case BarComponent.High: fieldName = "quHigh"; break; ! case BarComponent.Low: fieldName = "quLow"; break; ! case BarComponent.Close: ! fieldName = "quAdjustedClose"; ! break; ! default: break; } --- 47,81 ---- /// <summary> ! /// Returns the field name corresponding to the quote field /// </summary> ! /// <param name="quoteField">Discriminates among Open, High, Low and Closure</param> ! /// <returns>Field name corresponding to the quote field</returns> ! private static string getFieldName( QuoteField quoteField ) { string fieldName = ""; ! switch ( quoteField ) { ! case QuoteField.Open: fieldName = "quOpen"; break; ! case QuoteField.High: fieldName = "quHigh"; break; ! case QuoteField.Low: fieldName = "quLow"; break; ! case QuoteField.Close: ! fieldName = "quClose"; ! break; ! case QuoteField.AdjustedClose: ! fieldName = "quAdjustedClose"; ! break; ! case QuoteField.AdjustedCloseToCloseRatio: ! fieldName = "quAdjustedCloseToCloseRatio"; ! break; ! case QuoteField.Volume: ! fieldName = "quVolume"; ! break; ! default: break; } *************** *** 75,79 **** #region "GetHistory" ! private static History getHistory_try( string instrumentKey , BarComponent barComponent ) { History history = new History(); --- 84,88 ---- #region "GetHistory" ! private static History getHistory_try( string instrumentKey , QuoteField quoteField ) { History history = new History(); *************** *** 83,102 **** DataTable dataTable = new DataTable(); oleDbDataAdapter.Fill( dataTable ); ! history.Import( dataTable , "quDate" , getFieldName( barComponent ) ); return history; } /// <summary> ! /// Returns the full history for the instrument and the specified bar component /// </summary> /// <param name="instrumentKey">Identifier (ticker) for the instrument whose story /// has to be returned</param> ! /// <param name="barComponent">Discriminates among Open, High, Low and Closure</param> ! /// <returns>The history for the given instrument and bar component</returns> ! public static History GetHistory( string instrumentKey , BarComponent barComponent ) { History history; try { ! history = getHistory_try( instrumentKey , barComponent ); } catch (Exception ex) --- 92,111 ---- DataTable dataTable = new DataTable(); oleDbDataAdapter.Fill( dataTable ); ! history.Import( dataTable , "quDate" , getFieldName( quoteField ) ); return history; } /// <summary> ! /// Returns the full history for the instrument and the specified quote field /// </summary> /// <param name="instrumentKey">Identifier (ticker) for the instrument whose story /// has to be returned</param> ! /// <param name="quoteField">Discriminates among Open, High, Low and Closure</param> ! /// <returns>The history for the given instrument and quote field</returns> ! public static History GetHistory( string instrumentKey , QuoteField quoteField ) { History history; try { ! history = getHistory_try( instrumentKey , quoteField ); } catch (Exception ex) *************** *** 109,159 **** #endregion ! #region "GetHistories" ! private static Single getHistories_try_getValue( DataRow dataRow , DateTime dateTime , ! BarComponent barComponent ) ! { ! Single returnValue; ! if ( barComponent == BarComponent.Close ) ! returnValue = (Single)dataRow[ getFieldName( barComponent ) ]; ! else ! returnValue = (Single)dataRow[ getFieldName( barComponent ) ] * ! (Single)dataRow[ "quAdjustedClose" ] / (Single)dataRow[ "quClose" ]; ! return returnValue; ! } ! private static Hashtable getHistories_try( string instrumentKey , Hashtable barComponents , DateTime startDateTime , DateTime endDateTime ) ! { ! Hashtable histories = new Hashtable(); ! foreach (BarComponent barComponent in barComponents.Keys) ! histories.Add( barComponent , new History() ); ! string commandString = ! "select * from quotes where quTicker='" + instrumentKey + "' and " + ! "quDate>=" + SQLBuilder.GetDateConstant( startDateTime ) + " and " + ! "quDate<=" + SQLBuilder.GetDateConstant( endDateTime ); ! OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter( commandString , oleDbConnection ); ! DataSet dataSet = new DataSet(); ! oleDbDataAdapter.Fill( dataSet , "history" ); ! foreach ( DataRow dataRow in dataSet.Tables[ "history" ].Rows ) ! foreach ( BarComponent barComponent in barComponents.Keys ) ! ((History) histories[ barComponent ]).Add( (DateTime) dataRow[ "quDate" ] , ! getHistories_try_getValue( dataRow , (DateTime) dataRow[ "quDate" ] , barComponent ) ); // ((History) histories[ barComponent ]).Add( (DateTime) dataRow[ "quDate" ] , ! // dataRow[ getFieldName( barComponent ) ] ); ! return histories; ! } ! public static Hashtable GetHistories( string instrumentKey , Hashtable barComponents , DateTime startDateTime , DateTime endDateTime ) ! { ! Hashtable histories; ! try ! { ! histories = getHistories_try( instrumentKey , barComponents , startDateTime , endDateTime ); ! } ! catch (Exception ex) ! { ! MessageBox.Show( ex.ToString() ); ! histories = null; ! } ! return histories; ! } ! #endregion } } --- 118,168 ---- #endregion ! // #region "GetHistories" ! // private static Single getHistories_try_getValue( DataRow dataRow , DateTime dateTime , ! // QuoteField quoteField ) ! // { ! // Single returnValue; ! // if ( quoteField == QuoteField.cl ) ! // returnValue = (Single)dataRow[ getFieldName( quoteField ) ]; ! // else ! // returnValue = (Single)dataRow[ getFieldName( quoteField ) ] * ! // (Single)dataRow[ "quAdjustedClose" ] / (Single)dataRow[ "quClose" ]; ! // return returnValue; ! // } ! // private static Hashtable getHistories_try( string instrumentKey , Hashtable barComponents , DateTime startDateTime , DateTime endDateTime ) ! // { ! // Hashtable histories = new Hashtable(); ! // foreach (BarComponent barComponent in barComponents.Keys) ! // histories.Add( barComponent , new History() ); ! // string commandString = ! // "select * from quotes where quTicker='" + instrumentKey + "' and " + ! // "quDate>=" + SQLBuilder.GetDateConstant( startDateTime ) + " and " + ! // "quDate<=" + SQLBuilder.GetDateConstant( endDateTime ); ! // OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter( commandString , oleDbConnection ); ! // DataSet dataSet = new DataSet(); ! // oleDbDataAdapter.Fill( dataSet , "history" ); ! // foreach ( DataRow dataRow in dataSet.Tables[ "history" ].Rows ) ! // foreach ( BarComponent barComponent in barComponents.Keys ) // ((History) histories[ barComponent ]).Add( (DateTime) dataRow[ "quDate" ] , ! // getHistories_try_getValue( dataRow , (DateTime) dataRow[ "quDate" ] , barComponent ) ); ! //// ((History) histories[ barComponent ]).Add( (DateTime) dataRow[ "quDate" ] , ! //// dataRow[ getFieldName( barComponent ) ] ); ! // return histories; ! // } ! // public static Hashtable GetHistories( string instrumentKey , Hashtable barComponents , DateTime startDateTime , DateTime endDateTime ) ! // { ! // Hashtable histories; ! // try ! // { ! // histories = getHistories_try( instrumentKey , barComponents , startDateTime , endDateTime ); ! // } ! // catch (Exception ex) ! // { ! // MessageBox.Show( ex.ToString() ); ! // histories = null; ! // } ! // return histories; ! // } ! // #endregion } } |
|
From: Glauco S. <gla...@us...> - 2005-01-09 22:17:29
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27497/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: ComparableAccount.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced Index: ComparableAccount.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/ComparableAccount.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ComparableAccount.cs 29 Dec 2004 17:07:42 -0000 1.3 --- ComparableAccount.cs 9 Jan 2005 22:17:19 -0000 1.4 *************** *** 22,25 **** --- 22,26 ---- using System; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; *************** *** 37,40 **** --- 38,44 ---- private double maxAcceptableDrawDown = 0.3; + private IHistoricalQuoteProvider historicalQuoteProvider = + new HistoricalAdjustedQuoteProvider(); + private AccountReport accountReport; *************** *** 59,63 **** if ( this.accountReport == null ) this.accountReport = this.CreateReport( this.Key , 7 , ! this.EndOfDayTimer.GetCurrentTime() , this.Key ); if ( ( this.accountReport.Summary.MaxEquityDrawDown >= this.maxAcceptableDrawDown ) || ( this.accountReport.Summary.TotalPnl <= this.accountReport.Summary.BuyAndHoldPercentageReturn ) ) --- 63,68 ---- if ( this.accountReport == null ) this.accountReport = this.CreateReport( this.Key , 7 , ! this.EndOfDayTimer.GetCurrentTime() , this.Key , ! this.historicalQuoteProvider ); if ( ( this.accountReport.Summary.MaxEquityDrawDown >= this.maxAcceptableDrawDown ) || ( this.accountReport.Summary.TotalPnl <= this.accountReport.Summary.BuyAndHoldPercentageReturn ) ) |
|
From: Glauco S. <gla...@us...> - 2005-01-09 22:16:33
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27292/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: ChosenTickers.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced Index: ChosenTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/ChosenTickers.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ChosenTickers.cs 26 Dec 2004 17:39:59 -0000 1.3 --- ChosenTickers.cs 9 Jan 2005 22:16:23 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- using System.Collections; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Timing; *************** *** 37,40 **** --- 38,44 ---- private int numberTickersToBeChosen; + private IHistoricalQuoteProvider historicalQuoteProvider = + new HistoricalAdjustedQuoteProvider(); + public ChosenTickers( int numberTickersToBeChosen ) { *************** *** 49,55 **** EndOfDayDateTime( account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , EndOfDaySpecificTime.MarketClose ); ! double yesterdayMarketValueAtClose = HistoricalDataProvider.GetMarketValue( ! ticker , ! yesterdayAtClose.GetNearestExtendedDateTime() ); if ( todayMarketValueAtClose > yesterdayMarketValueAtClose ) // today close is higher than yesterday close --- 53,59 ---- EndOfDayDateTime( account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , EndOfDaySpecificTime.MarketClose ); ! double yesterdayMarketValueAtClose = ! this.historicalQuoteProvider.GetMarketValue( ticker , ! yesterdayAtClose ); if ( todayMarketValueAtClose > yesterdayMarketValueAtClose ) // today close is higher than yesterday close |
|
From: Glauco S. <gla...@us...> - 2005-01-09 22:14:45
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26806/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Modified Files: BuyAndHoldPercentageReturn.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced Index: BuyAndHoldPercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/BuyAndHoldPercentageReturn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BuyAndHoldPercentageReturn.cs 29 Nov 2004 15:52:56 -0000 1.2 --- BuyAndHoldPercentageReturn.cs 9 Jan 2005 22:14:36 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- using System.Data; using QuantProject.ADT; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Instruments; *************** *** 13,29 **** public class BuyAndHoldPercentageReturn : SummaryRow { ! public BuyAndHoldPercentageReturn( Summary summary ) { if ( summary.AccountReport.BuyAndHoldTicker != "" ) { // the report has to compare to a buy and hold benchmark ! Instrument buyAndHoldInstrument = new Instrument( summary.AccountReport.BuyAndHoldTicker ); ! summary.BuyAndHoldPercentageReturn = ! ( buyAndHoldInstrument.GetMarketValue( ! summary.AccountReport.EndDateTime ) - ! buyAndHoldInstrument.GetMarketValue( ! new EndOfDayDateTime( summary.AccountReport.StartDateTime , EndOfDaySpecificTime.MarketOpen ) ) ) / ! buyAndHoldInstrument.GetMarketValue( ! new EndOfDayDateTime( summary.AccountReport.StartDateTime , EndOfDaySpecificTime.MarketOpen ) ) * 100; this.rowDescription = "Buy & hold % return"; this.rowValue = summary.BuyAndHoldPercentageReturn; --- 14,31 ---- public class BuyAndHoldPercentageReturn : SummaryRow { ! public BuyAndHoldPercentageReturn( Summary summary , ! IHistoricalQuoteProvider historicalQuoteProvider ) { if ( summary.AccountReport.BuyAndHoldTicker != "" ) { // the report has to compare to a buy and hold benchmark ! double beginningMarketValue = historicalQuoteProvider.GetMarketValue( ! summary.AccountReport.BuyAndHoldTicker , ! new EndOfDayDateTime( summary.AccountReport.StartDateTime , EndOfDaySpecificTime.MarketOpen ) ); ! double finalMarketValue = historicalQuoteProvider.GetMarketValue( ! summary.AccountReport.BuyAndHoldTicker , ! summary.AccountReport.EndDateTime ); ! summary.BuyAndHoldPercentageReturn = ( finalMarketValue - beginningMarketValue ) / ! beginningMarketValue * 100; this.rowDescription = "Buy & hold % return"; this.rowValue = summary.BuyAndHoldPercentageReturn; |
|
From: Glauco S. <gla...@us...> - 2005-01-09 22:13:26
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26489/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: BestPerformingTickers.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced Index: BestPerformingTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/BestPerformingTickers.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BestPerformingTickers.cs 26 Dec 2004 17:37:34 -0000 1.5 --- BestPerformingTickers.cs 9 Jan 2005 22:13:12 -0000 1.6 *************** *** 24,27 **** --- 24,28 ---- using QuantProject.ADT; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Ordering; *************** *** 40,43 **** --- 41,47 ---- private int numberDaysForPerformanceCalculation; + private IHistoricalQuoteProvider historicalQuoteProvider = + new HistoricalAdjustedQuoteProvider(); + private double calculatedTickers = 0; *************** *** 69,74 **** EndOfDaySpecificTime.MarketOpen ) ); ComparableAccount account = new ComparableAccount( ticker , historicalEndOfDayTimer , ! new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer ) , ! new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer ) ); OneRank oneRank = new OneRank( account , dateTime.AddDays( this.numberDaysForPerformanceCalculation ) ); --- 73,80 ---- EndOfDaySpecificTime.MarketOpen ) ); ComparableAccount account = new ComparableAccount( ticker , historicalEndOfDayTimer , ! new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , ! this.historicalQuoteProvider ) , ! new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , ! this.historicalQuoteProvider ) ); OneRank oneRank = new OneRank( account , dateTime.AddDays( this.numberDaysForPerformanceCalculation ) ); |
|
From: Glauco S. <gla...@us...> - 2005-01-09 22:08:57
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25312/b4_Business/a2_Strategies Modified Files: AccountStrategy.cs Log Message: The Class has been moved to a timer based approach Index: AccountStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/AccountStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AccountStrategy.cs 29 Nov 2004 15:49:23 -0000 1.2 --- AccountStrategy.cs 9 Jan 2005 22:08:47 -0000 1.3 *************** *** 27,30 **** --- 27,31 ---- using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Strategies; + using QuantProject.Data.DataProviders; namespace QuantProject.Business.Strategies *************** *** 49,53 **** } ! public virtual ArrayList GetOrdersForCurrentVirtualOrder( Order virtualOrder ) { ArrayList orders = new ArrayList(); --- 50,55 ---- } ! public virtual ArrayList GetOrdersForCurrentVirtualOrder( Order virtualOrder , ! IDataStreamer dataStreamer ) { ArrayList orders = new ArrayList(); *************** *** 65,70 **** virtualOrder.Instrument.GetMaxBuyableQuantity( this.account.CashAmount + ! this.account.Portfolio.GetMarketValue( virtualOrder.EndOfDayDateTime ) , ! virtualOrder.EndOfDayDateTime ) , virtualOrder.EndOfDayDateTime ) ); break; case OrderType.MarketSell: --- 67,72 ---- virtualOrder.Instrument.GetMaxBuyableQuantity( this.account.CashAmount + ! this.account.Portfolio.GetMarketValue( this.account.DataStreamer ) , ! this.account.DataStreamer ) , virtualOrder.EndOfDayDateTime ) ); break; case OrderType.MarketSell: *************** *** 79,84 **** virtualOrder.Instrument.GetMaxBuyableQuantity( this.account.CashAmount + ! this.account.Portfolio.GetMarketValue( virtualOrder.EndOfDayDateTime ) , ! virtualOrder.EndOfDayDateTime ) , virtualOrder.EndOfDayDateTime ) ); break; --- 81,86 ---- virtualOrder.Instrument.GetMaxBuyableQuantity( this.account.CashAmount + ! this.account.Portfolio.GetMarketValue( dataStreamer ) , ! dataStreamer ) , virtualOrder.EndOfDayDateTime ) ); break; *************** *** 89,93 **** } ! public virtual Orders GetOrders( Signal signal ) { // This is the default account strategy. You may wish to override it. --- 91,95 ---- } ! public virtual Orders GetOrders( Signal signal , IDataStreamer dataStreamer ) { // This is the default account strategy. You may wish to override it. *************** *** 100,104 **** { ArrayList ordersForCurrentVirtualOrder = ! this.GetOrdersForCurrentVirtualOrder( virtualOrder ); foreach( Order order in ordersForCurrentVirtualOrder ) orders.Add( order ); --- 102,106 ---- { ArrayList ordersForCurrentVirtualOrder = ! this.GetOrdersForCurrentVirtualOrder( virtualOrder , dataStreamer ); foreach( Order order in ordersForCurrentVirtualOrder ) orders.Add( order ); |
|
From: Glauco S. <gla...@us...> - 2005-01-09 20:09:11
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/MSFTwalkForward In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27154/b7_Scripts/WalkForwardTesting/MSFTwalkForward Removed Files: RunMSFTwalkForward.cs Log Message: These script files have been removed because they don't work on the new timer/event based approach --- RunMSFTwalkForward.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2005-01-09 20:09:09
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27154/b7_Scripts/SimpleTesting/OneRank Removed Files: AsOneRank.cs RunOneRank.cs RunOneRankWithExcelReport.cs RunOneRankWithWindowsReport.cs Log Message: These script files have been removed because they don't work on the new timer/event based approach --- RunOneRank.cs DELETED --- --- RunOneRankWithWindowsReport.cs DELETED --- --- AsOneRank.cs DELETED --- --- RunOneRankWithExcelReport.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2005-01-09 20:09:09
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/MultiTesting/MultiTestOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27154/b7_Scripts/MultiTesting/MultiTestOneRank Removed Files: RunMultiTestOneRank.cs Log Message: These script files have been removed because they don't work on the new timer/event based approach --- RunMultiTestOneRank.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2005-01-09 20:09:08
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/MSFTsimpleTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27154/b7_Scripts/SimpleTesting/MSFTsimpleTest Removed Files: RunMSFTsimpleTest.cs Log Message: These script files have been removed because they don't work on the new timer/event based approach --- RunMSFTsimpleTest.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2005-01-09 20:09:05
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/MSFTSimpleTest_2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27154/b7_Scripts/SimpleTesting/MSFTSimpleTest_2 Removed Files: AsMSFTsimpleTest_2.cs RunMSFTsimpleTest_2.cs Log Message: These script files have been removed because they don't work on the new timer/event based approach --- AsMSFTsimpleTest_2.cs DELETED --- --- RunMSFTsimpleTest_2.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2005-01-09 20:02:04
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25227/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: The following script files have been removed from the project (because they don't work on the new timer/event based approach): - RunMultiTestOneRank.cs - RunMSFTsimpleTest.cs - AsMSFTsimpleTest_2.cs - RunMSFTsimpleTest_2.cs - AsOneRank.cs - RunOneRank.cs - RunOneRankWithExcelReport.cs - RunOneRankWithWindowsReport.cs - RunMSFTwalkForward.cs Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** b7_Scripts.csproj 20 Dec 2004 00:09:52 -0000 1.16 --- b7_Scripts.csproj 9 Jan 2005 20:01:55 -0000 1.17 *************** *** 117,130 **** BuildAction = "Compile" /> ! <File ! RelPath = "MultiTesting\MultiTestOneRank\RunMultiTestOneRank.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "SimpleTesting\MSFTsimpleTest\RunMSFTsimpleTest.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> <File RelPath = "SimpleTesting\MSFTsimpleTest\TsMSFTsimpleTest.cs" --- 117,121 ---- BuildAction = "Compile" /> ! <Folder RelPath = "MultiTesting\MultiTestOneRank\" /> <File RelPath = "SimpleTesting\MSFTsimpleTest\TsMSFTsimpleTest.cs" *************** *** 133,146 **** /> <File - RelPath = "SimpleTesting\MSFTSimpleTest_2\AsMSFTsimpleTest_2.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "SimpleTesting\MSFTSimpleTest_2\RunMSFTsimpleTest_2.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "SimpleTesting\MSFTSimpleTest_2\TsMSFTsimpleTest_2.cs" SubType = "Code" --- 124,127 ---- *************** *** 148,156 **** /> <File - RelPath = "SimpleTesting\OneRank\AsOneRank.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "SimpleTesting\OneRank\EndOfDayOneRank.cs" SubType = "Code" --- 129,132 ---- *************** *** 163,181 **** /> <File - RelPath = "SimpleTesting\OneRank\RunOneRank.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "SimpleTesting\OneRank\RunOneRankWithExcelReport.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "SimpleTesting\OneRank\RunOneRankWithWindowsReport.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "SimpleTesting\OneRank\TsOneRank.cs" SubType = "Code" --- 139,142 ---- *************** *** 208,216 **** /> <File - RelPath = "WalkForwardTesting\MSFTwalkForward\RunMSFTwalkForward.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "WalkForwardTesting\MSFTwalkForward\TsMSFTwalkForward.cs" SubType = "Code" --- 169,172 ---- |