SmartQuant Discussion
http://www.smartquant.com/forums/

How to replace the replace() method?
http://www.smartquant.com/forums/viewtopic.php?f=44&t=7589
Page 1 of 1

Author:  NtireTech [ Mon Aug 10, 2009 12:41 pm ]
Post subject:  How to replace the replace() method?

Hi folks,

I have a strategy that uses replace method to replace the orders. BUT the TT API doesn't support replace() so I have a problem. what is the most efficient work around that I can create in my strategy? It has to involve cancel() and send().

Thanks

Author:  rdt [ Mon Aug 10, 2009 4:05 pm ]
Post subject: 

Instead of

MyOrder.Replace();



you should use


MyOrder.Cancel();
//Calculate limit-prices
MyOrder = LimitOrder(...);
MyOrder.Send();


When you fear some realtime-problems you poll if your order is deleted and then fire the next order.

Author:  Dr. Anton Fokin [ Mon Aug 10, 2009 6:06 pm ]
Post subject: 

PS. We will try to add native Replace() for TT API in the next release.

Regards,
Anton

Author:  NtireTech [ Tue Aug 11, 2009 12:53 am ]
Post subject: 

Thanks guys.

RDT I tried your solution but I get the run time exception like "Key Already Added" at the point MyOrder.Send().

Is it due to the fact that the order which has already been sent is being tried to send again? How can I fix this issue?

Thanks

Author:  rdt [ Tue Aug 11, 2009 9:47 am ]
Post subject: 

Possibilities are:

1.

You use different orders. E.g.

MyOrder1 and MyOrder2. When you delete MyOrder1 you send MyOrder2.


2.

Or you use the event-handler OnOrderCancelled. This should be activated whenever an order is deleted (I never tried but it should work).


3.

You should try something like if (!MyOrder) or the flags like MyOrder.IsCancelled, etc. Here you should find out what works and what not.


Order-handling is something you should master. Otherwise it doesn't make any sense to think about live-trading.

Author:  Dr. Anton Fokin [ Tue Aug 11, 2009 11:35 am ]
Post subject: 

NtireTech wrote:
Thanks guys.

RDT I tried your solution but I get the run time exception like "Key Already Added" at the point MyOrder.Send().

Is it due to the fact that the order which has already been sent is being tried to send again? How can I fix this issue?

Thanks


Hi,

can you be more specific on this issue? Can you send us your strategy code (or code snippet) that generates this exception?

Thanks,
Anton

Author:  PBJ [ Thu Nov 03, 2011 12:12 pm ]
Post subject:  Re: How to replace the replace() method?

My post about the same type of issue might help:
viewtopic.php?f=60&t=6251&p=30680#p30680

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/