public long AddOrderSell(string instrument, int volume, string price) { Message sendMessage = pub.NewMessage(MessageKeyType.KeyName, "FutAddOrder"); SchemeFortsMsg.FutAddOrder msg = new SchemeFortsMsg.FutAddOrder(sendMessage.Data); (sendMessage as DataMessage).UserId = 0; msg.broker_code = "FZ00"; msg.isin = instrument; msg.client_code = "RTY"; msg.type = 1; msg.dir = 2; msg.amount = volume; msg.price = price; msg.ext_id = 0; Execution = true; pub.Post(sendMessage, PublishFlag.NeedReply); sendMessage.Dispose(); while (Execution) Thread.Sleep(10); return Ticket; }
public long OrderSend(Instrument instr, OrderType type, FillingType fill, int volume, string price, string expiration = "", string comment = "", int magic = 0) { Message sendMessage = pub.NewMessage(MessageKeyType.KeyName, "FutAddOrder"); SchemeFortsMsg.FutAddOrder msg = new SchemeFortsMsg.FutAddOrder(sendMessage.Data); (sendMessage as DataMessage).UserId = 0; msg.client_code = "RTY"; msg.isin = instr.ShortName; msg.type = (int)fill; msg.dir = (int)type; msg.amount = volume; msg.price = price; msg.date_exp = expiration; msg.comment = comment; msg.ext_id = magic; Execution = true; pub.Post(sendMessage, PublishFlag.NeedReply); sendMessage.Dispose(); while (Execution) Thread.Sleep(1); return Ticket; }