Exemplo n.º 1
0
        ///当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
        private void NativeOnFrontConnected()
        {
            var rsp = new CtpResponse();

            rsp.TypeId = CtpResponseType.OnFrontConnected;
            ProcessResponse(ref rsp);
        }
Exemplo n.º 2
0
        ///深度行情通知
        private void NativeOnRtnDepthMarketData(CtpDepthMarketData depthMarketData)
        {
            var rsp = new CtpResponse();

            rsp.TypeId = CtpResponseType.OnRtnDepthMarketData;
            rsp.Item1  = new CtpAny(depthMarketData);
            ProcessResponse(ref rsp);
        }
Exemplo n.º 3
0
        ///询价通知
        private void NativeOnRtnForQuoteRsp(CtpForQuoteRsp forQuoteRsp)
        {
            var rsp = new CtpResponse();

            rsp.TypeId = CtpResponseType.OnRtnForQuoteRsp;
            rsp.Item1  = new CtpAny(forQuoteRsp);
            ProcessResponse(ref rsp);
        }
Exemplo n.º 4
0
        ///当客户端与交易后台通信连接断开时,该方法被调用。当发生这个情况后,API会自动重新连接,客户端可不做处理。
        ///@param nReason 错误原因
        ///        0x1001 网络读失败
        ///        0x1002 网络写失败
        ///        0x2001 接收心跳超时
        ///        0x2002 发送心跳失败
        ///        0x2003 收到错误报文
        private void NativeOnFrontDisconnected(int reason)
        {
            var rsp = new CtpResponse();

            rsp.TypeId = CtpResponseType.OnFrontDisconnected;
            rsp.Item1  = new CtpAny(reason);
            ProcessResponse(ref rsp);
        }
Exemplo n.º 5
0
        ///心跳超时警告。当长时间未收到报文时,该方法被调用。
        ///@param nTimeLapse 距离上次接收报文的时间
        private void NativeOnHeartBeatWarning(int timeLapse)
        {
            var rsp = new CtpResponse();

            rsp.TypeId = CtpResponseType.OnHeartBeatWarning;
            rsp.Item1  = new CtpAny(timeLapse);
            ProcessResponse(ref rsp);
        }
Exemplo n.º 6
0
        private void DoRspError(ref CtpResponse rsp)
        {
            var handler = OnRspError;

            if (handler != null)
            {
                handler(this, rsp.Item1.AsRspInfo, rsp.RequestID, rsp.IsLast);
            }
        }
Exemplo n.º 7
0
        private void DoRspUserLogout(ref CtpResponse rsp)
        {
            var handler = OnRspUserLogout;

            if (handler != null)
            {
                handler(this, rsp.Item1.AsUserLogout, rsp.Item2, rsp.RequestID, rsp.IsLast);
            }
        }
Exemplo n.º 8
0
        private void DoRtnDepthMarketData(ref CtpResponse rsp)
        {
            var handler = OnRtnDepthMarketData;

            if (handler != null)
            {
                handler(this, rsp.Item1.AsDepthMarketData);
            }
        }
Exemplo n.º 9
0
        private void DoRspSubMarketData(ref CtpResponse rsp)
        {
            var handler = OnRspSubMarketData;

            if (handler != null)
            {
                handler(this, rsp.Item1.AsSpecificInstrument, rsp.Item2, rsp.RequestID, rsp.IsLast);
            }
        }
Exemplo n.º 10
0
        private void DoRspUnSubForQuoteRsp(ref CtpResponse rsp)
        {
            var handler = OnRspUnSubForQuoteRsp;

            if (handler != null)
            {
                handler(this, rsp.Item1.AsSpecificInstrument, rsp.Item2, rsp.RequestID, rsp.IsLast);
            }
        }
Exemplo n.º 11
0
        private void DoRtnForQuoteRsp(ref CtpResponse rsp)
        {
            var handler = OnRtnForQuoteRsp;

            if (handler != null)
            {
                handler(this, rsp.Item1.AsForQuoteRsp);
            }
        }
Exemplo n.º 12
0
        private void DoFrontConnected(ref CtpResponse rsp)
        {
            var handler = OnFrontConnected;

            if (handler != null)
            {
                handler(this);
            }
        }
Exemplo n.º 13
0
        private void DoFrontDisconnected(ref CtpResponse rsp)
        {
            var handler = OnFrontDisconnected;

            if (handler != null)
            {
                handler(this, rsp.Item1.AsInt.Value);
            }
        }
