SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Feb 18, 2020 5:22 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Mar 07, 2012 2:18 pm 
Offline

Joined: Wed Feb 01, 2012 4:57 pm
Posts: 7
Hi,

I trade FX markets with IB and I have a problem with bars during the daily interruption of the market (17.00 to 17.15 ET). If I use 30 mins bars for a strategy, what I´d like to get is a customized bar including quotes from 17.15 to 17.30, then the following bar would be 17.30 to 18.00 and so on.
I´ve tried aggregating 1 min bars into 30 mins bars using xxx.Compress(1800) to solve the issue but I get a bar from 17.15 to 17.45 and then from 17.45 to 18.15 (instead of the expected 17.15 to 17.30 and 17.30 to 18.00).

We´ve almost reached the end of the trial period and having this working the way we want is mandatory for us to buy OQ so we´d like to thank you in advance for your much appreciated help.

JP


Top
 Profile  
 
PostPosted: Wed Mar 07, 2012 4:47 pm 
Offline
Site Admin

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

Quote:
I´ve tried aggregating 1 min bars into 30 mins bars using xxx.Compress(1800) to solve the issue but I get a bar from 17.15 to 17.45 and then from 17.45 to 18.15 (instead of the expected 17.15 to 17.30 and 17.30 to 18.00).


Could you provide a code sample of bar compression, because 30min bar cannot have time interval from 17.15 to 17.45

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Fri Mar 09, 2012 1:01 pm 
Offline

Joined: Wed Feb 01, 2012 4:57 pm
Posts: 7
Hello,

For clarification, the trading interruption on FX markets with IB is between 17.00 to 17.15 ET meaning 23.00 to 23.15 CET in our examples.
Here's the issue with 2 sample codes. The first is a download of 1 min bar data to be aggregated into 30 mins bars. The output gives a bar from 23.00 to 23.30 including data from 23.15 to 23.30.
In the second code which is a simulation of real time, we have a bar from 22.30 to 23.00 and then a bar from 23.30 to 0.00 (indeed including data from 23.30 to 0.00), which is the outcome we're expecting. Thus we have a discrepancy in the behaviour of historical data collection and real time. We dont provide the sample here but using 1 hour bars would remove completely data from 23.00 to 0.00 in real time which is not what we want. To summarise, as our intention is to only exclude data from 23.00 to 23.30 on all time frames in both historical data and simulation / real time, what we're looking for is a command that allows this. It relates to inform OQ that the trading session for the instrument is 23.30 (day) to 23.00 (day+1) with no interest for data outside of this range that should be completely excluded (for indicators calculation or trading signals for instance).

thanks again for your help,

JP


Bar 1m
Code:
   
        public override void OnStrategyStart()
   {
      foreach (Bar bar in DataManager.GetHistoricalBars( Instruments["EUR.USD"],BarType.Time , 60)){   
         Bars.Add(bar);
      }
      
      BarSeries b = Bars.Compress(1800);
      
      foreach(Bar a in b){
         Console.WriteLine(a);
      }
      
   }

   public override void OnBar(Bar bar)
   {
   }

[07/03/2012 22:30:00 - 07/03/2012 23:00:00) type=Time open=1.3154 high=1.3154 low=1.3146 close=1.315 volume=-30 openInt=0 size=1800
[07/03/2012 23:00:00 - 07/03/2012 23:30:00) type=Time open=1.31515 high=1.31515 low=1.31475 close=1.3148 volume=-15 openInt=0 size=1800
[07/03/2012 23:30:00 - 08/03/2012 00:00:00) type=Time open=1.3148 high=1.3154 low=1.3147 close=1.31515 volume=-30 openInt=0 size=1800
[08/03/2012 00:00:00 - 08/03/2012 00:30:00) type=Time open=1.31515 high=1.31545 low=1.31495 close=1.315 volume=-30 openInt=0 size=1800
[08/03/2012 00:30:00 - 08/03/2012 01:00:00) type=Time open=1.315 high=1.31505 low=1.314 close=1.31415 volume=-30 openInt=0 size=1800
[08/03/2012 01:00:00 - 08/03/2012 01:30:00) type=Time open=1.31415 high=1.31445 low=1.3136 close=1.3142 volume=-30 openInt=0 size=1800
[08/03/2012 01:30:00 - 08/03/2012 02:00:00) type=Time open=1.3142 high=1.3148 low=1.31355 close=1.31435 volume=-30 openInt=0 size=1800



Bar 30m
Code:
   
   public override void OnStrategyStart()
   {   
   }

   public override void OnBar(Bar bar)
   {
      Console.WriteLine(bar);
   }


[07/03/2012 21:00:00 - 07/03/2012 21:30:00) type=Time open=1.31485 high=1.3152 low=1.3143 close=1.3145 volume=-1 openInt=0 size=1800
[07/03/2012 21:30:00 - 07/03/2012 22:00:00) type=Time open=1.3145 high=1.31495 low=1.3144 close=1.31485 volume=-1 openInt=0 size=1800
[07/03/2012 22:00:00 - 07/03/2012 22:30:00) type=Time open=1.31485 high=1.3154 low=1.3146 close=1.3154 volume=-1 openInt=0 size=1800
[07/03/2012 22:30:00 - 07/03/2012 23:00:00) type=Time open=1.3154 high=1.3154 low=1.3146 close=1.315 volume=-1 openInt=0 size=1800
[07/03/2012 23:30:00 - 08/03/2012 00:00:00) type=Time open=1.3148 high=1.3154 low=1.3147 close=1.31515 volume=-1 openInt=0 size=1800
[08/03/2012 00:00:00 - 08/03/2012 00:30:00) type=Time open=1.31515 high=1.31545 low=1.31495 close=1.315 volume=-1 openInt=0 size=1800
[08/03/2012 00:30:00 - 08/03/2012 01:00:00) type=Time open=1.315 high=1.31505 low=1.314 close=1.31415 volume=-1 openInt=0 size=1800
[08/03/2012 01:00:00 - 08/03/2012 01:30:00) type=Time open=1.31415 high=1.31445 low=1.3136 close=1.3142 volume=-1 openInt=0 size=1800
[08/03/2012 01:30:00 - 08/03/2012 02:00:00) type=Time open=1.3142 high=1.3148 low=1.31355 close=1.31435 volume=-1 openInt=0 size=1800


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

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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