SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Nov 23, 2020 7:57 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Aug 24, 2012 3:41 pm 
Offline

Joined: Tue Jun 09, 2009 5:07 pm
Posts: 10
Location: Belgium
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();
   }
}


Top
 Profile  
 
PostPosted: Mon Aug 27, 2012 12:45 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Hi,

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

_________________
SmartQuant Development Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group