static void Main(string[] args) { ORDER hOrder = new OPTIONORDER(); Object err = null; Object result; hOrder.Side = "Buy"; hOrder.Symbol = "IBM"; hOrder.Type = "Call"; hOrder.Date = "Jun '16"; hOrder.Strike = "160.00"; hOrder.Position = "Open"; hOrder.Quantity = "1"; hOrder.PriceType = "Market"; hOrder.Exchange = "TST2 DMA"; hOrder.TIF = "Day"; hOrder.Account = "00999900"; hOrder.Ticket = "Bypass"; result = hOrder.Submit(err); System.Console.WriteLine(result + " " + err + hOrder.Ticket); System.Console.WriteLine(DateTime.Now.ToString("h:mm:ss.fff tt")); Console.ReadLine(); }
//Submit an order to REDI private void SendOrder() { OPTIONORDER objOrder = new OPTIONORDER(); PrintOrder(); objOrder.Symbol = options.Symbol; objOrder.PriceType = options.PriceType; objOrder.Quantity = options.Quantity.ToString(); //Set the limit price or stop price according to the price type switch (options.PriceType) { case "Limit": case "Limit Close": objOrder.Price = options.Price.ToString(); break; case "Stop": objOrder.StopPrice = options.StopPrice.ToString(); break; case "Stop Limit": objOrder.Price = options.Price.ToString(); objOrder.StopPrice = options.StopPrice.ToString(); break; } objOrder.type = options.Type; objOrder.Date = options.Date; objOrder.Strike = options.Strike; objOrder.Position = options.Position; objOrder.Side = options.Side; objOrder.Exchange = options.Exchange; objOrder.TIF = options.TIF; objOrder.Account = options.Account; objOrder.Ticket = options.Ticket; object ord_err = null; bool status; //Submit an order status = objOrder.Submit(ref ord_err); if (!status) { Console.WriteLine("Error: {0}", (string)ord_err); string error = (string)ord_err; //If the error is "Invalid Date.", show the first availble expiration date if (error == "Invalid Date.") { Console.WriteLine("The first valid expiration date is: \"{0}\". Please try with this expiration date.", GetExpirationDate(options.Symbol)); } } else { Console.WriteLine("Order has been submitted properly"); } }