Exemplo n.º 14
0
        private void DoHeartBeatWarning(ref CtpResponse rsp)
        {
            var handler = OnHeartBeatWarning;

            if (handler != null)
            {
                handler(this, rsp.Item1.AsInt.Value);
            }
        }
Exemplo n.º 15
0
        ///错误应答
        private void NativeOnRspError(CtpRspInfo rspInfo, int requestId, bool isLast)
        {
            var rsp = new CtpResponse();

            rsp.TypeId    = CtpResponseType.OnRspError;
            rsp.Item1     = new CtpAny(rspInfo);
            rsp.RequestID = requestId;
            rsp.IsLast    = isLast;
            ProcessResponse(ref rsp);
        }
Exemplo n.º 16
0
        ///登出请求响应
        private void NativeOnRspUserLogout(CtpUserLogout userLogout, CtpRspInfo rspInfo, int requestId, bool isLast)
        {
            var rsp = new CtpResponse();

            rsp.TypeId    = CtpResponseType.OnRspUserLogout;
            rsp.Item1     = new CtpAny(userLogout);
            rsp.Item2     = rspInfo;
            rsp.RequestID = requestId;
            rsp.IsLast    = isLast;
            ProcessResponse(ref rsp);
        }
Exemplo n.º 17
0
        ///取消订阅询价应答
        private void NativeOnRspUnSubForQuoteRsp(CtpSpecificInstrument specificInstrument, CtpRspInfo rspInfo, int requestId, bool isLast)
        {
            var rsp = new CtpResponse();

            rsp.TypeId    = CtpResponseType.OnRspUnSubForQuoteRsp;
            rsp.Item1     = new CtpAny(specificInstrument);
            rsp.Item2     = rspInfo;
            rsp.RequestID = requestId;
            rsp.IsLast    = isLast;
            ProcessResponse(ref rsp);
        }
Exemplo n.º 18
0
        public override void ProcessResponse(ref CtpResponse rsp)
        {
            switch (rsp.TypeId)
            {
            case CtpResponseType.Response:
            case CtpResponseType.Max:
                break;

            default:
                RspHandlerList[rsp.TypeId](ref rsp);
                break;
            }
        }
Exemplo n.º 19
0
        private void DoRspError(ref CtpResponse rsp)
        {
            var handler = OnRspError;

            handler?.Invoke(this, rsp.Item1.AsRspInfo, rsp.RequestID, rsp.IsLast);
        }
Exemplo n.º 20
0
        private void DoRspSubForQuoteRsp(ref CtpResponse rsp)
        {
            var handler = OnRspSubForQuoteRsp;

            handler?.Invoke(this, rsp.Item1.AsSpecificInstrument, rsp.Item2, rsp.RequestID, rsp.IsLast);
        }
Exemplo n.º 21
0
        private void DoRtnDepthMarketData(ref CtpResponse rsp)
        {
            var handler = OnRtnDepthMarketData;

            handler?.Invoke(this, rsp.Item1.AsDepthMarketData);
        }
Exemplo n.º 22
0
        private void DoRtnForQuoteRsp(ref CtpResponse rsp)
        {
            var handler = OnRtnForQuoteRsp;

            handler?.Invoke(this, rsp.Item1.AsForQuoteRsp);
        }
Exemplo n.º 23
0
        private void DoFrontConnected(ref CtpResponse rsp)
        {
            var handler = OnFrontConnected;

            handler?.Invoke(this);
        }
Exemplo n.º 24
0
        private void DoFrontDisconnected(ref CtpResponse rsp)
        {
            var handler = OnFrontDisconnected;

            handler?.Invoke(this, rsp.Item1.AsInt.Value);
        }
Exemplo n.º 25
0
        private void DoRspUserLogout(ref CtpResponse rsp)
        {
            var handler = OnRspUserLogout;

            handler?.Invoke(this, rsp.Item1.AsUserLogout, rsp.Item2, rsp.RequestID, rsp.IsLast);
        }
Exemplo n.º 26
0
        private void DoHeartBeatWarning(ref CtpResponse rsp)
        {
            var handler = OnHeartBeatWarning;

            handler?.Invoke(this, rsp.Item1.AsInt.Value);
        }
Exemplo n.º 27
0
        private void DoRspUnSubMarketData(ref CtpResponse rsp)
        {
            var handler = OnRspUnSubMarketData;

            handler?.Invoke(this, rsp.Item1.AsSpecificInstrument, rsp.Item2, rsp.RequestID, rsp.IsLast);
        }