SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Dec 16, 2019 6:47 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Oct 28, 2019 3:41 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 264
Dear Team,

could you please assist me, on how I could send submit a bar in the below code in addition to the trade that fired the event in the first place?


Code:
public override Event Filter(Event e)
        {
                switch (e.TypeId)
                {
                    case DataObjectType.Level2:
                        return null;

                    case EventType.Trade:
                        var t = (Trade)e;

                        var b = new Bar(t.DateTime, t.DateTime.AddSeconds(1), t.InstrumentId, BarType.Time, 1, t.Price, t.Price, t.Price, t.Price, t.Size);
                        ///How can I submit this bar in addition to the trade?
                        return t;
                }
        }



Thanks
Mike


Top
 Profile  
 
PostPosted: Mon Oct 28, 2019 5:01 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 562
Hi,
sending events from a filter is not a good idea, however you can do it using
framework.EventManager.OnEvent(e);
You can keep framework in your constructor for future use.


Top
 Profile  
 
PostPosted: Mon Oct 28, 2019 6:13 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 264
thanks.

Could you help me on how I can put a bar into a Event (e)?

Thanks
Mike


Top
 Profile  
 
PostPosted: Tue Oct 29, 2019 9:46 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 562
Bar inherits from Event, so just put it:
Code:
framework.EventManager.OnEvent(bar);


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

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 5 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