quantproject-developers Mailing List for QuantProject (Page 21)
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...> - 2009-02-28 18:18:42
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14504 Modified Files: Presentation_SD.csproj Log Message: HistoriesViewer.cs has been added Index: Presentation_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Presentation_SD.csproj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Presentation_SD.csproj 29 Sep 2008 21:10:20 -0000 1.7 --- Presentation_SD.csproj 28 Feb 2009 18:18:37 -0000 1.8 *************** *** 68,71 **** --- 68,75 ---- <Compile Include="Charting\Chart.cs" /> <Compile Include="MessageManager.cs" /> + <Compile Include="HistoriesViewer.cs" /> + <Compile Include="HistoriesViewer.Designer.cs"> + <DependentUpon>HistoriesViewer.cs</DependentUpon> + </Compile> <Compile Include="Reporting\Console\ConsoleManager.cs" /> <Compile Include="Reporting\MicrosoftExcel\ExcelManager.cs" /> |
|
From: Glauco S. <gla...@us...> - 2009-02-28 18:18:24
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14289 Added Files: HistoriesViewer.cs HistoriesViewer.Designer.cs Log Message: Form used to visualize (and compare) histories --- NEW FILE: HistoriesViewer.cs --- /* QuantProject - Quantitative Finance Library HistoriesViewer.cs Copyright (C) 2009 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.Drawing; using System.Windows.Forms; using QuantProject.ADT.Histories; using QuantProject.Data.DataProviders.Bars.Caching; using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies; using QuantProject.Presentation.Charting; namespace QuantProject.Presentation { /// <summary> /// Form used to visualize (and compare) histories /// </summary> public partial class HistoriesViewer : Form { private Chart chart; public HistoriesViewer() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); this.addChart(); } private void addChart() { this.chart = new Chart(); this.Controls.Add( chart ); } public void Add( History historyToBePlotted , Color color ) { this.chart.Add( historyToBePlotted , color ); } // #region buildTheForm // // private void addChart() // { // Chart chart = new Chart(); // this.Controls.Add( chart ); // } // // #region populateChart // // #region addChart // // #region getHistoryToBePlotted // private History getHistoryToBePlotted( WeightedPosition weightedPosition ) // { // // } // #endregion getHistoryToBePlotted // // private void addHistory( WeightedPosition weightedPosition ) // { // History historyToBePlotted = // this.getHistoryToBePlotted( weightedPosition ); // this.addHistory( historyToBePlotted ); // } // #endregion addChart // // private void populateChart() // { // foreach ( WeightedPosition weightedPosition in // this.pairsTradingTestingPositions.WeightedPositions ) // this.addHistory( weightedPosition ); // } // #endregion populateChart // // private void buildTheForm() // { // this.addChart(); // this.populateChart(); // } // #endregion buildTheForm } } --- NEW FILE: HistoriesViewer.Designer.cs --- /* QuantProject - Quantitative Finance Library HistoriesViewer.cs Copyright (C) 2009 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. */ namespace QuantProject.Presentation { partial class HistoriesViewer { /// <summary> /// Designer variable used to keep track of non-visual components. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Disposes resources used by the form. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } /// <summary> /// This method is required for Windows Forms designer support. /// Do not change the method contents inside the source code editor. The Forms designer might /// not be able to load this method if it was changed manually. /// </summary> private void InitializeComponent() { this.SuspendLayout(); // // PairsTradingStudio // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(787, 403); this.Name = "PairsTradingStudio"; this.Text = "PairsTradingVisualForm"; this.ResumeLayout(false); } } } |
|
From: Glauco S. <gla...@us...> - 2009-02-28 18:15:49
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13264/b4_Business Modified Files: Business_SD.csproj Log Message: - a07_DataProviders\HistoricalMarketValueProviderWithQuoteBackupOnClose.cs has been added - a07_DataProviders\PriceAdjustmentDetector.cs has been added Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Business_SD.csproj 22 Nov 2008 18:18:09 -0000 1.35 --- Business_SD.csproj 28 Feb 2009 18:15:43 -0000 1.36 *************** *** 48,51 **** --- 48,53 ---- <Compile Include="a05_Timing\IndexBasedHistoricalTimer.cs" /> <Compile Include="a05_Timing\Timer.cs" /> + <Compile Include="a07_DataProviders\HistoricalMarketValueProviderWithQuoteBackupOnClose.cs" /> + <Compile Include="a07_DataProviders\PriceAdjustmentDetector.cs" /> <Compile Include="a07_DataProviders\HistoricalBarProvider.cs" /> <Compile Include="a07_DataProviders\HistoricalDataStreamer.cs" /> |
|
From: Glauco S. <gla...@us...> - 2009-02-28 18:15:11
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12942/a07_DataProviders Added Files: HistoricalMarketValueProviderWithQuoteBackupOnClose.cs Log Message: Returns market values from the given historicalMarketValueProvider, but if the requested market value is at market close, and the historicalMarketValueProvider doesn't have that quote, than the raw close is returned (from the quotes table) --- NEW FILE: HistoricalMarketValueProviderWithQuoteBackupOnClose.cs --- /* QuantProject - Quantitative Finance Library HistoricalMarketValueProviderWithQuoteBackupOnClose.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.DataProviders { /// <summary> /// Returns market values from the given historicalMarketValueProvider, but /// if the requested market value is at market close, and the /// historicalMarketValueProvider doesn't have that quote, than /// the raw close is returned (from the quotes table) /// </summary> [Serializable] public class HistoricalMarketValueProviderWithQuoteBackupOnClose : HistoricalMarketValueProvider { private HistoricalMarketValueProvider historicalMarketValueProvider; private HistoricalRawQuoteProvider historicalRawQuoteProvider; public HistoricalMarketValueProviderWithQuoteBackupOnClose( HistoricalMarketValueProvider historicalMarketValueProvider ) { this.historicalMarketValueProvider = historicalMarketValueProvider; this.historicalRawQuoteProvider = new HistoricalRawQuoteProvider(); } protected override string getDescription() { string description = this.historicalMarketValueProvider.Description + "_whtBckpOnCls"; return description; } #region GetMarketValue private double getRawCloseIfTheCase( string ticker , DateTime dateTime ) { double marketValue = double.NaN; if ( HistoricalEndOfDayTimer.IsMarketClose( dateTime ) ) // dateTime is at market close marketValue = this.historicalRawQuoteProvider.GetMarketValue( ticker , dateTime ); else // dateTime is not at market close throw new TickerNotExchangedException( ticker , dateTime ); return marketValue; } public override double GetMarketValue( string ticker , DateTime dateTime ) { double marketValue; if ( this.historicalMarketValueProvider.WasExchanged( ticker , dateTime ) ) marketValue = this.historicalMarketValueProvider.GetMarketValue( ticker , dateTime ); else // this.historicalMarketValueProvider doesn't have a market value for // the given ticker, at the given dateTime marketValue = this.getRawCloseIfTheCase( ticker , dateTime ); return marketValue; } #endregion GetMarketValue #region WasExchanged private bool isRawCloseAnAvailableBackup( string ticker , DateTime dateTime ) { bool isBackupAvailable = HistoricalEndOfDayTimer.IsMarketClose( dateTime ); isBackupAvailable = isBackupAvailable && this.historicalRawQuoteProvider.WasExchanged( ticker , dateTime ); return isBackupAvailable; } public override bool WasExchanged( string ticker , DateTime dateTime ) { bool wasExchanged = this.historicalMarketValueProvider.WasExchanged( ticker , dateTime ); wasExchanged = wasExchanged || this.isRawCloseAnAvailableBackup( ticker , dateTime ); return wasExchanged; } #endregion WasExchanged } } |
|
From: Glauco S. <gla...@us...> - 2009-02-28 18:14:09
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12497/a07_DataProviders Added Files: PriceAdjustmentDetector.cs Log Message: Checks if a stock price has been adjusted due to a split, a dividen, etc. --- NEW FILE: PriceAdjustmentDetector.cs --- /* QuantProject - Quantitative Finance Library PriceAdjustmentDetector.cs Copyright (C) 2009 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.Timing; using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.Timing; namespace QuantProject.Business.DataProviders { /// <summary> /// Checks if a stock price has been adjusted due to a split, a dividen, etc. /// </summary> [Serializable] public class PriceAdjustmentDetector { private HistoricalAdjustedQuoteProvider historicalAdjustedQuoteProvider; private HistoricalRawQuoteProvider historicalRawQuoteProvider; /// <summary> /// Checks if a stock price has been adjusted due to a split, a dividen, etc. /// </summary> public PriceAdjustmentDetector() { this.historicalAdjustedQuoteProvider = new HistoricalAdjustedQuoteProvider(); this.historicalRawQuoteProvider = new HistoricalRawQuoteProvider(); } private bool isReturnIntervalMultiday( DateTime firstDateTime , DateTime lastDateTime ) { Date intervalBeginDate = new Date( firstDateTime ); Date intervalEndDate = new Date( lastDateTime ); bool isMultiday = ( intervalBeginDate < intervalEndDate ); return isMultiday; } #region hasThePriceBeenAdjustedWithinTheMultidayInterval #region getCloseToCloseReturn #region getCloseToCloseReturnsManager #region getCloseToCloseReturnIntervals private DateTime getMarketCloseDateTime( DateTime dateTime ) { DateTime closeDateTime = HistoricalEndOfDayTimer.GetMarketClose( dateTime ); return closeDateTime; } private ReturnIntervals getCloseToCloseReturnIntervals( DateTime firstDateTime , DateTime lastDateTime ) { DateTime marketCloseDateTimeForIntervalBegin = this.getMarketCloseDateTime( firstDateTime ); DateTime marketCloseDateTimeForIntervalEnd = this.getMarketCloseDateTime( lastDateTime ); ReturnIntervals returnIntervals = new ReturnIntervals( new ReturnInterval( marketCloseDateTimeForIntervalBegin , marketCloseDateTimeForIntervalEnd ) ); return returnIntervals; } #endregion getCloseToCloseReturnIntervals private ReturnsManager getCloseToCloseReturnsManager( string ticker , DateTime firstDateTime , DateTime lastDateTime , HistoricalQuoteProvider historicalQuoteProvider ) { ReturnIntervals closeToCloseReturnIntervals = this.getCloseToCloseReturnIntervals( firstDateTime , lastDateTime ); ReturnsManager closeToCloseReturnsManager = new ReturnsManager( closeToCloseReturnIntervals , historicalQuoteProvider ); return closeToCloseReturnsManager; } #endregion getCloseToCloseReturnsManager private double getCloseToCloseReturn( string ticker , DateTime firstDateTime , DateTime lastDateTime , HistoricalQuoteProvider historicalQuoteProvider ) { ReturnsManager closeToCloseReturnsManager = this.getCloseToCloseReturnsManager( ticker , firstDateTime , lastDateTime , historicalQuoteProvider ); double closeToCloseReturn = closeToCloseReturnsManager.GetReturn( ticker , 0 ); return closeToCloseReturn; } #endregion getCloseToCloseReturn private double getAdjustedCloseToCloseReturn( string ticker , DateTime firstDateTime , DateTime lastDateTime ) { double adjustedCloseToCloseReturn = this.getCloseToCloseReturn( ticker , firstDateTime , lastDateTime , this.historicalAdjustedQuoteProvider ); return adjustedCloseToCloseReturn; } private double getRawCloseToCloseReturn( string ticker , DateTime firstDateTime , DateTime lastDateTime ) { double rawCloseToCloseReturn = this.getCloseToCloseReturn( ticker , firstDateTime , lastDateTime , this.historicalRawQuoteProvider ); return rawCloseToCloseReturn; } private bool hasThePriceBeenAdjustedWithinTheMultidayInterval( string ticker , DateTime firstDateTime , DateTime lastDateTime ) { double adjustedReturn = this.getAdjustedCloseToCloseReturn( ticker , firstDateTime , lastDateTime ); double rawReturn = this.getRawCloseToCloseReturn( ticker , firstDateTime , lastDateTime ); bool hasBeenAdjusted = ( Math.Abs( adjustedReturn - rawReturn ) >= 0.01 ); return hasBeenAdjusted; } #endregion hasThePriceBeenAdjustedWithinTheMultidayInterval /// <summary> /// true iif the price has been adjusted (due to split, dividens, etc.) /// between firstDateTime and lastDateTime /// </summary> /// <param name="ticker"></param> /// <param name="firstDateTime"></param> /// <param name="lastDateTime"></param> /// <returns></returns> public bool HasThePriceBeenAdjusted( string ticker , DateTime firstDateTime , DateTime lastDateTime ) { bool hasBeenAdjusted = ( this.isReturnIntervalMultiday( firstDateTime , lastDateTime ) && this.hasThePriceBeenAdjustedWithinTheMultidayInterval( ticker , firstDateTime , lastDateTime ) ); return hasBeenAdjusted; } } } |
|
From: Glauco S. <gla...@us...> - 2009-02-18 20:05:53
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/OutOfSampleChoosers In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8272/b7_Scripts/WalkForwardTesting/PairsTrading/OutOfSampleChoosers Modified Files: OutOfSampleChooser.cs Added Files: OutOfSampleChooserForAlreadyClosing.cs Log Message: This revision adds a new pairs trading approach, but it's not complete yet. We commit it anyway in order to allow a fresh checkout on a new computer. Index: OutOfSampleChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/OutOfSampleChoosers/OutOfSampleChooser.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OutOfSampleChooser.cs 10 Dec 2008 19:38:43 -0000 1.5 --- OutOfSampleChooser.cs 18 Feb 2009 20:05:32 -0000 1.6 *************** *** 115,147 **** #region getReturnIntervalsForLastSecondPhaseInterval private ReturnInterval ! getReturnIntervalForLastSecondPhaseInterval( ! DateTime firstDateTimeToTestInefficiency , ! DateTime lastDateTimeToTestInefficiency ! // ReturnIntervals outOfSampleReturnIntervals ) { ! // DateTime intervalBegin = ! // this.getIntervalBeginForLastSecondPhaseInterval( ! // outOfSampleReturnIntervals ); ! // DateTime intervalEnd = ! // this.getIntervalEndForLastSecondPhaseInterval( ! // outOfSampleReturnIntervals ); ReturnInterval returnIntervalForLastSecondPhaseInterval = new ReturnInterval( ! firstDateTimeToTestInefficiency , lastDateTimeToTestInefficiency ); return returnIntervalForLastSecondPhaseInterval; } private ReturnIntervals ! getReturnIntervalsForLastSecondPhaseInterval( ! DateTime firstDateTimeToTestInefficiency , ! DateTime lastDateTimeToTestInefficiency ! // ReturnIntervals outOfSampleReturnIntervals ) { ReturnInterval returnIntervalForLastSecondPhaseInterval = ! this.getReturnIntervalForLastSecondPhaseInterval( ! firstDateTimeToTestInefficiency , ! lastDateTimeToTestInefficiency ! // outOfSampleReturnIntervals ); ReturnIntervals returnIntervalsForLastSecondPhaseInterval = --- 115,145 ---- #region getReturnIntervalsForLastSecondPhaseInterval private ReturnInterval ! getReturnIntervalToTestInefficiency( ! DateTime currentDateTime ! // DateTime firstDateTimeToTestInefficiency , ! // DateTime lastDateTimeToTestInefficiency ) { ! // qui!!! ! DateTime firstDateTimeToTestInefficiency = ! currentDateTime.AddMinutes( 30 ); ! ReturnInterval returnIntervalForLastSecondPhaseInterval = new ReturnInterval( ! firstDateTimeToTestInefficiency , currentDateTime ); return returnIntervalForLastSecondPhaseInterval; } private ReturnIntervals ! getReturnIntervalsToTestInefficiency( ! DateTime currentDateTime ! // DateTime firstDateTimeToTestInefficiency , ! // DateTime lastDateTimeToTestInefficiency ) { ReturnInterval returnIntervalForLastSecondPhaseInterval = ! this.getReturnIntervalToTestInefficiency( ! currentDateTime ! // firstDateTimeToTestInefficiency , ! // lastDateTimeToTestInefficiency ); ReturnIntervals returnIntervalsForLastSecondPhaseInterval = *************** *** 151,166 **** #endregion getReturnIntervalsForLastSecondPhaseInterval ! private ReturnsManager getReturnsManagerForLastSecondPhaseInterval( ! DateTime firstDateTimeToTestInefficiency , ! DateTime lastDateTimeToTestInefficiency , ! // ReturnIntervals outOfSampleReturnIntervals , HistoricalMarketValueProvider historicalMarketValueProviderForChosingPositionsOutOfSample ) { ReturnIntervals returnIntervals = ! this.getReturnIntervalsForLastSecondPhaseInterval( ! firstDateTimeToTestInefficiency , ! lastDateTimeToTestInefficiency ! // outOfSampleReturnIntervals ); ReturnsManager returnsManager = --- 149,164 ---- #endregion getReturnIntervalsForLastSecondPhaseInterval ! private ReturnsManager getReturnsManagerToTestInefficiency( ! DateTime currentDateTime , ! // DateTime firstDateTimeToTestInefficiency , ! // DateTime lastDateTimeToTestInefficiency , HistoricalMarketValueProvider historicalMarketValueProviderForChosingPositionsOutOfSample ) { ReturnIntervals returnIntervals = ! this.getReturnIntervalsToTestInefficiency( ! currentDateTime ! // firstDateTimeToTestInefficiency , ! // lastDateTimeToTestInefficiency ); ReturnsManager returnsManager = *************** *** 197,201 **** TestingPositions[] bestTestingPositionsInSample , int currentTestingPositionsIndex , ! DateTime dateTimeToClosePositions , HistoricalMarketValueProvider historicalMarketValueProviderForChosingPositionsOutOfSample ) --- 195,199 ---- TestingPositions[] bestTestingPositionsInSample , int currentTestingPositionsIndex , ! // DateTime dateTimeToClosePositions , HistoricalMarketValueProvider historicalMarketValueProviderForChosingPositionsOutOfSample ) *************** *** 203,210 **** TestingPositions currentCouple = bestTestingPositionsInSample[ currentTestingPositionsIndex ]; ! bool areAllAvailable = ! this.areAllNeededMarketValuesAvailableForTheCurrentCouple( ! currentCouple , dateTimeToClosePositions , ! historicalMarketValueProviderForChosingPositionsOutOfSample ); return areAllAvailable; } --- 201,209 ---- TestingPositions currentCouple = bestTestingPositionsInSample[ currentTestingPositionsIndex ]; ! bool areAllAvailable = true; ! // qui!!! ! // this.areAllNeededMarketValuesAvailableForTheCurrentCouple( ! // currentCouple , dateTimeToClosePositions , ! // historicalMarketValueProviderForChosingPositionsOutOfSample ); return areAllAvailable; } *************** *** 243,252 **** return returnForTheLastSecondPhaseInterval; } // if the currentWeightedPositions' return satisfies the thresholds // then this method returns the WeightedPositions that might be opened. // Otherwise (currentWeightedPositions' return does NOT // satisfy the thresholds) this method returns null ! private WeightedPositions ! getPositionsIfInefficiencyIsInTheRange( ReturnsManager returnsManagerForLastSecondPhaseInterval , WeightedPositions currentWeightedPositions ) --- 242,252 ---- return returnForTheLastSecondPhaseInterval; } + // if the currentWeightedPositions' return satisfies the thresholds // then this method returns the WeightedPositions that might be opened. // Otherwise (currentWeightedPositions' return does NOT // satisfy the thresholds) this method returns null ! protected virtual WeightedPositions ! getWeightedPositionsFromCandidate( ReturnsManager returnsManagerForLastSecondPhaseInterval , WeightedPositions currentWeightedPositions ) *************** *** 294,298 **** this.getCandidateForPortfolio( currentWeightedPositions ); WeightedPositions weightedPositionsThatMightBeOpended = ! this.getPositionsIfInefficiencyIsInTheRange( returnsManagerForLastSecondPhaseInterval , candidateForPortfolio ); if ( weightedPositionsThatMightBeOpended != null ) --- 294,298 ---- this.getCandidateForPortfolio( currentWeightedPositions ); WeightedPositions weightedPositionsThatMightBeOpended = ! this.getWeightedPositionsFromCandidate( returnsManagerForLastSecondPhaseInterval , candidateForPortfolio ); if ( weightedPositionsThatMightBeOpended != null ) *************** *** 305,309 **** TestingPositions[] bestTestingPositionsInSample , ReturnsManager returnsManagerForLastSecondPhaseInterval , ! DateTime dateTimeToClosePositions , HistoricalMarketValueProvider historicalMarketValueProviderForChosingPositionsOutOfSample ) --- 305,309 ---- TestingPositions[] bestTestingPositionsInSample , ReturnsManager returnsManagerForLastSecondPhaseInterval , ! // DateTime dateTimeToClosePositions , HistoricalMarketValueProvider historicalMarketValueProviderForChosingPositionsOutOfSample ) *************** *** 317,321 **** bestTestingPositionsInSample , currentTestingPositionsIndex , ! dateTimeToClosePositions , historicalMarketValueProviderForChosingPositionsOutOfSample ) ) this.addPositionsIfInefficiencyForCurrentCoupleIsInTheRange( --- 317,321 ---- bestTestingPositionsInSample , currentTestingPositionsIndex , ! // dateTimeToClosePositions , historicalMarketValueProviderForChosingPositionsOutOfSample ) ) this.addPositionsIfInefficiencyForCurrentCoupleIsInTheRange( *************** *** 332,338 **** getArrayListOfInefficientCouples( TestingPositions[] bestTestingPositionsInSample , ! DateTime firstDateTimeToTestInefficiency , ! DateTime lastDateTimeToTestInefficiency , ! DateTime dateTimeToClosePositions , // ReturnIntervals outOfSampleReturnIntervals , HistoricalMarketValueProvider --- 332,339 ---- getArrayListOfInefficientCouples( TestingPositions[] bestTestingPositionsInSample , ! DateTime currentDateTime , ! // DateTime firstDateTimeToTestInefficiency , ! // DateTime lastDateTimeToTestInefficiency , ! // DateTime dateTimeToClosePositions , // ReturnIntervals outOfSampleReturnIntervals , HistoricalMarketValueProvider *************** *** 340,347 **** { ReturnsManager returnsManagerForLastSecondPhaseInterval = ! this.getReturnsManagerForLastSecondPhaseInterval( ! firstDateTimeToTestInefficiency , ! lastDateTimeToTestInefficiency , ! // outOfSampleReturnIntervals , historicalMarketValueProviderForChosingPositionsOutOfSample ); ArrayList inefficientCouples = --- 341,348 ---- { ReturnsManager returnsManagerForLastSecondPhaseInterval = ! this.getReturnsManagerToTestInefficiency( ! currentDateTime , ! // firstDateTimeToTestInefficiency , ! // lastDateTimeToTestInefficiency , historicalMarketValueProviderForChosingPositionsOutOfSample ); ArrayList inefficientCouples = *************** *** 349,353 **** bestTestingPositionsInSample , returnsManagerForLastSecondPhaseInterval , ! dateTimeToClosePositions , historicalMarketValueProviderForChosingPositionsOutOfSample ); return inefficientCouples; --- 350,354 ---- bestTestingPositionsInSample , returnsManagerForLastSecondPhaseInterval , ! // dateTimeToClosePositions , historicalMarketValueProviderForChosingPositionsOutOfSample ); return inefficientCouples; *************** *** 379,424 **** #endregion getInefficientCouplesFromArrayList ! private WeightedPositions[] ! getInefficientCouples_withAtLeastASecondPhaseInterval( ! TestingPositions[] bestTestingPositionsInSample , ! DateTime firstDateTimeToTestInefficiency , ! DateTime lastDateTimeToTestInefficiency , ! DateTime dateTimeToClosePositions , ! // ReturnIntervals outOfSampleReturnIntervals , ! HistoricalMarketValueProvider ! historicalMarketValueProviderForChosingPositionsOutOfSample ) ! { ! ArrayList arrayListOfInefficientCouples = ! this.getArrayListOfInefficientCouples( ! bestTestingPositionsInSample , ! firstDateTimeToTestInefficiency , ! lastDateTimeToTestInefficiency , ! dateTimeToClosePositions , ! // outOfSampleReturnIntervals , ! historicalMarketValueProviderForChosingPositionsOutOfSample ); ! WeightedPositions[] inefficientCouples = ! this.getInefficientCouplesFromArrayList( arrayListOfInefficientCouples ); ! return inefficientCouples; ! } private WeightedPositions[] getInefficientCouples( TestingPositions[] bestTestingPositionsInSample , ! DateTime firstDateTimeToTestInefficiency , ! DateTime lastDateTimeToTestInefficiency , ! DateTime dateTimeToClosePositions , // ReturnIntervals outOfSampleReturnIntervals , HistoricalMarketValueProvider historicalMarketValueProviderForChosingPositionsOutOfSample ) { ! WeightedPositions[] inefficientCouples = null; ! // if ( outOfSampleReturnIntervals.Count >= 2 ) ! // // at least a second phase interval exists ! inefficientCouples = ! this.getInefficientCouples_withAtLeastASecondPhaseInterval( bestTestingPositionsInSample , ! firstDateTimeToTestInefficiency , ! lastDateTimeToTestInefficiency , ! dateTimeToClosePositions , ! // outOfSampleReturnIntervals , historicalMarketValueProviderForChosingPositionsOutOfSample ); return inefficientCouples; --- 380,434 ---- #endregion getInefficientCouplesFromArrayList ! // private WeightedPositions[] ! // getInefficientCouples_withAtLeastASecondPhaseInterval( ! // TestingPositions[] bestTestingPositionsInSample , ! // DateTime firstDateTimeToTestInefficiency , ! // DateTime lastDateTimeToTestInefficiency , ! // DateTime dateTimeToClosePositions , ! //// ReturnIntervals outOfSampleReturnIntervals , ! // HistoricalMarketValueProvider ! // historicalMarketValueProviderForChosingPositionsOutOfSample ) ! // { ! // ArrayList arrayListOfInefficientCouples = ! // this.getArrayListOfInefficientCouples( ! // bestTestingPositionsInSample , ! // firstDateTimeToTestInefficiency , ! // lastDateTimeToTestInefficiency , ! // dateTimeToClosePositions , ! //// outOfSampleReturnIntervals , ! // historicalMarketValueProviderForChosingPositionsOutOfSample ); ! // WeightedPositions[] inefficientCouples = ! // this.getInefficientCouplesFromArrayList( arrayListOfInefficientCouples ); ! // return inefficientCouples; ! // } private WeightedPositions[] getInefficientCouples( TestingPositions[] bestTestingPositionsInSample , ! DateTime currentDateTime , ! // DateTime firstDateTimeToTestInefficiency , ! // DateTime lastDateTimeToTestInefficiency , ! // DateTime dateTimeToClosePositions , // ReturnIntervals outOfSampleReturnIntervals , HistoricalMarketValueProvider historicalMarketValueProviderForChosingPositionsOutOfSample ) { ! // WeightedPositions[] inefficientCouples = null; ! // inefficientCouples = ! // this.getInefficientCouples_withAtLeastASecondPhaseInterval( ! // bestTestingPositionsInSample , ! // firstDateTimeToTestInefficiency , ! // lastDateTimeToTestInefficiency , ! // dateTimeToClosePositions , ! // historicalMarketValueProviderForChosingPositionsOutOfSample ); ! ArrayList arrayListOfInefficientCouples = ! this.getArrayListOfInefficientCouples( bestTestingPositionsInSample , ! currentDateTime , ! // firstDateTimeToTestInefficiency , ! // lastDateTimeToTestInefficiency , ! // dateTimeToClosePositions , ! // outOfSampleReturnIntervals , historicalMarketValueProviderForChosingPositionsOutOfSample ); + WeightedPositions[] inefficientCouples = + this.getInefficientCouplesFromArrayList( arrayListOfInefficientCouples ); return inefficientCouples; *************** *** 428,434 **** private WeightedPositions getPositionsToBeOpened_actually( TestingPositions[] bestTestingPositionsInSample , ! DateTime firstDateTimeToTestInefficiency , ! DateTime lastDateTimeToTestInefficiency , ! DateTime dateTimeToClosePositions , // ReturnIntervals outOfSampleReturnIntervals , HistoricalMarketValueProvider --- 438,445 ---- private WeightedPositions getPositionsToBeOpened_actually( TestingPositions[] bestTestingPositionsInSample , ! DateTime currentDateTime , ! // DateTime firstDateTimeToTestInefficiency , ! // DateTime lastDateTimeToTestInefficiency , ! // DateTime dateTimeToClosePositions , // ReturnIntervals outOfSampleReturnIntervals , HistoricalMarketValueProvider *************** *** 440,446 **** this.getInefficientCouples( bestTestingPositionsInSample , ! firstDateTimeToTestInefficiency , ! lastDateTimeToTestInefficiency , ! dateTimeToClosePositions , // outOfSampleReturnIntervals , historicalMarketValueProviderForChosingPositionsOutOfSample ); --- 451,458 ---- this.getInefficientCouples( bestTestingPositionsInSample , ! currentDateTime , ! // firstDateTimeToTestInefficiency , ! // lastDateTimeToTestInefficiency , ! // dateTimeToClosePositions , // outOfSampleReturnIntervals , historicalMarketValueProviderForChosingPositionsOutOfSample ); *************** *** 466,472 **** public virtual WeightedPositions GetPositionsToBeOpened( TestingPositions[] bestTestingPositionsInSample , ! DateTime firstDateTimeToTestInefficiency , ! DateTime lastDateTimeToTestInefficiency , ! DateTime dateTimeToClosePositions , // ReturnIntervals outOfSampleReturnIntervals , HistoricalMarketValueProvider --- 478,482 ---- public virtual WeightedPositions GetPositionsToBeOpened( TestingPositions[] bestTestingPositionsInSample , ! DateTime currentDateTime , // ReturnIntervals outOfSampleReturnIntervals , HistoricalMarketValueProvider *************** *** 474,487 **** ReturnsManager inSampleReturnsManager ) { ! this.checkParameters( ! firstDateTimeToTestInefficiency , ! lastDateTimeToTestInefficiency , ! dateTimeToClosePositions ); WeightedPositions positionsToBeOpened = this.getPositionsToBeOpened_actually( bestTestingPositionsInSample , ! firstDateTimeToTestInefficiency , ! lastDateTimeToTestInefficiency , ! dateTimeToClosePositions , historicalMarketValueProviderForChosingPositionsOutOfSample , inSampleReturnsManager ); --- 484,498 ---- ReturnsManager inSampleReturnsManager ) { ! // this.checkParameters( ! // firstDateTimeToTestInefficiency , ! // lastDateTimeToTestInefficiency , ! // dateTimeToClosePositions ); WeightedPositions positionsToBeOpened = this.getPositionsToBeOpened_actually( bestTestingPositionsInSample , ! currentDateTime , ! // firstDateTimeToTestInefficiency , ! // lastDateTimeToTestInefficiency , ! // dateTimeToClosePositions , historicalMarketValueProviderForChosingPositionsOutOfSample , inSampleReturnsManager ); --- NEW FILE: OutOfSampleChooserForAlreadyClosing.cs --- /* QuantProject - Quantitative Finance Library OutOfSampleChooserForAlreadyClosing.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.Strategies; using QuantProject.Business.Strategies.ReturnsManagement; namespace QuantProject.Scripts.WalkForwardTesting.PairsTrading { /// <summary> /// Chooses two positions that seem to be an arbitrage opportunity. /// Among the eligible couples, a couple is discard if any of the two tickers /// have had a either split, or dividend, or any other event that may /// have caused an overnight price adjustment /// </summary> [Serializable] public class OutOfSampleChooserForAlreadyClosing : OutOfSampleChooserForSingleLongAndShort { private int numberOfConsecutiveMinutesToSayTheInefficiencyIsClosing; public OutOfSampleChooserForAlreadyClosing( double minThresholdForGoingLong , double maxThresholdForGoingLong , double minThresholdForGoingShort , double maxThresholdForGoingShort , int numberOfConsecutiveMinutesToSayTheInefficiencyIsClosing ) : base( minThresholdForGoingLong , maxThresholdForGoingLong , minThresholdForGoingShort , maxThresholdForGoingShort ) { this.numberOfConsecutiveMinutesToSayTheInefficiencyIsClosing = numberOfConsecutiveMinutesToSayTheInefficiencyIsClosing; } #region getPositionsFromCandidate #region hasThePriceBeenAdjustedLastNight private bool hasThePriceBeenAdjustedLastNight( WeightedPositions candidate ) { // qui!!! return false; } #endregion hasThePriceBeenAdjustedLastNight #region getWeightedPositionsFromCandidateWithoutAdjustment private WeightedPositions getWeightedPositionsFromCandidateWithoutAdjustment( ReturnsManager returnsManagerForLastSecondPhaseInterval , WeightedPositions candidate ) { // qui!!!! // vedi OutOfSampleChooser.getWeightedPositionsFromCandidate(), // testa l'inefficienza allo stesso modo, ma poi aggiungi il test // per vedere se c'e' l'inizio di chiusura; devi considerare // il passaggio dei tempi: probabilmente ti converra' modificare // OutOfSampleChooserForSingleLongAndShort e passargli // firstTimeToTestInefficiency nel costruttore per poi modificare // OutOfSampleChooser.GetPositionsToBeOpened() togliendo i // parametri firstDateTimeToTestInefficiency e dateTimeToClosePositions // qui!!! return candidate; } #endregion getWeightedPositionsFromCandidateWithoutAdjustment protected override WeightedPositions getWeightedPositionsFromCandidate( ReturnsManager returnsManagerForLastSecondPhaseInterval , WeightedPositions candidate ) { WeightedPositions weightedPositionsFromCandidate = null; if ( !this.hasThePriceBeenAdjustedLastNight( candidate ) ) weightedPositionsFromCandidate = this.getWeightedPositionsFromCandidateWithoutAdjustment( returnsManagerForLastSecondPhaseInterval , candidate ); return weightedPositionsFromCandidate; } #endregion getPositionsFromCandidate } } |
|
From: Glauco S. <gla...@us...> - 2009-02-18 20:05:53
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Strategies In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8272/b7_Scripts/WalkForwardTesting/PairsTrading/Strategies Modified Files: PairsTradingIntradayStrategy.cs PairsTradingStrategy.cs Log Message: This revision adds a new pairs trading approach, but it's not complete yet. We commit it anyway in order to allow a fresh checkout on a new computer. Index: PairsTradingStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Strategies/PairsTradingStrategy.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PairsTradingStrategy.cs 10 Dec 2008 19:41:36 -0000 1.8 --- PairsTradingStrategy.cs 18 Feb 2009 20:05:34 -0000 1.9 *************** *** 157,173 **** private WeightedPositions getPositionsToBeOpened_withAtLeastASecondPhaseInterval() { ! DateTime firstDateTimeToTestInefficiency = ! this.getFirstDateTimeToTestInefficiency(); DateTime lastDateTimeToTestInefficiency = this.getLastDateTimeToTestInefficiency(); ! DateTime dateTimeToClosePositions = ! this.getDateTimeToClosePositions(); WeightedPositions positionsToBeOpened = this.outOfSampleChooser.GetPositionsToBeOpened( this.bestTestingPositionsInSample , ! firstDateTimeToTestInefficiency , lastDateTimeToTestInefficiency , ! dateTimeToClosePositions , ! // this.returnIntervals , this.historicalMarketValueProviderForChosingPositionsOutOfSample , this.inSampleReturnsManager ); --- 157,172 ---- private WeightedPositions getPositionsToBeOpened_withAtLeastASecondPhaseInterval() { ! // DateTime firstDateTimeToTestInefficiency = ! // this.getFirstDateTimeToTestInefficiency(); DateTime lastDateTimeToTestInefficiency = this.getLastDateTimeToTestInefficiency(); ! // DateTime dateTimeToClosePositions = ! // this.getDateTimeToClosePositions(); WeightedPositions positionsToBeOpened = this.outOfSampleChooser.GetPositionsToBeOpened( this.bestTestingPositionsInSample , ! // firstDateTimeToTestInefficiency , lastDateTimeToTestInefficiency , ! // dateTimeToClosePositions , this.historicalMarketValueProviderForChosingPositionsOutOfSample , this.inSampleReturnsManager ); Index: PairsTradingIntradayStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Strategies/PairsTradingIntradayStrategy.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PairsTradingIntradayStrategy.cs 10 Dec 2008 19:39:53 -0000 1.3 --- PairsTradingIntradayStrategy.cs 18 Feb 2009 20:05:34 -0000 1.4 *************** *** 169,174 **** protected override WeightedPositions getPositionsToBeOpened() { ! DateTime firstDateTimeToTestInefficiency = ! this.getFirstDateTimeToTestInefficiency(); DateTime lastDateTimeToTestInefficiency = this.getLastDateTimeToTestInefficiency(); --- 169,174 ---- protected override WeightedPositions getPositionsToBeOpened() { ! // DateTime firstDateTimeToTestInefficiency = ! // this.getFirstDateTimeToTestInefficiency(); DateTime lastDateTimeToTestInefficiency = this.getLastDateTimeToTestInefficiency(); *************** *** 181,187 **** this.outOfSampleChooser.GetPositionsToBeOpened( this.bestTestingPositionsInSample , ! firstDateTimeToTestInefficiency , lastDateTimeToTestInefficiency , ! dateTimeToClosePositions , this.historicalMarketValueProviderForChosingPositionsOutOfSample , this.inSampleReturnsManager ); --- 181,187 ---- this.outOfSampleChooser.GetPositionsToBeOpened( this.bestTestingPositionsInSample , ! // firstDateTimeToTestInefficiency , lastDateTimeToTestInefficiency , ! // dateTimeToClosePositions , this.historicalMarketValueProviderForChosingPositionsOutOfSample , this.inSampleReturnsManager ); |
|
From: Glauco S. <gla...@us...> - 2009-02-18 20:05:53
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8272/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingMain.cs Log Message: This revision adds a new pairs trading approach, but it's not complete yet. We commit it anyway in order to allow a fresh checkout on a new computer. Index: PairsTradingMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingMain.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** PairsTradingMain.cs 31 Dec 2008 02:35:16 -0000 1.27 --- PairsTradingMain.cs 18 Feb 2009 20:05:34 -0000 1.28 *************** *** 88,92 **** // definition for the Fitness Evaluator ! // IEquityEvaluator equityEvaluator = new SharpeRatio(); } --- 88,92 ---- // definition for the Fitness Evaluator ! // IEquityEvaluator equityEvaluator = new SharpeRatio(); } *************** *** 104,112 **** { List< Time > dailyTimes = new List< Time >(); ! dailyTimes.Add( this.firstTimeToTestInefficiency ); ! dailyTimes.Add( this.lastTimeToTestInefficiency ); ! dailyTimes.Add( this.timeToClosePositions ); ! // dailyTimes.Add( new Time( ! // HistoricalEndOfDayTimer.GetOneHourAfterMarketClose( DateTime.Now ) ) ); return dailyTimes; } --- 104,116 ---- { List< Time > dailyTimes = new List< Time >(); ! Time time = new Time( 9 , 30 , 0 ); ! while ( time <= new Time( 16 , 0 , 0 ) ) ! { ! dailyTimes.Add( time ); ! time = time.AddMinutes( 1 ); ! } ! // dailyTimes.Add( this.firstTimeToTestInefficiency ); ! // dailyTimes.Add( this.lastTimeToTestInefficiency ); ! // dailyTimes.Add( this.timeToClosePositions ); return dailyTimes; } *************** *** 134,138 **** string tickersGroupId = "SP500"; // uncomment the following line for a faster script ! // tickersGroupId = "fastTest"; // IEligiblesSelector eligiblesSelector = --- 138,142 ---- string tickersGroupId = "SP500"; // uncomment the following line for a faster script ! tickersGroupId = "fastTest"; // IEligiblesSelector eligiblesSelector = *************** *** 140,149 **** // tickersGroupId , // maxNumberOfEligiblesToBeChosen ); ! IEligiblesSelector eligiblesSelector = ! new ByPriceMostLiquidAlwaysQuoted( ! tickersGroupId , ! true , ! maxNumberOfEligiblesToBeChosen , ! 10 , 20 , 75 ); eligiblesSelector = new ByPriceMostLiquidLessVolatileOTCAlwaysQuoted( --- 144,153 ---- // tickersGroupId , // maxNumberOfEligiblesToBeChosen ); ! // IEligiblesSelector eligiblesSelector = ! // new ByPriceMostLiquidAlwaysQuoted( ! // tickersGroupId , ! // true , ! // maxNumberOfEligiblesToBeChosen , ! // 10 , 20 , 75 ); eligiblesSelector = new ByPriceMostLiquidLessVolatileOTCAlwaysQuoted( *************** *** 154,158 **** 10 , 10 , 20 , 75 ); - // uncomment the following line for a (logbased) log based in sample chooser // eligiblesSelector = new DummyEligibleSelector(); --- 158,161 ---- *************** *** 165,169 **** int numberOfBestTestingPositionsToBeReturned = 50; // uncomment the following line for a faster script ! // numberOfBestTestingPositionsToBeReturned = 10; IDecoderForTestingPositions decoderForWeightedPositions = --- 168,172 ---- int numberOfBestTestingPositionsToBeReturned = 50; // uncomment the following line for a faster script ! numberOfBestTestingPositionsToBeReturned = 10; IDecoderForTestingPositions decoderForWeightedPositions = *************** *** 238,241 **** --- 241,247 ---- // new OutOfSampleChooserForExactNumberOfBestLongPositions( // 2 , 0.006 , 0.99 , 0.006 , 0.99 ); + outOfSampleChooser = + new OutOfSampleChooserForAlreadyClosing( + 0.01 , 0.03 , 0.01 , 0.03 , 4 ); IStrategyForBacktester strategyForBacktester = *************** *** 259,262 **** --- 265,277 ---- this.historicalMarketValueProviderForChosingPositionsOutOfSample , outOfSampleChooser ); + // qui!!! + // strategyForBacktester = + // new PairsTradingAfterClosingStrategy( + // 7 , inSampleDays , + // intervalsSelectorForInSample , + // eligiblesSelector , inSampleChooser , + // this.historicalMarketValueProviderForInSample , + // this.historicalMarketValueProviderForChosingPositionsOutOfSample , + // outOfSampleChooser ); return strategyForBacktester; } *************** *** 286,291 **** // uncomment the following two lines for a faster script firstDateTime = new DateTime( 2006 , 1 , 2 ); ! lastDateTime = new DateTime( 2007 , 12 , 31 ); ! // lastDateTime = new DateTime( 2006 , 1 , 31 ); double maxRunningHours = 2.5; --- 301,306 ---- // uncomment the following two lines for a faster script firstDateTime = new DateTime( 2006 , 1 , 2 ); ! // lastDateTime = new DateTime( 2007 , 12 , 31 ); ! lastDateTime = new DateTime( 2006 , 1 , 31 ); double maxRunningHours = 2.5; |
|
From: Glauco S. <gla...@us...> - 2009-02-18 20:05:47
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8272/b7_Scripts Modified Files: Scripts_SD.csproj Log Message: This revision adds a new pairs trading approach, but it's not complete yet. We commit it anyway in order to allow a fresh checkout on a new computer. Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Scripts_SD.csproj 23 Nov 2008 17:15:43 -0000 1.34 --- Scripts_SD.csproj 18 Feb 2009 20:05:34 -0000 1.35 *************** *** 127,130 **** --- 127,131 ---- <Compile Include="WalkForwardTesting\PairsTrading\Logging\TesterForPairsTradingTestingPositions.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\OutOfSampleChoosers\OutOfSampleChooser.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\OutOfSampleChoosers\OutOfSampleChooserForAlreadyClosing.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\OutOfSampleChoosers\OutOfSampleChooserForExactNumberOfBestLongPositions.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\OutOfSampleChoosers\OutOfSampleChooserForSingleLongAndShort.cs" /> |
|
From: Marco M. <mi...@us...> - 2009-02-08 19:12:22
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Bars/Caching In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22703/b3_Data/DataProviders/Bars/Caching Modified Files: SimpleBarCache.cs Log Message: Catch block has been written in a more simple way Index: SimpleBarCache.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Bars/Caching/SimpleBarCache.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SimpleBarCache.cs 8 Feb 2009 16:45:56 -0000 1.2 --- SimpleBarCache.cs 8 Feb 2009 19:12:17 -0000 1.3 *************** *** 54,64 **** QuantProject.DataAccess.Tables.Bars.GetOpen( ticker , dateTime , this.intervalFrameInSeconds ); } ! catch( Exception ex ) { ! if( ex.GetType() == Type.GetType("QuantProject.DataAccess.EmptyQueryException") ) ! throw new MissingBarException( ! ticker , dateTime , this.intervalFrameInSeconds); ! else ! throw ex; } return returnValue; --- 54,61 ---- QuantProject.DataAccess.Tables.Bars.GetOpen( ticker , dateTime , this.intervalFrameInSeconds ); } ! catch( EmptyQueryException ex ) { ! string notUsed = ex.ToString(); ! throw new MissingBarException(ticker , dateTime , this.intervalFrameInSeconds); } return returnValue; |
|
From: Marco M. <mi...@us...> - 2009-02-08 16:46:03
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Bars/Caching In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10345/b3_Data/DataProviders/Bars/Caching Modified Files: SimpleBarCache.cs Log Message: Exception management is more logic now: the missingBarException is thrown only if necessary. Index: SimpleBarCache.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Bars/Caching/SimpleBarCache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleBarCache.cs 5 Feb 2009 22:11:16 -0000 1.1 --- SimpleBarCache.cs 8 Feb 2009 16:45:56 -0000 1.2 *************** *** 23,26 **** --- 23,28 ---- using System; + using QuantProject.DataAccess; + namespace QuantProject.Data.DataProviders.Bars.Caching { *************** *** 31,34 **** --- 33,37 ---- { private int intervalFrameInSeconds; + public SimpleBarCache(int intervalFrameInSeconds) { *************** *** 53,59 **** catch( Exception ex ) { ! string message = ex.Message; // used to avoid warning ! throw new MissingBarException( ! ticker , dateTime , this.intervalFrameInSeconds); } return returnValue; --- 56,64 ---- catch( Exception ex ) { ! if( ex.GetType() == Type.GetType("QuantProject.DataAccess.EmptyQueryException") ) ! throw new MissingBarException( ! ticker , dateTime , this.intervalFrameInSeconds); ! else ! throw ex; } return returnValue; *************** *** 62,66 **** public bool WasExchanged( string ticker , DateTime dateTime ) { ! double marketValue = double.MinValue; try { --- 67,71 ---- public bool WasExchanged( string ticker , DateTime dateTime ) { ! double marketValue = double.NaN; try { *************** *** 71,75 **** string doNothing = missingBarException.Message; doNothing += ""; } ! return (marketValue != Double.MinValue); } } --- 76,80 ---- string doNothing = missingBarException.Message; doNothing += ""; } ! return (marketValue != Double.NaN); } } |
|
From: Marco M. <mi...@us...> - 2009-02-08 16:43:38
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7782/b2_DataAccess/Tables Modified Files: Bars.cs Log Message: Added GetLow and GetHigh methods; code has been reorganized properly. Now the EmptyQueryException is thrown if necessary. Index: Bars.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Bars.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Bars.cs 5 Feb 2009 22:11:54 -0000 1.8 --- Bars.cs 8 Feb 2009 16:43:34 -0000 1.9 *************** *** 123,159 **** } ! /// <summary> ! /// Returns the close for the given ticker at the specified date ! /// time ! /// </summary> ! /// <param name="ticker">ticker for which the close has to be returned</param> ! /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bars</param> ! /// <returns></returns> ! public static double GetClose( string ticker, DateTime dateTime, int intervalFrameInSeconds ) { ! DataTable dataTable = SqlExecutor.GetDataTable( ! "select " + Bars.Close + " from bars " + "where " + Bars.TickerFieldName + "='" + ticker + "' and " + Bars.IntervalFrameInSeconds + "='" + intervalFrameInSeconds + "' " + ! "and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateTimeConstant(dateTime) ); ! return (double)dataTable.Rows[0][0]; } /// <summary> ! /// Returns the open for the given ticker at the specified date ! /// time /// </summary> /// <param name="ticker">ticker for which the raw open has to be returned</param> ! /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bars</param> /// <returns></returns> public static double GetOpen( string ticker, DateTime dateTime, int intervalFrameInSeconds ) { ! DataTable dataTable = SqlExecutor.GetDataTable( ! "select " + Bars.Open + " from bars " + ! "where " + Bars.TickerFieldName + "='" + ticker + "' and " + ! Bars.IntervalFrameInSeconds + "='" + intervalFrameInSeconds + "' " + ! "and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateTimeConstant(dateTime) ); ! return (double)dataTable.Rows[0][0]; } // /// <summary> --- 123,185 ---- } ! #region GetOpen, GetHigh, GetLow, GetClose ! ! private static double getValueFromBar( string ticker, DateTime dateTime, int intervalFrameInSeconds, ! string fieldNameContainingValue) { ! double returnValue = Double.NaN; ! string sqlQuery = "select " + fieldNameContainingValue + " from bars " + "where " + Bars.TickerFieldName + "='" + ticker + "' and " + Bars.IntervalFrameInSeconds + "='" + intervalFrameInSeconds + "' " + ! "and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateTimeConstant(dateTime); ! DataTable dataTable = SqlExecutor.GetDataTable( sqlQuery ); ! if( dataTable.Rows.Count > 0 ) ! returnValue = (double)dataTable.Rows[0][0]; ! else ! throw new EmptyQueryException( sqlQuery ); ! return returnValue; } /// <summary> ! /// Returns the open for the given ticker for the given bar that opens at the specified date time /// </summary> /// <param name="ticker">ticker for which the raw open has to be returned</param> ! /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bar</param> /// <returns></returns> public static double GetOpen( string ticker, DateTime dateTime, int intervalFrameInSeconds ) { ! return getValueFromBar(ticker, dateTime, intervalFrameInSeconds, Bars.Open); ! } ! /// <summary> ! /// Returns the high for the given ticker for the given bar that opens at the specified date time ! /// </summary> ! /// <param name="ticker">ticker for which the raw high has to be returned</param> ! /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bar</param> ! /// <returns></returns> ! public static double GetHigh( string ticker, DateTime dateTime, int intervalFrameInSeconds ) ! { ! return getValueFromBar(ticker, dateTime, intervalFrameInSeconds, Bars.High); ! } ! /// <summary> ! /// Returns the low for the given ticker for the given bar that opens at the specified date time ! /// </summary> ! /// <param name="ticker">ticker for which the raw low has to be returned</param> ! /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bar</param> ! /// <returns></returns> ! public static double GetLow( string ticker, DateTime dateTime, int intervalFrameInSeconds ) ! { ! return getValueFromBar(ticker, dateTime, intervalFrameInSeconds, Bars.Low); ! } ! /// <summary> ! /// Returns the close for the given ticker for the given bar that opens at the specified date time ! /// </summary> ! /// <param name="ticker">ticker for which the raw close has to be returned</param> ! /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bar</param> ! /// <returns></returns> ! public static double GetClose( string ticker, DateTime dateTime, int intervalFrameInSeconds ) ! { ! return getValueFromBar(ticker, dateTime, intervalFrameInSeconds, Bars.Close); } + #endregion // /// <summary> |
|
From: Marco M. <mi...@us...> - 2009-02-08 16:41:36
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5219/b2_DataAccess Modified Files: DataAccess_SD.csproj Added Files: EmptyQueryException.cs Log Message: Added EmptyQueryException, that could be useful to throw when a given query on database doesn't return any row. Index: DataAccess_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataAccess_SD.csproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DataAccess_SD.csproj 30 Dec 2008 00:29:04 -0000 1.6 --- DataAccess_SD.csproj 8 Feb 2009 16:41:27 -0000 1.7 *************** *** 64,67 **** --- 64,68 ---- <Compile Include="DbCommandProvider.cs" /> <Compile Include="DbDataAdapterProvider.cs" /> + <Compile Include="EmptyQueryException.cs" /> <Compile Include="OleDbSingleTableAdapter.cs" /> <Compile Include="QuoteField.cs" /> --- NEW FILE: EmptyQueryException.cs --- /* QuantProject - Quantitative Finance Library EmptyQueryException.cs Copyright (C) 2009 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; namespace QuantProject.DataAccess { /// <summary> /// It can be thrown when a query is launched, but no row is returned /// </summary> public class EmptyQueryException : Exception { private string sqlQuery; public override string Message { get { return "No row for this query: " + this.sqlQuery; } } public EmptyQueryException( string sqlQuery ) { this.sqlQuery = sqlQuery; } } } |
|
From: Glauco S. <gla...@us...> - 2009-02-08 15:05:22
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29936/Downloader/OpenTickDownloader Modified Files: OTTickerDownloader.cs Log Message: Last date is now supported for specific daily bars, also Index: OTTickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/OTTickerDownloader.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** OTTickerDownloader.cs 7 Feb 2009 16:55:31 -0000 1.10 --- OTTickerDownloader.cs 8 Feb 2009 15:05:09 -0000 1.11 *************** *** 47,50 **** --- 47,51 ---- private List<Time> dailyTimes; private DateTime firstDate; + private DateTime lastDate; private DateTime dateTimeForFirstBarOpenInNewYorkTimeZone; *************** *** 54,58 **** /// number of seconds in each bar /// </summary> ! private int barInterval; private DateTime dateTimeForOverWritingQuotes;//before this //date quotes should be overwritten automatically --- 55,59 ---- /// number of seconds in each bar /// </summary> ! private int barIntervalInSeconds; private DateTime dateTimeForOverWritingQuotes;//before this //date quotes should be overwritten automatically *************** *** 106,111 **** string[] tickersToDownload, List<Time> dailyTimes , ! DateTime firstDate, ! int barInterval , DateTime dateTimeForOverWritingQuotes, bool checkForMissingQuotes, --- 107,113 ---- string[] tickersToDownload, List<Time> dailyTimes , ! DateTime firstDate , ! DateTime lastDate , ! int barIntervalInSeconds , DateTime dateTimeForOverWritingQuotes, bool checkForMissingQuotes, *************** *** 126,130 **** this.dailyTimes = dailyTimes; this.firstDate = firstDate; ! this.barInterval = barInterval; this.dateTimeForOverWritingQuotes = dateTimeForOverWritingQuotes; this.checkForMissingQuotes = checkForMissingQuotes; --- 128,133 ---- this.dailyTimes = dailyTimes; this.firstDate = firstDate; ! this.lastDate = lastDate; ! this.barIntervalInSeconds = barIntervalInSeconds; this.dateTimeForOverWritingQuotes = dateTimeForOverWritingQuotes; this.checkForMissingQuotes = checkForMissingQuotes; *************** *** 156,160 **** this.dateTimeForFirstBarOpenInNewYorkTimeZone = dateTimeForFirstBarOpenInNewYorkTimeZone; this.dateTimeForLastBarOpenInNewYorkTimeZone = dateTimeForLastBarOpenInNewYorkTimeZone; ! this.barInterval = barInterval; this.dateTimeForOverWritingQuotes = DateTime.MaxValue; this.checkForMissingQuotes = false; --- 159,163 ---- this.dateTimeForFirstBarOpenInNewYorkTimeZone = dateTimeForFirstBarOpenInNewYorkTimeZone; this.dateTimeForLastBarOpenInNewYorkTimeZone = dateTimeForLastBarOpenInNewYorkTimeZone; ! this.barIntervalInSeconds = barInterval; this.dateTimeForOverWritingQuotes = DateTime.MaxValue; this.checkForMissingQuotes = false; *************** *** 220,225 **** this.tickersToDownload , this.setBarsSelector_getDate( this.firstDate ) , ! this.setBarsSelector_getDate( DateTime.Now ) , ! this.barInterval , this.dailyTimes ) ); else --- 223,228 ---- this.tickersToDownload , this.setBarsSelector_getDate( this.firstDate ) , ! this.setBarsSelector_getDate( this.lastDate ) , ! this.barIntervalInSeconds , this.dailyTimes ) ); else *************** *** 232,236 **** this.setBarsSelector_getDate( this.firstDate ) , this.setBarsSelector_getDate( DateTime.Now ) , ! this.barInterval , this.dailyTimes ) ); } --- 235,239 ---- this.setBarsSelector_getDate( this.firstDate ) , this.setBarsSelector_getDate( DateTime.Now ) , ! this.barIntervalInSeconds , this.dailyTimes ) ); } *************** *** 242,246 **** this.dateTimeForFirstBarOpenInNewYorkTimeZone , this.dateTimeForLastBarOpenInNewYorkTimeZone , ! this.barInterval ); } private void setOHLCRequester() --- 245,249 ---- this.dateTimeForFirstBarOpenInNewYorkTimeZone , this.dateTimeForLastBarOpenInNewYorkTimeZone , ! this.barIntervalInSeconds ); } private void setOHLCRequester() |
|
From: Glauco S. <gla...@us...> - 2009-02-08 15:05:21
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/UserForms In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29936/Downloader/OpenTickDownloader/UserForms Modified Files: OTWebDownloader.cs Log Message: Last date is now supported for specific daily bars, also Index: OTWebDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/UserForms/OTWebDownloader.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** OTWebDownloader.cs 7 Feb 2009 17:06:18 -0000 1.9 --- OTWebDownloader.cs 8 Feb 2009 15:05:09 -0000 1.10 *************** *** 214,218 **** // dateTimePickerEndingDate // - this.dateTimePickerEndingDate.Enabled = false; this.dateTimePickerEndingDate.Location = new System.Drawing.Point(86, 75); this.dateTimePickerEndingDate.Name = "dateTimePickerEndingDate"; --- 214,217 ---- *************** *** 493,496 **** --- 492,496 ---- this.CheckedDailyTimes , this.dateTimePickerStartingDate.Value , + this.dateTimePickerEndingDate.Value , Convert.ToInt32( this.timeFrameInSeconds.Value ) , DateTime.MaxValue, *************** *** 804,808 **** this.checkBoxOverWrite.Enabled = true; this.radioButtonDownloadOnlyAfterMax.Enabled = true; ! this.dateTimePickerEndingDate.Enabled = false; } else --- 804,808 ---- this.checkBoxOverWrite.Enabled = true; this.radioButtonDownloadOnlyAfterMax.Enabled = true; ! // this.dateTimePickerEndingDate.Enabled = false; } else *************** *** 812,816 **** this.checkBoxOverWrite.Enabled = false; this.radioButtonDownloadOnlyAfterMax.Enabled = false; ! this.dateTimePickerEndingDate.Enabled = true; } } --- 812,816 ---- this.checkBoxOverWrite.Enabled = false; this.radioButtonDownloadOnlyAfterMax.Enabled = false; ! // this.dateTimePickerEndingDate.Enabled = true; } } |
|
From: Marco M. <mi...@us...> - 2009-02-07 17:06:24
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/UserForms In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29641/Downloader/OpenTickDownloader/UserForms Modified Files: OTWebDownloader.cs Log Message: Updated the Web Downloader form for Open Tick. Now the user can choose the consecutive mode. Index: OTWebDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/UserForms/OTWebDownloader.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OTWebDownloader.cs 7 Jan 2009 23:28:20 -0000 1.8 --- OTWebDownloader.cs 7 Feb 2009 17:06:18 -0000 1.9 *************** *** 52,57 **** private System.Windows.Forms.Label labelStartingDateTime; private System.Windows.Forms.DateTimePicker dateTimePickerStartingDate; ! private System.Windows.Forms.RadioButton radioButtonAllAvailableUntilNow; ! private System.Windows.Forms.GroupBox groupBoxWebDownloaderOptions; private System.Windows.Forms.RadioButton radioButtonDownloadOnlyAfterMax; private Thread downloadThread; --- 52,57 ---- private System.Windows.Forms.Label labelStartingDateTime; private System.Windows.Forms.DateTimePicker dateTimePickerStartingDate; ! private System.Windows.Forms.RadioButton radioButtonAllAvailableFromStartingDateToEndingDate; ! private System.Windows.Forms.GroupBox groupBoxDateOptions; private System.Windows.Forms.RadioButton radioButtonDownloadOnlyAfterMax; private Thread downloadThread; *************** *** 97,101 **** { this.dateTimePickerStartingDate.Value = QuantProject.ADT.ConstantsProvider.InitialDateTimeForDownload; ! this.radioButtonAllAvailableUntilNow.Checked = true; this.radioButtonDownloadOnlyAfterMax.Checked = false; this.dataGrid1.ContextMenu = new TickerViewerMenu(this); --- 97,101 ---- { this.dateTimePickerStartingDate.Value = QuantProject.ADT.ConstantsProvider.InitialDateTimeForDownload; ! this.radioButtonAllAvailableFromStartingDateToEndingDate.Checked = true; this.radioButtonDownloadOnlyAfterMax.Checked = false; this.dataGrid1.ContextMenu = new TickerViewerMenu(this); *************** *** 123,132 **** this.dateTimePickerStartingDate = new System.Windows.Forms.DateTimePicker(); this.labelStartingDateTime = new System.Windows.Forms.Label(); ! this.radioButtonAllAvailableUntilNow = new System.Windows.Forms.RadioButton(); ! this.groupBoxWebDownloaderOptions = new System.Windows.Forms.GroupBox(); this.radioButtonDownloadOnlyAfterMax = new System.Windows.Forms.RadioButton(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.label1 = new System.Windows.Forms.Label(); - this.dateTimeOverwriteQuotesBefore = new System.Windows.Forms.DateTimePicker(); this.timeFrameInSeconds = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); --- 123,132 ---- this.dateTimePickerStartingDate = new System.Windows.Forms.DateTimePicker(); this.labelStartingDateTime = new System.Windows.Forms.Label(); ! this.radioButtonAllAvailableFromStartingDateToEndingDate = new System.Windows.Forms.RadioButton(); ! this.groupBoxDateOptions = new System.Windows.Forms.GroupBox(); ! this.dateTimePickerEndingDate = new System.Windows.Forms.DateTimePicker(); ! this.labelEndingDateTime = new System.Windows.Forms.Label(); this.radioButtonDownloadOnlyAfterMax = new System.Windows.Forms.RadioButton(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.timeFrameInSeconds = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); *************** *** 142,149 **** this.signallingLabel = new System.Windows.Forms.Label(); this.checkedListOfDailyTimes = new System.Windows.Forms.CheckedListBox(); ! this.button1 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); ! this.groupBoxWebDownloaderOptions.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.timeFrameInSeconds)).BeginInit(); this.SuspendLayout(); // --- 142,152 ---- this.signallingLabel = new System.Windows.Forms.Label(); this.checkedListOfDailyTimes = new System.Windows.Forms.CheckedListBox(); ! this.groupBoxTimeOptions = new System.Windows.Forms.GroupBox(); ! this.radioButtonConsecutiveDailyTimes = new System.Windows.Forms.RadioButton(); ! this.radioButtonChooseSingleDailyTimes = new System.Windows.Forms.RadioButton(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); ! this.groupBoxDateOptions.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.timeFrameInSeconds)).BeginInit(); + this.groupBoxTimeOptions.SuspendLayout(); this.SuspendLayout(); // *************** *** 156,160 **** this.dataGrid1.Name = "dataGrid1"; this.dataGrid1.ReadOnly = true; ! this.dataGrid1.Size = new System.Drawing.Size(352, 469); this.dataGrid1.TabIndex = 1; // --- 159,163 ---- this.dataGrid1.Name = "dataGrid1"; this.dataGrid1.ReadOnly = true; ! this.dataGrid1.Size = new System.Drawing.Size(352, 474); this.dataGrid1.TabIndex = 1; // *************** *** 184,213 **** this.labelStartingDateTime.Text = "Starting date"; // ! // radioButtonAllAvailableUntilNow // ! this.radioButtonAllAvailableUntilNow.Checked = true; ! this.radioButtonAllAvailableUntilNow.Location = new System.Drawing.Point(6, 19); ! this.radioButtonAllAvailableUntilNow.Name = "radioButtonAllAvailableUntilNow"; ! this.radioButtonAllAvailableUntilNow.Size = new System.Drawing.Size(272, 24); ! this.radioButtonAllAvailableUntilNow.TabIndex = 10; ! this.radioButtonAllAvailableUntilNow.TabStop = true; ! this.radioButtonAllAvailableUntilNow.Text = "All available quotes until now, since starting date"; // ! // groupBoxWebDownloaderOptions // ! this.groupBoxWebDownloaderOptions.Controls.Add(this.radioButtonDownloadOnlyAfterMax); ! this.groupBoxWebDownloaderOptions.Controls.Add(this.radioButtonAllAvailableUntilNow); ! this.groupBoxWebDownloaderOptions.Controls.Add(this.dateTimePickerStartingDate); ! this.groupBoxWebDownloaderOptions.Controls.Add(this.labelStartingDateTime); ! this.groupBoxWebDownloaderOptions.Location = new System.Drawing.Point(12, 122); ! this.groupBoxWebDownloaderOptions.Name = "groupBoxWebDownloaderOptions"; ! this.groupBoxWebDownloaderOptions.Size = new System.Drawing.Size(336, 141); ! this.groupBoxWebDownloaderOptions.TabIndex = 13; ! this.groupBoxWebDownloaderOptions.TabStop = false; ! this.groupBoxWebDownloaderOptions.Text = "Web Downloader options (source: OpenTick)"; // // radioButtonDownloadOnlyAfterMax // ! this.radioButtonDownloadOnlyAfterMax.Location = new System.Drawing.Point(6, 79); this.radioButtonDownloadOnlyAfterMax.Name = "radioButtonDownloadOnlyAfterMax"; this.radioButtonDownloadOnlyAfterMax.Size = new System.Drawing.Size(307, 55); --- 187,235 ---- this.labelStartingDateTime.Text = "Starting date"; // ! // radioButtonAllAvailableFromStartingDateToEndingDate // ! this.radioButtonAllAvailableFromStartingDateToEndingDate.Checked = true; ! this.radioButtonAllAvailableFromStartingDateToEndingDate.Location = new System.Drawing.Point(6, 19); ! this.radioButtonAllAvailableFromStartingDateToEndingDate.Name = "radioButtonAllAvailableFromStartingDateToEndingDate"; ! this.radioButtonAllAvailableFromStartingDateToEndingDate.Size = new System.Drawing.Size(315, 24); ! this.radioButtonAllAvailableFromStartingDateToEndingDate.TabIndex = 10; ! this.radioButtonAllAvailableFromStartingDateToEndingDate.TabStop = true; ! this.radioButtonAllAvailableFromStartingDateToEndingDate.Text = "All available quotes from starting to ending date"; // ! // groupBoxDateOptions // ! this.groupBoxDateOptions.Controls.Add(this.dateTimePickerEndingDate); ! this.groupBoxDateOptions.Controls.Add(this.labelEndingDateTime); ! this.groupBoxDateOptions.Controls.Add(this.radioButtonDownloadOnlyAfterMax); ! this.groupBoxDateOptions.Controls.Add(this.radioButtonAllAvailableFromStartingDateToEndingDate); ! this.groupBoxDateOptions.Controls.Add(this.dateTimePickerStartingDate); ! this.groupBoxDateOptions.Controls.Add(this.labelStartingDateTime); ! this.groupBoxDateOptions.Location = new System.Drawing.Point(12, 173); ! this.groupBoxDateOptions.Name = "groupBoxDateOptions"; ! this.groupBoxDateOptions.Size = new System.Drawing.Size(336, 173); ! this.groupBoxDateOptions.TabIndex = 13; ! this.groupBoxDateOptions.TabStop = false; ! this.groupBoxDateOptions.Text = "Date Options"; ! // ! // dateTimePickerEndingDate ! // ! this.dateTimePickerEndingDate.Enabled = false; ! this.dateTimePickerEndingDate.Location = new System.Drawing.Point(86, 75); ! this.dateTimePickerEndingDate.Name = "dateTimePickerEndingDate"; ! this.dateTimePickerEndingDate.Size = new System.Drawing.Size(231, 20); ! this.dateTimePickerEndingDate.TabIndex = 11; ! this.dateTimePickerEndingDate.Value = new System.DateTime(2009, 2, 6, 0, 0, 0, 0); ! // ! // labelEndingDateTime ! // ! this.labelEndingDateTime.Location = new System.Drawing.Point(8, 75); ! this.labelEndingDateTime.Name = "labelEndingDateTime"; ! this.labelEndingDateTime.Size = new System.Drawing.Size(80, 23); ! this.labelEndingDateTime.TabIndex = 12; ! this.labelEndingDateTime.Text = "Ending date"; // // radioButtonDownloadOnlyAfterMax // ! this.radioButtonDownloadOnlyAfterMax.Location = new System.Drawing.Point(6, 101); this.radioButtonDownloadOnlyAfterMax.Name = "radioButtonDownloadOnlyAfterMax"; this.radioButtonDownloadOnlyAfterMax.Size = new System.Drawing.Size(307, 55); *************** *** 216,235 **** "available in the local DB, quotes are downloaded from starting date)"; // - // label1 - // - this.label1.Location = new System.Drawing.Point(10, 269); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(80, 41); - this.label1.TabIndex = 16; - this.label1.Text = "OverWrite quotes before"; - // - // dateTimeOverwriteQuotesBefore - // - this.dateTimeOverwriteQuotesBefore.Location = new System.Drawing.Point(98, 269); - this.dateTimeOverwriteQuotesBefore.Name = "dateTimeOverwriteQuotesBefore"; - this.dateTimeOverwriteQuotesBefore.Size = new System.Drawing.Size(229, 20); - this.dateTimeOverwriteQuotesBefore.TabIndex = 15; - this.dateTimeOverwriteQuotesBefore.Value = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); - // // timeFrameInSeconds // --- 238,241 ---- *************** *** 239,243 **** 0, 0}); ! this.timeFrameInSeconds.Location = new System.Drawing.Point(299, 55); this.timeFrameInSeconds.Maximum = new decimal(new int[] { 3600, --- 245,249 ---- 0, 0}); ! this.timeFrameInSeconds.Location = new System.Drawing.Point(114, 28); this.timeFrameInSeconds.Maximum = new decimal(new int[] { 3600, *************** *** 261,265 **** // label2 // ! this.label2.Location = new System.Drawing.Point(191, 57); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(102, 20); --- 267,271 ---- // label2 // ! this.label2.Location = new System.Drawing.Point(12, 30); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(102, 20); *************** *** 284,288 **** // label9 // ! this.label9.Location = new System.Drawing.Point(169, 382); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(58, 23); --- 290,294 ---- // label9 // ! this.label9.Location = new System.Drawing.Point(189, 380); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(58, 23); *************** *** 292,296 **** // txtOpenTickPassword // ! this.txtOpenTickPassword.Location = new System.Drawing.Point(247, 382); this.txtOpenTickPassword.Name = "txtOpenTickPassword"; this.txtOpenTickPassword.Size = new System.Drawing.Size(78, 20); --- 298,302 ---- // txtOpenTickPassword // ! this.txtOpenTickPassword.Location = new System.Drawing.Point(270, 380); this.txtOpenTickPassword.Name = "txtOpenTickPassword"; this.txtOpenTickPassword.Size = new System.Drawing.Size(78, 20); *************** *** 300,306 **** // checkBoxCheckingForMissingQuotes // ! this.checkBoxCheckingForMissingQuotes.Location = new System.Drawing.Point(12, 352); this.checkBoxCheckingForMissingQuotes.Name = "checkBoxCheckingForMissingQuotes"; ! this.checkBoxCheckingForMissingQuotes.Size = new System.Drawing.Size(315, 24); this.checkBoxCheckingForMissingQuotes.TabIndex = 32; this.checkBoxCheckingForMissingQuotes.Text = "Check for missing quotes"; --- 306,312 ---- // checkBoxCheckingForMissingQuotes // ! this.checkBoxCheckingForMissingQuotes.Location = new System.Drawing.Point(18, 352); this.checkBoxCheckingForMissingQuotes.Name = "checkBoxCheckingForMissingQuotes"; ! this.checkBoxCheckingForMissingQuotes.Size = new System.Drawing.Size(161, 24); this.checkBoxCheckingForMissingQuotes.TabIndex = 32; this.checkBoxCheckingForMissingQuotes.Text = "Check for missing quotes"; *************** *** 309,322 **** // checkBoxOverWrite // ! this.checkBoxOverWrite.Location = new System.Drawing.Point(12, 308); this.checkBoxOverWrite.Name = "checkBoxOverWrite"; ! this.checkBoxOverWrite.Size = new System.Drawing.Size(246, 38); this.checkBoxOverWrite.TabIndex = 33; this.checkBoxOverWrite.Text = "OverWrite all quotes, also after the given date"; this.checkBoxOverWrite.UseVisualStyleBackColor = true; // // label10 // ! this.label10.Location = new System.Drawing.Point(12, 0); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(131, 23); --- 315,329 ---- // checkBoxOverWrite // ! this.checkBoxOverWrite.Location = new System.Drawing.Point(352, 262); this.checkBoxOverWrite.Name = "checkBoxOverWrite"; ! this.checkBoxOverWrite.Size = new System.Drawing.Size(24, 38); this.checkBoxOverWrite.TabIndex = 33; this.checkBoxOverWrite.Text = "OverWrite all quotes, also after the given date"; this.checkBoxOverWrite.UseVisualStyleBackColor = true; + this.checkBoxOverWrite.Visible = false; // // label10 // ! this.label10.Location = new System.Drawing.Point(175, 2); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(131, 23); *************** *** 350,374 **** // this.checkedListOfDailyTimes.FormattingEnabled = true; ! this.checkedListOfDailyTimes.Location = new System.Drawing.Point(12, 22); this.checkedListOfDailyTimes.Name = "checkedListOfDailyTimes"; ! this.checkedListOfDailyTimes.Size = new System.Drawing.Size(173, 94); this.checkedListOfDailyTimes.TabIndex = 39; // ! // button1 // ! this.button1.Location = new System.Drawing.Point(227, 12); ! this.button1.Name = "button1"; ! this.button1.Size = new System.Drawing.Size(66, 23); ! this.button1.TabIndex = 40; ! this.button1.Text = "button1"; ! this.button1.UseVisualStyleBackColor = true; ! this.button1.Visible = false; ! this.button1.Click += new System.EventHandler(this.Button1Click); // // OTWebDownloader // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(734, 469); ! this.Controls.Add(this.button1); this.Controls.Add(this.checkedListOfDailyTimes); this.Controls.Add(this.signallingLabel); --- 357,402 ---- // this.checkedListOfDailyTimes.FormattingEnabled = true; ! this.checkedListOfDailyTimes.Location = new System.Drawing.Point(175, 28); this.checkedListOfDailyTimes.Name = "checkedListOfDailyTimes"; ! this.checkedListOfDailyTimes.Size = new System.Drawing.Size(173, 139); this.checkedListOfDailyTimes.TabIndex = 39; // ! // groupBoxTimeOptions // ! this.groupBoxTimeOptions.Controls.Add(this.radioButtonConsecutiveDailyTimes); ! this.groupBoxTimeOptions.Controls.Add(this.radioButtonChooseSingleDailyTimes); ! this.groupBoxTimeOptions.Location = new System.Drawing.Point(12, 56); ! this.groupBoxTimeOptions.Name = "groupBoxTimeOptions"; ! this.groupBoxTimeOptions.Size = new System.Drawing.Size(151, 111); ! this.groupBoxTimeOptions.TabIndex = 40; ! this.groupBoxTimeOptions.TabStop = false; ! this.groupBoxTimeOptions.Text = "Time Options"; ! // ! // radioButtonConsecutiveDailyTimes ! // ! this.radioButtonConsecutiveDailyTimes.Location = new System.Drawing.Point(6, 58); ! this.radioButtonConsecutiveDailyTimes.Name = "radioButtonConsecutiveDailyTimes"; ! this.radioButtonConsecutiveDailyTimes.Size = new System.Drawing.Size(139, 49); ! this.radioButtonConsecutiveDailyTimes.TabIndex = 1; ! this.radioButtonConsecutiveDailyTimes.Text = "all consecutive times, from starting to ending date"; ! this.radioButtonConsecutiveDailyTimes.UseVisualStyleBackColor = true; ! // ! // radioButtonChooseSingleDailyTimes ! // ! this.radioButtonChooseSingleDailyTimes.Checked = true; ! this.radioButtonChooseSingleDailyTimes.Location = new System.Drawing.Point(6, 28); ! this.radioButtonChooseSingleDailyTimes.Name = "radioButtonChooseSingleDailyTimes"; ! this.radioButtonChooseSingleDailyTimes.Size = new System.Drawing.Size(139, 24); ! this.radioButtonChooseSingleDailyTimes.TabIndex = 0; ! this.radioButtonChooseSingleDailyTimes.TabStop = true; ! this.radioButtonChooseSingleDailyTimes.Text = "choose single times"; ! this.radioButtonChooseSingleDailyTimes.UseVisualStyleBackColor = true; ! this.radioButtonChooseSingleDailyTimes.CheckedChanged += new System.EventHandler(this.RadioButtonChooseSingleDailyTimesCheckedChanged); // // OTWebDownloader // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(734, 474); ! this.Controls.Add(this.groupBoxTimeOptions); this.Controls.Add(this.checkedListOfDailyTimes); this.Controls.Add(this.signallingLabel); *************** *** 384,403 **** this.Controls.Add(this.label2); this.Controls.Add(this.timeFrameInSeconds); ! this.Controls.Add(this.label1); ! this.Controls.Add(this.dateTimeOverwriteQuotesBefore); ! this.Controls.Add(this.groupBoxWebDownloaderOptions); this.Controls.Add(this.buttonDownloadQuotesOfSelectedTickers); this.Controls.Add(this.dataGrid1); this.Name = "OTWebDownloader"; ! this.Text = "OT Web downloader"; this.Load += new System.EventHandler(this.otWebDownloaderLoad); this.Paint += new System.Windows.Forms.PaintEventHandler(this.OTWebDownloaderPaint); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit(); ! this.groupBoxWebDownloaderOptions.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.timeFrameInSeconds)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } ! private System.Windows.Forms.Button button1; private System.Windows.Forms.CheckedListBox checkedListOfDailyTimes; private System.Windows.Forms.Label signallingLabel; --- 412,434 ---- this.Controls.Add(this.label2); this.Controls.Add(this.timeFrameInSeconds); ! this.Controls.Add(this.groupBoxDateOptions); this.Controls.Add(this.buttonDownloadQuotesOfSelectedTickers); this.Controls.Add(this.dataGrid1); this.Name = "OTWebDownloader"; ! this.Text = "Web downloader (source: OpenTick)"; this.Load += new System.EventHandler(this.otWebDownloaderLoad); this.Paint += new System.Windows.Forms.PaintEventHandler(this.OTWebDownloaderPaint); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit(); ! this.groupBoxDateOptions.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.timeFrameInSeconds)).EndInit(); + this.groupBoxTimeOptions.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); } ! private System.Windows.Forms.GroupBox groupBoxTimeOptions; ! private System.Windows.Forms.RadioButton radioButtonChooseSingleDailyTimes; ! private System.Windows.Forms.RadioButton radioButtonConsecutiveDailyTimes; ! private System.Windows.Forms.Label labelEndingDateTime; ! private System.Windows.Forms.DateTimePicker dateTimePickerEndingDate; private System.Windows.Forms.CheckedListBox checkedListOfDailyTimes; private System.Windows.Forms.Label signallingLabel; *************** *** 412,418 **** private System.Windows.Forms.TextBox txtOpenTickUser; private System.Windows.Forms.NumericUpDown timeFrameInSeconds; - private System.Windows.Forms.DateTimePicker dateTimeOverwriteQuotesBefore; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; #endregion --- 443,447 ---- *************** *** 453,473 **** #endregion ! private void buttonDownloadQuotesOfSelectedTickers_Click(object sender, System.EventArgs e) { ! try{ ! if(this.CheckedDailyTimes.Count == 0) ! throw new Exception("Check at least one daily time!"); ! OTTickerDownloader tickerDownloader = ! new OTTickerDownloader( this.TickersToDownload, this.CheckedDailyTimes , this.dateTimePickerStartingDate.Value , - // this.StartingNewYorkDateTime, - // this.CheckedDailyTimes[0].Hour , - // this.CheckedDailyTimes[0].Minute , - // this.CheckedDailyTimes[0].Second , Convert.ToInt32( this.timeFrameInSeconds.Value ) , ! // 1 , ! this.dateTimeOverwriteQuotesBefore.Value, this.checkBoxCheckingForMissingQuotes.Checked, this.checkBoxOverWrite.Checked, --- 482,498 ---- #endregion ! private OTTickerDownloader buttonDownloadQuotesOfSelectedTickers_Click_getTickerDownloader() { ! OTTickerDownloader tickerDownloader; ! if ( this.radioButtonChooseSingleDailyTimes.Checked ) ! { ! if(this.CheckedDailyTimes.Count == 0) ! throw new Exception("Check at least one daily time!"); ! tickerDownloader = new OTTickerDownloader( this.TickersToDownload, this.CheckedDailyTimes , this.dateTimePickerStartingDate.Value , Convert.ToInt32( this.timeFrameInSeconds.Value ) , ! DateTime.MaxValue, this.checkBoxCheckingForMissingQuotes.Checked, this.checkBoxOverWrite.Checked, *************** *** 475,478 **** --- 500,525 ---- this.txtOpenTickUser.Text, this.txtOpenTickPassword.Text); + } + else//option consecutive times has been chosen + { + if( this.dateTimePickerEndingDate.Value.CompareTo(this.dateTimePickerStartingDate.Value)<0 ) + throw new Exception("Ending date can't precede starting date!"); + tickerDownloader = new OTTickerDownloader( + this.TickersToDownload, + this.dateTimePickerStartingDate.Value, + this.dateTimePickerEndingDate.Value, + Convert.ToInt32( this.timeFrameInSeconds.Value ) , + this.txtOpenTickUser.Text, + this.txtOpenTickPassword.Text); + } + return tickerDownloader; + } + + private void buttonDownloadQuotesOfSelectedTickers_Click(object sender, System.EventArgs e) + { + try{ + OTTickerDownloader tickerDownloader = + this.buttonDownloadQuotesOfSelectedTickers_Click_getTickerDownloader(); + tickerDownloader.DownloadingStarted += new DownloadingStartedEventHandler(this.setStartingTime_atDownloadedStarted); *************** *** 671,674 **** --- 718,722 ---- this.otWebDownloaderLoad_fillDataGridWithTickersToBeDownloaded(); this.otWebDownloaderLoad_populateCheckedListOfDailyTimes(); + this.dateTimePickerEndingDate.Value = DateTime.Now; } *************** *** 748,755 **** } ! void Button1Click(object sender, EventArgs e) { ! List<Time> listDT = ! this.CheckedDailyTimes; } } --- 796,817 ---- } ! void RadioButtonChooseSingleDailyTimesCheckedChanged(object sender, EventArgs e) { ! if ( this.radioButtonChooseSingleDailyTimes.Checked ) ! { ! this.checkedListOfDailyTimes.Enabled = true; ! this.checkBoxCheckingForMissingQuotes.Enabled = true; ! this.checkBoxOverWrite.Enabled = true; ! this.radioButtonDownloadOnlyAfterMax.Enabled = true; ! this.dateTimePickerEndingDate.Enabled = false; ! } ! else ! { ! this.checkedListOfDailyTimes.Enabled = false; ! this.checkBoxCheckingForMissingQuotes.Enabled = false; ! this.checkBoxOverWrite.Enabled = false; ! this.radioButtonDownloadOnlyAfterMax.Enabled = false; ! this.dateTimePickerEndingDate.Enabled = true; ! } } } |
|
From: Marco M. <mi...@us...> - 2009-02-07 16:55:36
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27408/Downloader/OpenTickDownloader Modified Files: OTTickerDownloader.cs Log Message: Just completed a remark to the code. Index: OTTickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/OTTickerDownloader.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** OTTickerDownloader.cs 4 Feb 2009 20:05:22 -0000 1.9 --- OTTickerDownloader.cs 7 Feb 2009 16:55:31 -0000 1.10 *************** *** 95,99 **** "starting Date for download!"); if( checkForMissingQuotes && downloadOnlySuccessiveQuotesToTheLastQuoteInDatabase ) ! //the two options have to be different in value or both false throw new Exception("Downloading only quotes successive to the last quote in the DB " + "implies that missing quotes will not be checked" ); --- 95,99 ---- "starting Date for download!"); if( checkForMissingQuotes && downloadOnlySuccessiveQuotesToTheLastQuoteInDatabase ) ! //the two options have to be different in value or both false. They can't be both true throw new Exception("Downloading only quotes successive to the last quote in the DB " + "implies that missing quotes will not be checked" ); |
|
From: Marco M. <mi...@us...> - 2009-02-05 23:17:25
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3450/b2_DataAccess/Tables Modified Files: Bars.cs Log Message: Fixed bugs in GetOpen and GetClose methods Index: Bars.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Bars.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Bars.cs 14 Jan 2009 23:36:27 -0000 1.7 --- Bars.cs 5 Feb 2009 22:11:54 -0000 1.8 *************** *** 130,134 **** /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bars</param> /// <returns></returns> ! public static float GetClose( string ticker, DateTime dateTime, int intervalFrameInSeconds ) { DataTable dataTable = SqlExecutor.GetDataTable( --- 130,134 ---- /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bars</param> /// <returns></returns> ! public static double GetClose( string ticker, DateTime dateTime, int intervalFrameInSeconds ) { DataTable dataTable = SqlExecutor.GetDataTable( *************** *** 136,141 **** "where " + Bars.TickerFieldName + "='" + ticker + "' and " + Bars.IntervalFrameInSeconds + "='" + intervalFrameInSeconds + "' " + ! "and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateConstant(dateTime) ); ! return (float)dataTable.Rows[0][0]; } /// <summary> --- 136,141 ---- "where " + Bars.TickerFieldName + "='" + ticker + "' and " + Bars.IntervalFrameInSeconds + "='" + intervalFrameInSeconds + "' " + ! "and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateTimeConstant(dateTime) ); ! return (double)dataTable.Rows[0][0]; } /// <summary> *************** *** 146,150 **** /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bars</param> /// <returns></returns> ! public static float GetOpen( string ticker, DateTime dateTime, int intervalFrameInSeconds ) { DataTable dataTable = SqlExecutor.GetDataTable( --- 146,150 ---- /// <param name="intervalFrameInSeconds">interval frame in seconds for the ticker's bars</param> /// <returns></returns> ! public static double GetOpen( string ticker, DateTime dateTime, int intervalFrameInSeconds ) { DataTable dataTable = SqlExecutor.GetDataTable( *************** *** 152,157 **** "where " + Bars.TickerFieldName + "='" + ticker + "' and " + Bars.IntervalFrameInSeconds + "='" + intervalFrameInSeconds + "' " + ! "and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateConstant(dateTime) ); ! return (float)dataTable.Rows[0][0]; } --- 152,157 ---- "where " + Bars.TickerFieldName + "='" + ticker + "' and " + Bars.IntervalFrameInSeconds + "='" + intervalFrameInSeconds + "' " + ! "and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateTimeConstant(dateTime) ); ! return (double)dataTable.Rows[0][0]; } |
|
From: Marco M. <mi...@us...> - 2009-02-05 23:17:20
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4077/b7_Scripts Modified Files: SimpleScriptsContainer.cs Log Message: Added code for importing csv files from open tick into the database (it is just a temporary code) Index: SimpleScriptsContainer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleScriptsContainer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleScriptsContainer.cs 2 Jul 2006 19:15:24 -0000 1.1 --- SimpleScriptsContainer.cs 5 Feb 2009 22:17:08 -0000 1.2 *************** *** 23,26 **** --- 23,30 ---- using System; using System.Data; + using System.Windows.Forms; + using System.IO; + + using QuantProject.DataAccess.Tables; using QuantProject.Data.Selectors; using QuantProject.Data.Selectors.ByLinearIndipendence; *************** *** 33,37 **** public class SimpleScriptsContainer { ! public static void Execute() { QuantProject.Data.Selectors.ByLinearIndipendence.SelectorByMaxLinearIndipendence selector = --- 37,43 ---- public class SimpleScriptsContainer { ! #region Execute ! ! public static void Execute() { QuantProject.Data.Selectors.ByLinearIndipendence.SelectorByMaxLinearIndipendence selector = *************** *** 45,52 **** 20,false); DataTable correlatedTickers = selector2.GetTableOfSelectedTickers(); ! } ! } } --- 51,188 ---- 20,false); DataTable correlatedTickers = selector2.GetTableOfSelectedTickers(); + } + #endregion Execute + + #region ImportCsvFilesIntoDatabase + + static int numberOfCsvFilesImported = 0; + static DateTime beginOfImportSession; + + private static void importFromCsvFiles_importFile_openFileAndWriteToDb_addBar(string ticker, + string exchange, long intervalFrameInSeconds, string lineRepresentingBar) + { + + //2006-01-03;09:30:00;33.400000;33.400000;33.380000;33.380000;232600 + string[] fields = lineRepresentingBar.Split(';'); + string[] subStringsForDate = fields[0].Split('-'); + string[] subStringsForTime = fields[1].Split(':'); + DateTime dateTimeForOpen = new DateTime( Convert.ToInt32(subStringsForDate[0]), + Convert.ToInt32(subStringsForDate[1]), + Convert.ToInt32(subStringsForDate[2]), + Convert.ToInt32(subStringsForTime[0]), + Convert.ToInt32(subStringsForTime[1]), + Convert.ToInt32(subStringsForTime[2]) ); + double open, high, low, close, volume; + open = Double.Parse(fields[2]); + high = Double.Parse(fields[3]); + low = Double.Parse(fields[4]); + close = Double.Parse(fields[5]); + volume = Double.Parse(fields[6]); + + Bars.AddBar(ticker, exchange, dateTimeForOpen, intervalFrameInSeconds, open, high, low, close, volume); + } + + private static void writeToLogFile(string ticker, int numOfRowsAdded, + DateTime dateTimeOfFirstRowAdded ) + { + string fileNamePathForLog; + string applicationDir = Application.ExecutablePath.Substring(0,Application.ExecutablePath.LastIndexOf('\\')); + fileNamePathForLog = applicationDir + "\\" + "SessionImportLog" + + beginOfImportSession.Year.ToString() + "_" + + beginOfImportSession.Month.ToString() + "_" + + beginOfImportSession.Day.ToString() + "_" + + beginOfImportSession.Hour.ToString() + "_" + + beginOfImportSession.Minute.ToString() + "_" + + beginOfImportSession.Second.ToString() + "_" + + "Requested_" + numberOfCsvFilesImported.ToString() + + "_files.txt"; + StreamWriter writer; + if (File.Exists(fileNamePathForLog)) + writer = File.AppendText(fileNamePathForLog); + else + { + writer = File.CreateText(fileNamePathForLog); + writer.WriteLine("ticker;rows added;date time of 1° row added;date time of last row added;minutes elapsed;seconds elapsed;rows added per second"); + } + TimeSpan timeSpan = DateTime.Now.Subtract(dateTimeOfFirstRowAdded); + int rowsAddedPerSecond = 0; + int totalOfSeconds = timeSpan.Minutes*60+timeSpan.Seconds; + if ( totalOfSeconds != 0 ) + rowsAddedPerSecond = numOfRowsAdded / totalOfSeconds; + string lineToWrite = ticker + ";" + numOfRowsAdded.ToString() + ";" + + dateTimeOfFirstRowAdded.ToLongTimeString() + ";" + + DateTime.Now.ToLongTimeString() + ";" + + timeSpan.Minutes + ";" + timeSpan.Seconds + ";" + + rowsAddedPerSecond.ToString(); + + writer.WriteLine(lineToWrite); + writer.Close(); + } + + private static void importFromCsvFiles_importFile_openFileAndWriteToDb(string filePath, string ticker, + string exchange, long intervalFrameInSeconds) + { + StreamReader csvReader = new StreamReader(filePath); + string line; + int numOfRowsAdded = 0; + if( csvReader == null ) + return; + line = csvReader.ReadLine();//first line contains column headers + line = csvReader.ReadLine(); + DateTime dateTimeOfFirstRowAdded = DateTime.Now; + while ( line != null ) + { + try{ + numOfRowsAdded++; + importFromCsvFiles_importFile_openFileAndWriteToDb_addBar(ticker, exchange, intervalFrameInSeconds, + line); + + } + catch(Exception ex){ + string s = ex.ToString(); + numOfRowsAdded--; + } + line = csvReader.ReadLine(); + } + csvReader.Close(); + writeToLogFile(ticker, numOfRowsAdded, dateTimeOfFirstRowAdded); + } ! private static void importFromCsvFiles_importFile(string filePath) ! { ! //A_1_N_20060101000000_20090101230000.csv ! int previousIndexBeforeFileName = filePath.LastIndexOf('\\'); ! string fileName = filePath.Substring(previousIndexBeforeFileName + 1); ! int posOfFirstSep = fileName.IndexOf('_'); ! int posOfSecondSep = fileName.IndexOf('_', posOfFirstSep + 1); ! int posOfThirdSep = fileName.IndexOf('_', posOfSecondSep + 1); ! string ticker = fileName.Substring(0, posOfFirstSep); ! long intervalFrameInMinutes = Convert.ToInt64( ! fileName.Substring(posOfFirstSep + 1, posOfSecondSep - posOfFirstSep - 1) ); ! string exchange = ! fileName.Substring(posOfSecondSep + 1, 1); ! importFromCsvFiles_importFile_openFileAndWriteToDb(filePath, ticker, ! exchange, intervalFrameInMinutes * 60); } ! ! public static void ImportFromCsvFiles() ! { ! OpenFileDialog openFileDialog = new OpenFileDialog(); ! openFileDialog.Title = "Select csv files to import in db"; ! openFileDialog.Multiselect = true; ! openFileDialog.CheckFileExists = true; ! openFileDialog.Filter = "csv files|*.csv"; ! openFileDialog.ShowDialog(); ! string[] files = openFileDialog.FileNames; ! if( files!= null) ! { ! numberOfCsvFilesImported = files.Length; ! beginOfImportSession = DateTime.Now; ! for ( int i = 0; i < files.Length; i++ ) ! importFromCsvFiles_importFile( files[i] ); ! } ! } ! ! #endregion ImportCsvFilesIntoDatabase } } |
|
From: Marco M. <mi...@us...> - 2009-02-05 23:17:01
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Bars/Caching In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3398/b3_Data/DataProviders/Bars/Caching Added Files: SimpleBarCache.cs Log Message: Added SimpleBarCache: it implements IBarCache without creating a real cache (it just access the database it times a market value is requested) --- NEW FILE: SimpleBarCache.cs --- /* QuantProject - Quantitative Finance Library SimpleBarCache.cs Copyright (C) 2009 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; namespace QuantProject.Data.DataProviders.Bars.Caching { /// <summary> /// It isn't really a cache: it just access to database /// </summary> public class SimpleBarCache : IBarCache { private int intervalFrameInSeconds; public SimpleBarCache(int intervalFrameInSeconds) { this.intervalFrameInSeconds = intervalFrameInSeconds; } /// <summary> /// returns the market value for the given ticker, for the bar /// that opens at the given dateTime /// </summary> /// <param name="ticker"></param> /// <param name="dateTime"></param> /// <returns></returns> public double GetMarketValue( string ticker, DateTime dateTime ) { double returnValue = double.MinValue; try { returnValue = QuantProject.DataAccess.Tables.Bars.GetOpen( ticker , dateTime , this.intervalFrameInSeconds ); } catch( Exception ex ) { string message = ex.Message; // used to avoid warning throw new MissingBarException( ticker , dateTime , this.intervalFrameInSeconds); } return returnValue; } public bool WasExchanged( string ticker , DateTime dateTime ) { double marketValue = double.MinValue; try { marketValue = this.GetMarketValue( ticker , dateTime ); } catch ( MissingBarException missingBarException ) { string doNothing = missingBarException.Message; doNothing += ""; } return (marketValue != Double.MinValue); } } } |
|
From: Marco M. <mi...@us...> - 2009-02-05 23:16:58
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3398/b3_Data Modified Files: Data_SD.csproj Log Message: Added SimpleBarCache: it implements IBarCache without creating a real cache (it just access the database it times a market value is requested) Index: Data_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Data_SD.csproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Data_SD.csproj 14 Nov 2008 16:01:23 -0000 1.6 --- Data_SD.csproj 5 Feb 2009 22:11:16 -0000 1.7 *************** *** 49,52 **** --- 49,53 ---- <Compile Include="DataProviders\Bars\Caching\DailyBarCache.cs" /> <Compile Include="DataProviders\Bars\Caching\IBarCache.cs" /> + <Compile Include="DataProviders\Bars\Caching\SimpleBarCache.cs" /> <Compile Include="DataProviders\Bars\HistoricalBarProvider.cs" /> <Compile Include="DataProviders\Bars\MissingBarException.cs" /> |
|
From: Marco M. <mi...@us...> - 2009-02-05 23:16:53
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3756/b2_DataAccess Modified Files: SqlExecutor.cs Log Message: The Timeout for the SelectCommand the dbDataAdapter has been changed to 300 seconds. Index: SqlExecutor.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/SqlExecutor.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SqlExecutor.cs 30 Dec 2008 00:14:52 -0000 1.4 --- SqlExecutor.cs 5 Feb 2009 22:14:14 -0000 1.5 *************** *** 22,26 **** DbDataAdapter dbDataAdapter = DbDataAdapterProvider.GetDbDataAdapter( SqlQuery ); ! dbDataAdapter.Fill( dataTable ); return dataTable; } --- 22,37 ---- DbDataAdapter dbDataAdapter = DbDataAdapterProvider.GetDbDataAdapter( SqlQuery ); ! dbDataAdapter.SelectCommand.CommandTimeout = 300; ! // try{ ! dbDataAdapter.Fill( dataTable ); ! // } ! // catch(Exception ex){ ! // string s = ex.ToString(); ! // ConnectionProvider.DbConnection.Close(); ! // //ConnectionProvider.DbConnection.ConnectionTimeout = 300; ! // ConnectionProvider.DbConnection.Open(); ! // dbDataAdapter.Fill( dataTable ); ! // } ! return dataTable; } |
|
From: Marco M. <mi...@us...> - 2009-02-05 23:16:47
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Timing In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4209/b1_ADT/Timing Modified Files: Time.cs Log Message: Added static method GetIntermediateTimes, in order to make easier writing code for intraday strategies Index: Time.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Timing/Time.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Time.cs 6 Jan 2009 17:32:40 -0000 1.8 --- Time.cs 5 Feb 2009 22:18:15 -0000 1.9 *************** *** 51,54 **** --- 51,75 ---- /// <summary> + /// Returns a list of all the daily times between the given times (firstTime and lastTime) + /// </summary> + /// <param name="firstTime">First time (it will be returned)</param> + /// <param name="lastTime">Last time (it will be returned)</param> + /// <param name="stepInMinutesForIntermediateTimes">Number of minutes between the intermediate + /// times that are to be returned</param> + /// <returns></returns> + public static List<Time> GetIntermediateTimes ( Time firstTime, Time lastTime, + int stepInMinutesForIntermediateTimes) + { + Time currentTimeToAdd = firstTime; + List<Time> returnValue = new List<Time>(); + while( currentTimeToAdd <= lastTime ) + { + returnValue.Add( currentTimeToAdd ); + currentTimeToAdd = currentTimeToAdd.AddMinutes( stepInMinutesForIntermediateTimes ); + } + return returnValue; + } + + /// <summary> /// Adds the given minutes to the current instance's value /// </summary> |
|
From: Glauco S. <gla...@us...> - 2009-02-04 20:05:31
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1245/OpenTickDownloader Modified Files: OTTickerDownloader.cs Log Message: A new constructor has been added: it allows to download consecutive bars (much faster than the downloader based on specific daily times) P.S. the CVS diff doesn't show this change, but I don't remember having already committed the latest changes, thus I'm submitting it anyway Index: OTTickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/OTTickerDownloader.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OTTickerDownloader.cs 29 Jan 2009 19:48:32 -0000 1.8 --- OTTickerDownloader.cs 4 Feb 2009 20:05:22 -0000 1.9 *************** *** 68,71 **** --- 68,72 ---- private string openTickPassword; + // private OTManager oTManager; private IExchangeSelector exchangeSelector; private IOHLCRequester oHLCRequester; |
|
From: Glauco S. <gla...@us...> - 2009-02-04 20:01:56
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/OTManagement In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv573/OpenTickDownloader/OTManagement Modified Files: OTManager.cs Log Message: - some static OTManager's methods have been changed and are instance method now - intervalValueInSeconds is properly computed, now Index: OTManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/OTManagement/OTManager.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OTManager.cs 29 Jan 2009 19:45:12 -0000 1.5 --- OTManager.cs 4 Feb 2009 20:01:49 -0000 1.6 *************** *** 48,52 **** { public event OnErrorEventHandler OnError; ! public static OnLoginEventHandler OnLogin; public event OnNoDataEventHandler OnNoData; public event OnEndOfDataEventHandler OnEndOfData; --- 48,52 ---- { public event OnErrorEventHandler OnError; ! public event OnLoginEventHandler OnLogin; public event OnNoDataEventHandler OnNoData; public event OnEndOfDataEventHandler OnEndOfData; *************** *** 67,93 **** // private string logFileName; ! private static OTClient oTClient; ! static OTManager() ! { ! OTManager.oTClient = new OTClient(); ! OTManager.oTClient.onLogin += new OTLoginEvent( ! OTManager.onLoginEventHandler ); ! OTManager.oTClient.onStatusChanged += new OTStatusChangedEvent( ! OTManager.onStatusChangedEventHandler ); ! } ! private static void onLoginEventHandler() { ! if ( OTManager.OnLogin != null ) ! OTManager.OnLogin(); } ! private static void onStatusChangedEventHandler( int status ) { string currentStatusHasChangedTo = ! OTStatus.GetName( ! typeof( OTStatus ) , status ); string message = "Current status has changed to: " + currentStatusHasChangedTo; ! // this.riseNewMessageEvent( message ); } --- 67,93 ---- // private string logFileName; ! private static OTClient staticOTClient; ! private OTClient oTClient; ! // static OTManager() ! // { ! // OTManager.oTClient = new OTClient(); ! // OTManager.oTClient.onLogin += new OTLoginEvent( ! // OTManager.onLoginEventHandler ); ! // OTManager.oTClient.onStatusChanged += new OTStatusChangedEvent( ! // OTManager.onStatusChangedEventHandler ); ! // } ! private void onLoginEventHandler() { ! if ( this.OnLogin != null ) ! this.OnLogin(); } ! private void onStatusChangedEventHandler( int status ) { string currentStatusHasChangedTo = ! OTStatus.GetName( typeof( OTStatus ) , status ); string message = "Current status has changed to: " + currentStatusHasChangedTo; ! this.riseNewMessageEvent( message ); } *************** *** 103,106 **** --- 103,119 ---- #region commonInitialization + private void set_oTClient() + { + if ( OTManager.staticOTClient == null ) + { + // this is the first OTManager's instance created + this.oTClient = new OTClient(); + OTManager.staticOTClient = this.oTClient; + } + else + // this is not the first OTManager's instance created + this.oTClient = OTManager.staticOTClient; + } + #region setOTCLientEventHandlers private bool wasThisRequestSubmittedByThisOTManagerInstance( int requestId ) *************** *** 139,143 **** "Type: " + error.Type; OTDataEntity oTDataEntity = ! OTManager.oTClient.getEntityById( error.RequestId ); if ( oTDataEntity != null ) // RequestId was refered to a OTDataEntity --- 152,156 ---- "Type: " + error.Type; OTDataEntity oTDataEntity = ! this.oTClient.getEntityById( error.RequestId ); if ( oTDataEntity != null ) // RequestId was refered to a OTDataEntity *************** *** 188,192 **** "RequestId: " + oTMessage.RequestId; OTDataEntity oTDataEntity = ! OTManager.oTClient.getEntityById( oTMessage.RequestId ); if ( oTDataEntity != null ) // RequestId was refered to a OTDataEntity --- 201,205 ---- "RequestId: " + oTMessage.RequestId; OTDataEntity oTDataEntity = ! this.oTClient.getEntityById( oTMessage.RequestId ); if ( oTDataEntity != null ) // RequestId was refered to a OTDataEntity *************** *** 231,235 **** { OTDataEntity oTDataEntity = ! OTManager.oTClient.getEntityById( ohlc.RequestId ); string message = String.Format( "OHLC({7}):time={0} o={1,-6} h={2,-6} " + --- 244,248 ---- { OTDataEntity oTDataEntity = ! this.oTClient.getEntityById( ohlc.RequestId ); string message = String.Format( "OHLC({7}):time={0} o={1,-6} h={2,-6} " + *************** *** 268,281 **** private void setOTClientEventHandlers() { ! OTManager.oTClient.onError += new OTErrorEvent( this.onOTClientError ); ! OTManager.oTClient.onMessage += new OTMessageEvent( ! this.onMessageEventHandler ); ! OTManager.oTClient.onHistoricalOHLC += new OTOHLCEvent( this.onHistoricalOHLC ); } #endregion setOTCLientEventHandlers ! private void commonInitialization() { this.pendingBarRequests = new Hashtable(); this.setOTClientEventHandlers(); --- 281,298 ---- private void setOTClientEventHandlers() { ! this.oTClient.onLogin += new OTLoginEvent( ! this.onLoginEventHandler ); ! this.oTClient.onStatusChanged += new OTStatusChangedEvent( ! this.onStatusChangedEventHandler ); ! this.oTClient.onError += new OTErrorEvent( this.onOTClientError ); ! this.oTClient.onMessage += new OTMessageEvent( this.onMessageEventHandler ); ! this.oTClient.onHistoricalOHLC += new OTOHLCEvent( this.onHistoricalOHLC ); } #endregion setOTCLientEventHandlers ! private void commonInitialization() { + this.set_oTClient(); this.pendingBarRequests = new Hashtable(); this.setOTClientEventHandlers(); *************** *** 286,295 **** ! public static void SubmitLogin( string openTickUser , string openTickPassword ) { ! OTManager.oTClient.addHost( "feed1.opentick.com" , 10010 ); ! //OTManager.oTClient.addHost( "delayed1.opentick.com" , 10010 ); ! OTManager.oTClient.login( openTickUser , openTickPassword ); } --- 303,312 ---- ! public void SubmitLogin( string openTickUser , string openTickPassword ) { ! // this.oTClient.addHost( "feed1.opentick.com" , 10010 ); ! this.oTClient.addHost( "delayed1.opentick.com" , 10015 ); ! this.oTClient.login( openTickUser , openTickPassword ); } *************** *** 342,346 **** OTDataEntity oTDataEntity = new OTDataEntity( exchange , symbol ); ! int requestId = OTManager.oTClient.requestHistData( oTDataEntity , startingDateInUTC , endingDateInUTC , oTHistoricalType , intervalValue ); --- 359,363 ---- OTDataEntity oTDataEntity = new OTDataEntity( exchange , symbol ); ! int requestId = this.oTClient.requestHistData( oTDataEntity , startingDateInUTC , endingDateInUTC , oTHistoricalType , intervalValue ); *************** *** 356,359 **** --- 373,379 ---- short intervalValue) { + int intervalValueInSeconds = + intervalValue * + OTIntervalValueCalculator.GetIntervalValueInSeconds( oTHistoricalType ); BarRequest barRequest = new BarRequest( *************** *** 361,365 **** symbol , startingDateInUTC , ! intervalValue ); lock ( this.pendingBarRequests ) { --- 381,385 ---- symbol , startingDateInUTC , ! intervalValueInSeconds ); lock ( this.pendingBarRequests ) { |