// commands private void SendNews(object ignored) { try { Trace.WriteLine(String.Format("Send news: Head=[{0}] Line1=[{1}]", this.Headline, this.Line1Text)); string h = this.Headline; IList <string> lines = new List <string>(); if (this.IsLine1Enabled) { lines.Add(this.Line1Text); } if (this.IsLine2Enabled) { lines.Add(this.Line2Text); } if (this.IsLine3Enabled) { lines.Add(this.Line3Text); } QuickFix.FIX44.News news = MessageCreator44.News(h, lines); _qfapp.Send(news); } catch (Exception e) { Trace.WriteLine("Failed to send news message.\n" + e.ToString()); } }
private void SendOrder(Side side) { try { Trace.WriteLine(String.Format("Send New Order: Type={0} Side={1} Symbol=[{2}] Qty=[{3}] LimitPrice=[{4}] TIF={5}", this.OrderType.ToString(), side.ToString(), this.Symbol, this.OrderQtyString, this.LimitPriceString, this.TimeInForce.ToString())); Dictionary <int, string> customFieldsDict = new Dictionary <int, string>(); foreach (CustomFieldRecord cfr in this.CustomFields) { customFieldsDict[cfr.Tag] = cfr.Value; } int orderQty = int.Parse(this.OrderQtyString); decimal limitPrice = decimal.Parse(this.LimitPriceString); QuickFix.FIX44.NewOrderSingle nos = MessageCreator44.NewOrderSingle( customFieldsDict, this.OrderType, side, this.Symbol, orderQty, this.TimeInForce, limitPrice); OrderRecord r = new OrderRecord(nos); lock (_ordersLock) { Orders.Add(r); } _qfapp.Send(nos); } catch (Exception e) { Trace.WriteLine("Failed to send order\n" + e.ToString()); } }
/// <summary> /// /// </summary> /// <param name="or"></param> /// <param name="newQty"></param> /// <param name="newPrice">ignored if not applicable for order type</param> /// <param name="customFields">other custom fields to be added</param> public void CancelReplaceOrder(OrderRecord or, int newQty, decimal newPrice, Dictionary <int, string> customFields) { try { QuickFix.FIX44.OrderCancelReplaceRequest ocrq = MessageCreator44.OrderCancelReplaceRequest( customFields, or.OriginalNOS, newQty, newPrice); ocrq.OrderID = new QuickFix.Fields.OrderID(or.OrderID); _strategy.ProcessOrderCancelReplaceRequest(or.OriginalNOS, ocrq); _qfapp.Send(ocrq); } catch (Exception e) { Trace.WriteLine(e.ToString()); } }
public void CancelOrder(OrderRecord or) { try { QuickFix.FIX44.OrderCancelRequest ocq = new QuickFix.FIX44.OrderCancelRequest( new QuickFix.Fields.OrigClOrdID(or.ClOrdID), MessageCreator44.GenerateClOrdID(), new QuickFix.Fields.Symbol(or.Symbol), or.OriginalNOS.Side, new QuickFix.Fields.TransactTime(DateTime.Now)); ocq.OrderID = new QuickFix.Fields.OrderID(or.OrderID); _strategy.ProcessOrderCancelRequest(or.OriginalNOS, ocq); _qfapp.Send(ocq); } catch (Exception e) { Trace.WriteLine(e.ToString()); } }