Exemple #1
0
        private void On_SubscribeReceived(NetMQMessage message)
        {
            int count = message.FrameCount;

            if (count < 3)
            {
                return;
            }

            string accountNo = message.Pop().ConvertToString();
            var    msgHeader = message.Pop().ToByteArray();
            var    payload   = message.Pop();

            ReportHeader header = ReportHeader.Parser.ParseFrom(msgHeader);

            if (header.ApiId == ID_STOCK_PLACE_REPORT)
            {
                PlacedReport report = PlacedReport.Parser.ParseFrom(payload.ToByteArray());
                PlaceReportReceived?.Invoke(accountNo, header, report);
            }
            else if (header.ApiId == ID_STOCK_FILL_REPORT)
            {
                FillReport report = FillReport.Parser.ParseFrom(payload.ToByteArray());
                FillReportReceived?.Invoke(accountNo, header, report);
            }
            else if (header.ApiId == ID_STOCK_CANCEL_REPORT)
            {
                CancellationReport report = CancellationReport.Parser.ParseFrom(payload.ToByteArray());
                CancelReportReceived?.Invoke(accountNo, header, report);
            }
        }
Exemple #2
0
        private void On_CancelReportReceived(string accountNo, ReportHeader header, CancellationReport report)
        {
            string log = string.Format("{0} 账号:{1} {2} 券:{3} 数量:{4,6} 撤消:{6,6}. 单号:{7,10}, 原号:{8,10}. 成交:{5, 6}. {9} ",
                                       report.Status, report.AccountNo, report.OrderSide, report.Code, report.Quantity,
                                       report.TotalFillQuantity, report.CancelledQuantity,
                                       report.OrderExchangeId, report.OrderOriginalId, header.Message);

            BeginInvoke(new MethodInvoker(() => { WriteReport(log); }));
        }
Exemple #3
0
 private void On_Trade_Cancel(string accountNo, ReportHeader header, CancellationReport report)
 {
     BeginInvoke(new MethodInvoker(() =>
     {
         TradeMessage.Text =
             string.Format("撤单 {0} {1} {2} {3}",
                           report.Code,
                           report.Quantity,
                           report.CancelledQuantity,
                           DateTime.Now.ToString("HH:mm:ss.fff"));
     }));
 }