RueLorimier
Registered: Apr 2012
Posts: 9 |
05-14-12 02:55 PM
Quote from viniciusvbf:
Hi, i just started programming on the Sterling Trader API, and i'm have some trouble cancelling an order (i'm using c#).
Could someone please help me with a simple example of how to cancel an order? Thank you.
private SterlingLib.STIOrderMaint stOrdMaint=new SterlingLib.STIOrderMaint();
private CancelSterlingOrder(string ClOrderId){
this.stOrdMaint.CancelOrder("MY_ACCOUNT", 0, ClOrderId, ClOrderId+"_Canceled");
}
Note: The "ClOrderId" is the ClOrderId of the order you want to cancel. This ID is assigned by yourself when it is sent to Sterling API. It must be unique in multiple days .
If you want to test the code with your demo account, you must know:
All orders on demo account will be filled immediately no matter how much the order price is. So basically you will not have the chance to cancel them. But they do provide some test symbols for your debugging, so you can place an order on MSFT and cancel it:
AAPL: Partial Fill (Half)
CIEN: Stays in Sending Mode (New or Replace)
CP: Stays in Cancel Pending mode - does not fill
EK: Partial Fill (Half)
GE: Rejected Order
GOOG: Partial Fill (one-tenth)
JNJ: Does not fill
KO: Too Late To Cancel
MSFT: Does not fill
T: Does not fill
|