SmartQuant Discussion
http://www.smartquant.com/forums/

Provider errors in GetHistoricalBars not captured in OnError
http://www.smartquant.com/forums/viewtopic.php?f=60&t=10309
Page 1 of 1

Author:  roedies [ Fri Aug 24, 2012 3:41 pm ]
Post subject:  Provider errors in GetHistoricalBars not captured in OnError

Dear Anton,
Downloading from IB gives sometimes “Pacing Violation” errors. In order to recover from them I planned on writing code in de OnError callback in a strategy. It looks like none of the errors are captured in this callback although they are visible in the OQ IDE. It seems the problem is related to historical download method “GetHistoricalBars”
Question:
Is this a bug in the system?
Am I coding incorrectly?
Below a simple strategy to force “Pacing Violations” in IB.
No error messages pop up in the Output window but they are visible in the “Provider errors” pane.
System OQ 3.5.2 (64bit) on Win7
Code:
using OpenQuant.API;
using OpenQuant.API.Indicators;
using System;
using System.Drawing;

/* This strategy forces a Pacing Violation while downloading
to rapidly the same instrument.
The OnError method does not show these errors allthough they show up in
the "Provider Errors" window in the OQ IDE.
Bug in OQ??
*/
public class MyStrategy : Strategy
{
   private DateTime    start            = new DateTime(2012,8,23,12,00,00);
   private DateTime    end               = new DateTime(2012,8,23,22,00,00);

   public override void OnStrategyStart()
   {
      Instrument instr = InstrumentManager.Instruments["MSFT"];
      for(int i = 0; i < 10; i++)
      {
         var count = DataManager.GetHistoricalBars("IB" ,instr, start, end,60).Count;
         Console.WriteLine("Iteration: {0} \tNbr of Bars:{1} ",i,count);
      }
   }
   
   public override void OnError(ProviderError error)
   {
      Console.WriteLine("{0} \t{1} \t {2} \t{3} ",error.Provider, error.DateTime, error.Id, error.Code);
   }

   public override void OnBar(Bar bar)
   {
         StopStrategy();
   }
}

Author:  Alexei Kurov [ Mon Aug 27, 2012 12:45 pm ]
Post subject:  Re: Provider errors in GetHistoricalBars not captured in OnE

Hi,

The strategy does not receive any callback (OnXXX methods) while the execution is going inside OnStrategyStart method.

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/