Overview
TT .NET Client Side now supports adding, changing, and deleting Staged Orders.
For an overview of Staged Orders, refer to the Care Orders Overview section of the Setup help.
Submitting a new Staged Order
To submit a new Staged Order, you must first create an OrderProfile object using the isStagedOrder Flag set to true.
The new fields that can be set on the Profile are:
- StagedOrderMessage (String)
- BestMarketPrice (Price)
For example:
void submitOrder(Instrument inst, Account acct, Price p)
{
OrderProfile op = new OrderProfile(inst, true);
op.BuySell = BuySell.Buy;
op.Account = acct;
op.OrderQuantity = Quantity.FromDecimal(inst, 10);
op.OrderType = OrderType.Limit;
op.LimitPrice = p;
op.StagedOrderMessage = “My Staged order”;
op.BestMarketPrice = 100.00;
if (!m_ts.SendOrder(op))
{
Console.WriteLine("Send new order Failed.");
}
else
{
Console.WriteLine("Sent new order: " + " SOK=" + op.SiteOrderKey);
}
}
Modifying and Deleting a Staged Order
Staged orders can be modified and deleted the same way as regular orders. After making the desired changes, set the value of the OrderProfile.Action property to indicate how the existing order should be modified, as follows:
- To delete the existing order, set the value to OrderAction.Delete.
- To place the existing order on hold, set the value to OrderAction.Hold to resubmit a held order, set the value to OrderAction.Resubmit.
- To modify the existing order values, set the value to OrderAction.Change.
For example:
void changeOrderPrice(string key, Price p)
{
if (m_ts.Orders.ContainsKey(key))
{
Order order = m_ts.Orders[key];
OrderProfile op = order.GetOrderProfile();
op.LimitPrice = p;
op.Action = OrderAction.Change;
git
if (!m_ts.SendOrder(op))
{
Console.WriteLine("Send change order Failed.");
}
else
{
Console.WriteLine("Sent order change request.");
}
}
}