1. Get the Account. It looks like you do this using the known account name, so if the account is named "John Smith Trading", then:
Account myAccount = Account.All.FirstOrDefault(a => a.Name == "John Smith Trading");
2. Create the order you want to submit:
Order stopOrder = myAccount.CreateOrder(myInstrument, OrderAction.Sell, OrderType.StopMarket, TimeInForce.Day, 1, 0, 1400, "myOCO", "stopOrder", null);
3. Put the order into an array and submit it using Submit()
myAccount.Submit(new[] { stopOrder });
My questions are:
1. How do you ever know that the order has indeed been submitted? Is there a return value on Submit, or are there any callbacks that get called when the order gets submitted successfully? What are these callbacks? Where are they documented?
2. How do we know if there is an error? For example, suppose you submit a BUYSTOP at a price below the current market? That would result in an error.
3. How do you know when a stop or limit order gets filled? Is there a callback that gets called? What is this callback? Where is it documented?
So basically I need a tutorial on whatever lifecycle methods or procedures exist for submitting and order, knowing if submission is successful, knowing when an order gets filled, etc.
Comment