SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sat Sep 23, 2017 1:32 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri Jul 14, 2017 5:03 pm 
Offline

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

I have a situation, in a backtest, that I like to bring to your attention:

I have 1 min bar data.
So, every time there is bar, the Onbar event will fire. This happens very precicely as the first thing.

Now, the situation I currently face, is that the OnBar event fires before any order processes (with the OQ ExecutionSimulator) are completed from the previous minute (OnBar -1)) of market data. So, when I do a position check in the current OnBar, I still see the order as working, even though, maybe in reality,too, it would have gotten filled. But in this Backtest, I only get to see the status on the next OnBar (Onbar +1) event - or I could do it via a timer x millisecs after, but then I loose that to the OnBar Event. Since I like to place the order or change the order with the OnBar event.

This behavior does not fully represent reality, since in Reality, I would have most likely gotten the fill already from the broker within that min. This gets worse, when doing things on EOD data. Then the lag becomes >= a day.

Could you maybe add an option, to first process the ExecutionSimulator events before any marketdata events.

Thanks
Mike


Top
 Profile  
 
PostPosted: Wed Jul 19, 2017 11:05 pm 
Offline

Joined: Thu Jun 08, 2006 3:56 pm
Posts: 537
Location: BC Canada
Wouldn't you have received notification in OnOrderFilled() if your order had filled? Then, the code inside of it would update your position information that you could examine in the next OnBar event? You could potentially have N OnOrderFilled calls before your next OnBar call, both in backtesting and in reality, I think.


Top
 Profile  
 
PostPosted: Thu Jul 20, 2017 11:07 am 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 195
no, I did not. Even though if the event did not fire, I thought I could check the Order.Status in the OnBar event, since for me, the order status should have changed before the OnBar event. But the order status changes and the OnOrderFilled() triggers after the OnBar event has triggered.


Top
 Profile  
 
PostPosted: Thu Jul 20, 2017 3:46 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 367
Hello Mike,
perhaps it is your situation which described in documentation:
OpenQuant 2014 FAQ.pdf, p. How to use ExecutionSimulator.Queued property.


Top
 Profile  
 
PostPosted: Mon Jul 24, 2017 4:50 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 195
Thanks for the hint. And I guess that could be use as a quick and dirty work around.

Though, after further consideration, I think the order, in which the event bus queue is filled should be changed to:
The execution reports should filled into the event bus queue first for the past minute (in my example) before new OnBar Events will be added to the queues.

Since, if you think this through for example for daily bars, you cannot place orders or replace them with the onBar Event - since he are always one full day behind your order status.


Top
 Profile  
 
PostPosted: Thu Jul 27, 2017 11:32 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 367
mikembb wrote:
Thanks for the hint. And I guess that could be use as a quick and dirty work around.

Though, after further consideration, I think the order, in which the event bus queue is filled should be changed to:
The execution reports should filled into the event bus queue first for the past minute (in my example) before new OnBar Events will be added to the queues.

Since, if you think this through for example for daily bars, you cannot place orders or replace them with the onBar Event - since he are always one full day behind your order status.

It just a queue, it cannot manage or predict the time.


Top
 Profile  
 
PostPosted: Thu Jul 27, 2017 12:18 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 195
ok, how come the onBar events are put into the queue before the orderprocessings are put into the queue?

Please help me to understand.


Top
 Profile  
 
PostPosted: Mon Jul 31, 2017 10:02 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 367
mikembb wrote:
ok, how come the onBar events are put into the queue before the orderprocessings are put into the queue?

Please help me to understand.

Market data arrive without the queue.
Queue is designed for processing the orders only.

Example of how trade is coming through framework.
1)trade comes to BarFactory.
If bar is completed it will be send(synced) to framework(process similar as trade)
2)trade comes to DataManager, to fill trade by provider/by instrument.
3)trade comes to InstrumentManager, to fill Instrument.Trade
4)trade comes to ExecutionSimulator,
order can be triggered, report can be(or nor) placed in queue and send to framework.
5)trade comes to Strategy.

At result even a single trade can trigger tree of events(eg new bar, or new execution report).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 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