SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Nov 29, 2020 2:05 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Mon Jul 06, 2009 3:42 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

All Strategy instances (for each instrument) should receive BarSlice event if a bar is generated for at least one instrument.

So, it looks like a bug, but I can't reproduce the behaviour you described. Could you please export your data to csv files and e-mail me.

Regards,
Sergey.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 07, 2009 4:30 pm 
Offline

Joined: Sat Jul 04, 2009 3:58 am
Posts: 10
Thank you, for your answer.
that was a theoretical question.
Let us assume we dont have a bar in MSFT hist. series in the first strategy (pair trading) in this topic (let it be low liquid instrument in our example).
What about onBarSlice event in this case?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 07, 2009 4:42 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

If CSCO instrument for example does have a bar in historical series for the same period - OnBarSlice event will be raised and inform you that all bars that correspond to this period (only CSCO bar in this example) have been processed by the system.

Regards,
Sergey.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 07, 2009 9:30 pm 
Offline

Joined: Sat Jul 04, 2009 3:58 am
Posts: 10
Thx!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 20, 2009 4:32 am 
Offline

Joined: Sun May 20, 2007 9:09 am
Posts: 351
Quote:
If CSCO instrument for example does have a bar in historical series for the same period - OnBarSlice event will be raised and inform you that all bars that correspond to this period (only CSCO bar in this example) have been processed by the system.




OnBarSlice event, is it only refer to just ONE instrument, all bars of CSCO corresponding to the period, and nothing to do with other instruments?

What period you are referring to?


Top
 Profile  
 
PostPosted: Thu Aug 20, 2009 4:41 am 
Offline

Joined: Sun May 20, 2007 9:09 am
Posts: 351
VovaM wrote:
For ex. we have two instruments with irregularities in bar series (liquid EURUSD and illiquid forex pair NOKEUR; sometimes we do not have bar for NOKEUR pair at the same time we always have one for EURUSD):

time\EURUSD OHLC bar\NOKEUR OHLC bar\ OnBarSlice event
10:00 \ yes \ yes \ yes
10:01\ yes \yes \ yes
10:02 \yes \ NO \ NO
10:03 \yes \yes \ yes

is this correct model "model" of onBarSlice event behavior?


I am also looking for the solution for this problem, anyone already has the solution?


Top
 Profile  
 
PostPosted: Sun Jul 03, 2011 9:50 pm 
Offline

Joined: Sun Jul 03, 2011 9:45 pm
Posts: 1
Has Anybody done some testing on dynamic portfolio backtesting of spreads ?

Say i´ve a txt file with Spread combinations :

DELL , CSCO
MSFT , AAPL
QQQQ , IWM
....

and i want to run a backtest on every spread listed in the txt.

Any suggestions ?


Top
 Profile  
 
PostPosted: Mon Jul 04, 2011 2:34 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Hi,

I think the best way to do it one by one is to utilize scenario engine (backtest on one pair, write down results, change instruments, backtest another pair, etc.)

Cheers,
Anton


Top
 Profile  
 
PostPosted: Thu Jul 12, 2012 4:58 pm 
Offline

Joined: Thu Oct 13, 2011 7:11 pm
Posts: 41
I want to apply a indicator to the spread / ratio. How is this possible?


Top
 Profile  
 
PostPosted: Thu Jul 12, 2012 5:21 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
You can define a TimeSeries and Indicator that uses this time series as input and then fill input series with ratio or spread data in OnBar or OnTrade (or in OnBarSlice).

Regards,
Anton


Top
 Profile  
 
PostPosted: Fri Jul 13, 2012 2:11 pm 
Offline

Joined: Thu Oct 13, 2011 7:11 pm
Posts: 41
Can you give some sample code.


Top
 Profile  
 
PostPosted: Fri Jul 13, 2012 2:18 pm 
Offline

Joined: Thu Oct 13, 2011 7:11 pm
Posts: 41
Can you define this time series as an instrument so the strategy events fire for the ratio.

Pl. give some code samples


Top
 Profile  
 
PostPosted: Fri Jul 13, 2012 3:03 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
No, we do not support "synthetic" instruments out of the box.


Top
 Profile  
 
PostPosted: Sat Jul 14, 2012 10:28 am 
Offline

Joined: Thu Oct 13, 2011 7:11 pm
Posts: 41
Dr. Anton Fokin wrote:
You can define a TimeSeries and Indicator that uses this time series as input and then fill input series with ratio or spread data in OnBar or OnTrade (or in OnBarSlice).

Regards,
Anton


Can you give a code example?


Top
 Profile  
 
PostPosted: Mon Jul 16, 2012 6:47 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

If you add 2 instruments - SPY and QQQ to your project the following code should work:

Code:
using System;
using System.Drawing;

using OpenQuant.API;
using OpenQuant.API.Indicators;

public class MyStrategy : Strategy
{
   TimeSeries spreadSeries = new TimeSeries();
   
   SMA sma;
   
   Instrument instrument1;
   Instrument instrument2;
   
   public override void OnStrategyStart()
   {
      instrument1 = InstrumentManager.Instruments["QQQ"];
      instrument2 = InstrumentManager.Instruments["SPY"];      
      
      if (Instrument == instrument1)
      {
         sma = new SMA(spreadSeries, 14);
         
         Draw(sma, 2);
      }
   }

   public override void OnBarSlice(long size)
   {
      if (Instrument == instrument1)
      {
         if (instrument2.Bar.Close != 0)         
            spreadSeries.Add(Clock.Now, instrument1.Bar.Close / instrument2.Bar.Close);
         
      }   
   }
}


Regards,
Sergey.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3  Next

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