Ejemplo n.º 1
0
        /// <summary>
        /// 成交回报
        /// </summary>
        /// <param name="pTrade"></param>
        public void HandleOnRtnTrade(ThostFtdcTradeField pTrade)
        {
            var trade = new TradeData();

            ///成交推送
            this.Gateway.MainController.MainEvent._OnTrade.Invoke(trade);
        }
Ejemplo n.º 2
0
 public static string ToString2(this ThostFtdcTradeField field)
 {
     return(string.Format("OrderRef:{0},{1}, {2} {3} {4} {5}",
                          field.OrderRef,
                          field.UserID,
                          field.Direction,
                          field.Volume,
                          field.InstrumentID,
                          field.Price
                          ));
 }
Ejemplo n.º 3
0
        public override void OnRtnTrade(ThostFtdcTradeField pTrade)
        {
            var trade = new Trade
            {
                InstrumentID = pTrade.InstrumentID,
                UserID       = pTrade.UserID,
                Direction    = (DirectionType)pTrade.Direction,
                OffsetFlag   = (OffsetFlag)pTrade.OffsetFlag,
                Price        = pTrade.Price,
                Volume       = pTrade.Volume,
                TradeTime    = DateTimeHelper.GenerateTime(pTrade.TradeDate, pTrade.TradeTime),
            };

            TradeRecordViewModel.Instance.AddTrade(trade);
        }
Ejemplo n.º 4
0
        ///成交通知
        private void OnRtnTrade(ThostFtdcTradeField pTrade)
        {
            __DEBUGPF__();

            // 更新成交回报信息
            CustomTrade customTrade = new CustomTrade();

            customTrade.tradeRef     = pTrade.ExchangeID + "_" + pTrade.OrderSysID;         // 成交回报的唯一编号
            customTrade.InstrumentID = pTrade.InstrumentID;
            customTrade.Direction    = (pTrade.Direction == EnumDirectionType.Buy) ? BS_CODE.Buy : BS_CODE.Sell;
            customTrade.OffsetFlag   = (pTrade.OffsetFlag == EnumOffsetFlagType.Open) ? OC_CODE.Open : OC_CODE.Close;
            customTrade.TradePrice   = pTrade.Price;
            customTrade.TradeVol     = pTrade.Volume;
            customTrade.TradeTime    = pTrade.TradeTime;

            // 处理成交回报
            if (HandleRtnTradeDel != null)
            {
                //HandleRtnTradeDel.BeginInvoke(customTrade, null, null);
                HandleRtnTradeDel(customTrade);
            }
        }
Ejemplo n.º 5
0
        ///成交通知
        private void OnRtnTrade(ThostFtdcTradeField pTrade)
        {
            __DEBUGPF__();

            // 更新成交回报信息
            CustomTrade customTrade = new CustomTrade();

            customTrade.tradeRef     = pTrade.ExchangeID + "_" + pTrade.OrderSysID;         // 成交回报的唯一编号
            customTrade.InstrumentID = pTrade.InstrumentID;
            customTrade.Direction    = pTrade.Direction;
            customTrade.OffsetFlag   = pTrade.OffsetFlag;
            customTrade.TradePrice   = pTrade.Price;
            customTrade.TradeVol     = pTrade.Volume;
            customTrade.TradeTime    = pTrade.TradeTime;

            // 处理成交回报
            if (HandleRtnTradeDel != null)
            {
                //HandleRtnTradeDel.BeginInvoke(customTrade, null, null);
                HandleRtnTradeDel(customTrade);
            }
        }
Ejemplo n.º 6
0
 ///成交通知
 void OnRtnTrade(ThostFtdcTradeField pTrade)
 {
     __DEBUGPF__();
 }
Ejemplo n.º 7
0
 private void TraderAdapter_OnRspQryTrade(ThostFtdcTradeField pTrade, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
 }
Ejemplo n.º 8
0
 ///成交通知
 public void OnRtnTrade(ThostFtdcTradeField pTrade)
 {
     cMainForm.SetTDOnRtnTrade((object)pTrade);
 }
