static void Main(string[] args) { ORDER hOrder = new ORDER(); Object err = null; Object result; hOrder.Side = "Buy"; hOrder.Symbol = "ZVZZT"; hOrder.Quantity = "1"; hOrder.PriceType = "Market"; hOrder.Exchange = "DEMO 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(); }
static bool ptOrderSubmit(String symbol, String side, int qty, double limit, String accnt, String tfUser, String tfList, StreamWriter sw) { ORDER ptOrder = new ORDER(); Object err = null; bool success; ptOrder.Symbol = symbol; ptOrder.Side = side; ptOrder.Quantity = qty; ptOrder.Exchange = "*ticket"; //PT is a bunch of tickets if (limit > 0) { ptOrder.Price = limit; //ptOrder.Exchange must be set before ptOrder.Price (otherwise this will be ignored) } ptOrder.Account = accnt; ptOrder.SetTFUser(tfUser); ptOrder.SetTFList(tfList); ptOrder.Warning = false; //Disable the pop-up warning for invalid limit price success = ptOrder.Submit(ref err); if (!success) { DebugPrint("ERROR: issue with ticket: " + ptOrder.Side + " " + ptOrder.Quantity + " " + ptOrder.Symbol + " " + ptOrder.Price, sw); //Note: the error message might be empty, it depends on the error case DebugPrint("ERROR message: " + err, sw); } else { DebugPrint("INFO: successfully submitted ticket: " + ptOrder.Side + " " + ptOrder.Quantity + " " + ptOrder.Symbol + " " + ptOrder.Price, sw); } return(success); }