Submitting orders
To send a new order to an Exchange, you must first create an OrderProfile object, using one of its constructors, like the following:
public OrderProfile(Instrument instrument);
After populating the OrderProfile properties with the appropriate settings that describe the order, you submit it to an exchange by calling the SendOrder() method from a TradeSubscription object. After TT .NET SDK sends the order, it creates an Order object that represents the working order associated with the original OrderProfile and delivers it in the TradeSubscription object’s order update events.
The following code snippet demonstrates a simple order routing example assuming that a TradeSubscription object named “m_ts” has already been created and the OrderBookDownload event has already fired.
void submitOrder(Instrument inst, Account acct, Price p)
{
OrderProfile op = new OrderProfile(inst);
op.BuySell = BuySell.Buy;
op.Account = acct;
op.OrderQuantity = Quantity.FromDecimal(inst, 10);
op.OrderType = OrderType.Limit;
op.LimitPrice = p;
if (!m_ts.SendOrder(op))
{
Console.WriteLine("Send new order Failed.");
}
else
{
Console.WriteLine("Sent new order: " + " SOK=" + op.SiteOrderKey);
}
}