Ejemplo n.º 9
0
 ///请求查询成交响应
 public void OnRspQryTrade(ThostFtdcTradeField pTrade, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     if (!IsErrorRspInfo(pRspInfo))
     {
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 成交通知
 /// </summary>
 /// <param name="pTrade"></param>
 void OnRtnTrade(ThostFtdcTradeField pTrade)
 {
     DebugPrintFunc(new StackTrace());
 }
Ejemplo n.º 11
0
 private void TraderAdapter_OnRtnTrade(ThostFtdcTradeField pTrade)
 {
 }
Ejemplo n.º 12
0
 ///成交通知
 void OnRtnTrade(ThostFtdcTradeField pTrade)
 {
     DebugPrintFunc(new StackTrace());
 }
Ejemplo n.º 13
0
 private string GetOrderKey(ThostFtdcTradeField pTrade)
 {
     return(string.Format("{0}:{1}", pTrade.ExchangeID, pTrade.OrderSysID));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 判断成交单是否是我的报单
 /// </summary>
 /// <param name="pOrder"></param>
 /// <param name="pTrade"></param>
 /// <returns></returns>
 private bool IsMyTrade(ThostFtdcOrderField pOrder, ThostFtdcTradeField pTrade)
 {
     return (pTrade != null && pOrder != null && (pTrade.OrderRef == pOrder.OrderRef) &&
             (pTrade.BrokerID == pOrder.BrokerID) && (pTrade.BrokerOrderSeq == pOrder.BrokerOrderSeq) &&
             (pTrade.ExchangeID == pOrder.ExchangeID) && (pTrade.TraderID == pOrder.TraderID) &&
             (pTrade.OrderLocalID == pOrder.OrderLocalID) && (pTrade.OrderSysID == pOrder.OrderSysID));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 成交回报
 /// </summary>
 /// <param name="pTrade"></param>
 public void OnRtnTrade(ThostFtdcTradeField pTrade)
 {
     //if (IsMyTrade(CurrentOrder, pTrade))
     //{
     //    if (OrderQuoteIndexMap.ContainsKey(pTrade.OrderSysID))
     //    {
     //        pTrade.OrderSysID = OrderQuoteIndexMap[pTrade.OrderSysID];
     //        this.OnQuoteTraded(this, new RtnTradeEventArgs(pTrade));
     //    }
     //    else
     //    {
     //        this.OnArbitrageTraded(this, new RtnTradeEventArgs(pTrade));
     //    }
     //}
     if (OrderSysID2QuoteRefMap.ContainsKey(pTrade.OrderSysID))
     {
         pTrade.OrderSysID = OrderSysID2QuoteRefMap[pTrade.OrderSysID];
         this.OnQuoteTraded(this, new RtnTradeEventArgs(pTrade));
     }
     else
     {
         this.OnArbitrageTraded(this, new RtnTradeEventArgs(pTrade));
     }
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 报价被成交
 /// </summary>
 /// <param name="order"></param>
 public void OnQuoteTraded(ThostFtdcTradeField trade)
 {
     if (this.QuoteTraded != null)
     {
         this.QuoteTraded(this, new RtnTradeEventArgs(trade));
     }
 }
Ejemplo n.º 17
0
 /// <summary>
 /// 套利被成交
 /// </summary>
 /// <param name="order"></param>
 public void OnArbitrageTraded(ThostFtdcTradeField order)
 {
     if (this.ArbitrageTraded != null)
     {
         this.ArbitrageTraded(this, new RtnTradeEventArgs(order));
     }
 }
Ejemplo n.º 18
0
 public override void OnRtnTrade(ThostFtdcTradeField pTrade)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 构造一个新实例
 /// </summary>
 /// <param name="MarketData">报单信息</param>
 public RtnTradeEventArgs(ThostFtdcTradeField tradeField)
 {
     this.tradeField = tradeField;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 构造一个新实例
 /// </summary>
 /// <param name="MarketData">报单信息</param>
 /// <param name="Tag">关联数据</param>
 public RtnTradeEventArgs(ThostFtdcTradeField tradeField, object Tag)
 {
     this.tradeField = tradeField;
     this.tag = Tag;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 交易查询应答
 /// </summary>
 /// <param name="pTrade"></param>
 /// <param name="pRspInfo"></param>
 /// <param name="nRequestID"></param>
 /// <param name="bIsLast"></param>
 void OnRspQryTrade(ThostFtdcTradeField pTrade, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     DebugPrintFunc(new StackTrace());
     if (bIsLast && !IsErrorRspInfo(pRspInfo))
     {
         //请求查询投资者
         ReqQryInvestor();
     }
 }
Ejemplo n.º 22
0
 public override void OnRtnTrade(ThostFtdcTradeField pTrade)
 {
     var trade = new Trade
     {
         InstrumentID = pTrade.InstrumentID,
         UserID = pTrade.UserID,
         Direction = (DirectionType)pTrade.Direction,
         OffsetFlag = (OffsetFlag)pTrade.OffsetFlag,
         Price = pTrade.Price,
         Volume = pTrade.Volume,
         TradeTime = DateTimeHelper.GenerateTime(pTrade.TradeDate, pTrade.TradeTime),
     };
     TradeRecordViewModel.Instance.AddTrade(trade);
 }
Ejemplo n.º 23
0
 public override void OnRtnTrade(ThostFtdcTradeField pTrade)
 {
     throw new NotImplementedException();
 }