SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Aug 21, 2019 5:35 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Oct 13, 2008 8:01 pm 
Offline

Joined: Thu Jun 08, 2006 3:56 pm
Posts: 537
Location: BC Canada
Anton, could you please comment on a recommended approach for handling the cancellation of OCA orders? If I issue bracket orders in an OCA group, I get a pile of error messages from IB like this when it cancels the orders in the OCA group.

"202 Order Canceled - reason <nothing here, no reason at all>"

Should I just handle the cancellation manually in the OnOrderFilled code? That way I would not have instant cancellation like IB might do, but I would not have to look at the disturbing 202 error messages that make me feel like my strategy is generating errors.

Or maybe there is a way to use OCA orders, but catch the 202 error in a provider event handler so I don't see the error message printed out in the provider errors window in OQ?

Please give us some guidance on the best way to handle this situation, if you can. Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 13, 2008 8:20 pm 
Offline

Joined: Thu Jun 08, 2006 3:56 pm
Posts: 537
Location: BC Canada
I think what I would like to do is to keep using OCA groups, and to handle the provider error message. But in order to handle the error message properly, I need to know the order.ID that the provider quotes in the error message. I want to do something like this:

Code:
OnError (.., orderid, ..) {
   // handle provider errors

   // ignore routine OCA cancellation orders
   if (errcode == 202) {       // order cancelled - reason

        // ignore OCA cancellations
        if (error.ID == <one of my OCA order numbers>)
              return;    // ignore routine OCA cancels

        // else it was one of my real orders that was cancelled
        // for some significant reason
        < print an error message, or something intelligent>
   }

   // .. handle other provider errors
}


The problem I have with this desired approach is that I don't know the order id of my OCA orders, because I created them with LimitOrder and StopOrder and cannot find out the order id. So I cannot compare my list of order ids with the id in the 202 error message.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 14, 2008 7:33 pm 
Offline

Joined: Mon Jan 07, 2008 6:18 am
Posts: 58
I recall that same situation, I was inundated with those extraneous error messages. What's the downside of cancelling orders in the code? Maybe a little more latency involved in getting the thing cancelled, if that doesn't matter I'm going to not use the OCA capability at all.


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