public void Invoke_OnRemoveWaitingOrder(RecordTransItem item) { OrderArgs args = new OrderArgs(); args.order = item; OnRemoveWaitingOrder?.Invoke(this, args); }
void _t_OnRtnCancel(object sender, OrderArgs e) { //重发委托 var trade = (Trade)sender; if (_reSend.IndexOf(e.Value.OrderID) >= 0) { _reSend.Remove(e.Value.OrderID); InstrumentField instField; if (trade.DicInstrumentField.TryGetValue(e.Value.InstrumentID, out instField)) { if (instField.ExchangeID == "SHFE") { double price = e.Value.Direction == DirectionType.Buy ? _q.DicTick[e.Value.InstrumentID].UpperLimitPrice : _q.DicTick[e.Value.InstrumentID].LowerLimitPrice; trade.ReqOrderInsert(e.Value.InstrumentID, e.Value.Direction, e.Value.Offset, price, e.Value.VolumeLeft, pType: OrderType.Limit, pCustom: e.Value.Custom); } else { trade.ReqOrderInsert(e.Value.InstrumentID, e.Value.Direction, e.Value.Offset, 0, e.Value.VolumeLeft, pType: OrderType.Market, pCustom: e.Value.Custom); } } } }
public void Invoke_OnInsertOrder(RecordTransItem item) { OrderArgs args = new OrderArgs(); args.order = item; OnInsertOrder?.Invoke(this, args); }
public void Invoke_OnRemovePosition(RecordTransItem item) { OrderArgs args = new OrderArgs(); args.order = item; OnRemovePosition?.Invoke(this, args); }
void trade_OnRtnOrder(object sender, OrderArgs e) { _queueOrderFresh.Enqueue(e.Value.OrderID); //刷新时用 if (e.Value.Status == OrderStatus.Normal) { Ring("报入成功"); } }
private void _t_OnRtnOrder(object sender, OrderArgs e) { Log($"{e.Value.InstrumentID}\t{e.Value.Direction}\t{e.Value.Offset}\t{e.Value.LimitPrice}\t{e.Value.Volume}"); if (e.Value.IsLocal) { _t.ReqOrderAction(e.Value.OrderID); } }
private void OrderNotifyHandler(object sender, OrderArgs e) { itemOrder iorder = e.ItemOrder; // if (!ls.Contains(iorder.morigtkn)) return; DateTime mdate = ComFucs.GetDate(iorder.mm_date); Order o = new OrderImpl(iorder.msecsym, iorder.IsBuyOrder(), iorder.mqty, Convert.ToDecimal(iorder.mprice), Convert.ToDecimal(iorder.mstopprice), "", mdate.Second + mdate.Minute * 100 + mdate.Hour * 10000, mdate.Second + mdate.Minute * 100 + mdate.Hour * 10000, iorder.morderid); tl.newOrder(o); }
private void OnRtnCancel(object sender, OrderArgs e)//将撤单回报分发给各个合约 { AContract contract = Contracts.Find( delegate(AContract c) { return(string.Compare(c.Instrument.InstrumentID, e.Value.InstrumentID) == 0); } ); if (contract != null) { contract.OnRtnCancel(sender, e); } }
private void DefOnRtnCancel(object sender, OrderArgs e) { if (e.Value.Status == OrderStatus.Canceled)//被撤单 { int orderID = e.Value.OrderID; Console.WriteLine(e.Value.OrderID.ToString() + "3秒未成被撤单,开始重下"); InputOrder(dicOrder[orderID].Direction, dicOrder[orderID].Offset, Ticks[0].LastPrice, dicOrder[orderID].VolumeLeft); dicOrder.Remove(e.Value.OrderID); AllowTrade = true; } }
private void DefOnRtnOrder(object sender, OrderArgs e) { Console.WriteLine("收到报单回报:" + e.Value.OrderID + "Status=" + e.Value.Status); System.Threading.Timer timer = new System.Threading.Timer(new System.Threading.TimerCallback(CancelOrder), e.Value.OrderID, 3000, System.Threading.Timeout.Infinite); dicOrder[e.Value.OrderID] = e.Value; if (dicOrder.ContainsKey(e.Value.OrderID) && (e.Value.Status == OrderStatus.Filled))//全部成交 { Console.WriteLine("订单" + e.Value.OrderID + "全部成交"); AllowTrade = true; } }
void _t_OnRtnOrder(object sender, OrderArgs e) { var trade = (Trade)sender; var vap = _dicStra.FirstOrDefault(n => n.Value.StraID == e.Value.Custom.Trim()); if (vap.Value == null) { return; } var stra = vap.Value; var ls = _straOrdersId.GetOrAdd(stra, new List <int>()); if (e.Value.IsLocal && e.Value.Status == OrderStatus.Normal) { //if (_curStra != null) { ls.Add(e.Value.OrderID); } } else if (!stra.IsMarket && e.Value.Status == OrderStatus.Filled) { //另一边未全部成交 var instother = stra.Instrument2; var volother = stra.Volume2; if (e.Value.InstrumentID == stra.Instrument2) { instother = stra.Instrument1; volother = stra.Volume1; } var ofs = trade.DicOrderField.Where(n => ls.IndexOf(n.Key) >= 0 && n.Value.InstrumentID == instother); if (ofs.Sum(n => (n.Value.Volume - n.Value.VolumeLeft)) < volother) { foreach (var v in ofs) { if (v.Value.Status == OrderStatus.Canceled) { continue; } _reSend.Add(v.Key); // 成交后逻辑 // trade.ReqOrderAction(v.Key); } } } }
//订单回报 private void _OnRtnOrder(object sender, OrderArgs e) { while (0 != Interlocked.Exchange(ref BaseStrategy.Locker, 1)) { } OrderField order = e.Value; SubOrder subOrder; if (!orderMap.TryGetValue(order.Custom, out subOrder)) { LogUtils.EnginLog($"订单回报|未找到对应本地单:{order.Custom}\t{order.InstrumentID}\t{order.Direction}\t{order.Offset}\t{order.LimitPrice}\t{order.Volume}"); Interlocked.Exchange(ref BaseStrategy.Locker, 0); return; } syncOrder(order, subOrder); LogUtils.EnginLog($"订单回报:{order.Custom}\t{order.InstrumentID}\t{order.Direction}\t{order.Offset}\t{order.LimitPrice}\t{order.Volume}"); Interlocked.Exchange(ref BaseStrategy.Locker, 0); }
private void CancelResponseHandler(object sender, OrderArgs e) { tl.newCancel(e.ItemOrder.morderid); }
private void CancelResponseHandler(object sender, OrderArgs e) { tl.newCancel(e.ItemOrder.morderid); v(e.ItemOrder.msecsym+" received cancel ack for: " + e.ItemOrder.morderid); }
private void OrderNotifyHandler(object sender, OrderArgs e) { itemOrder iorder = e.ItemOrder; // if (!ls.Contains(iorder.morigtkn)) return; DateTime mdate = ComFucs.GetDate(iorder.mm_date); Order o = new OrderImpl(iorder.msecsym, iorder.IsBuyOrder(), iorder.mqty, Convert.ToDecimal(iorder.mprice), Convert.ToDecimal(iorder.mstopprice), "", mdate.Second + mdate.Minute * 100 + mdate.Hour * 10000, mdate.Second + mdate.Minute * 100 + mdate.Hour * 10000, iorder.morderid); tl.newOrder(o); v(o.symbol + " received order ack for: " + o.ToString()); }
private void CancelResponseHandler(object sender, OrderArgs e) { tl.newCancel(e.ItemOrder.morderid); v(e.ItemOrder.msecsym + " received cancel ack for: " + e.ItemOrder.morderid); }
void trade_OnRtnCancel(object sender, OrderArgs e) { _queueOrderFresh.Enqueue(e.Value.OrderID); //刷新时用 Ring("撤单"); }
private void _t_OnRtnCancel(object sender, OrderArgs e) { Log($"{e.Value.StatusMsg}\t{e.Value.InstrumentID}\t{e.Value.Direction}\t{e.Value.Offset}\t{e.Value.LimitPrice}\t{e.Value.Volume}"); }
private static void OutputResult(object sender, OrderArgs e) { Console.WriteLine("Closed: " + e.Order); }