Пример #1
0
 private void InitNativeCallback()
 {
     _cbOnFrontConnected = NativeOnFrontConnected;
     CtpMdNative.SetOnFrontConnected(_instance, _cbOnFrontConnected);
     _cbOnFrontDisconnected = NativeOnFrontDisconnected;
     CtpMdNative.SetOnFrontDisconnected(_instance, _cbOnFrontDisconnected);
     _cbOnHeartBeatWarning = NativeOnHeartBeatWarning;
     CtpMdNative.SetOnHeartBeatWarning(_instance, _cbOnHeartBeatWarning);
     _cbOnRspUserLogin = NativeOnRspUserLogin;
     CtpMdNative.SetOnRspUserLogin(_instance, _cbOnRspUserLogin);
     _cbOnRspUserLogout = NativeOnRspUserLogout;
     CtpMdNative.SetOnRspUserLogout(_instance, _cbOnRspUserLogout);
     _cbOnRspError = NativeOnRspError;
     CtpMdNative.SetOnRspError(_instance, _cbOnRspError);
     _cbOnRspSubMarketData = NativeOnRspSubMarketData;
     CtpMdNative.SetOnRspSubMarketData(_instance, _cbOnRspSubMarketData);
     _cbOnRspUnSubMarketData = NativeOnRspUnSubMarketData;
     CtpMdNative.SetOnRspUnSubMarketData(_instance, _cbOnRspUnSubMarketData);
     _cbOnRspSubForQuoteRsp = NativeOnRspSubForQuoteRsp;
     CtpMdNative.SetOnRspSubForQuoteRsp(_instance, _cbOnRspSubForQuoteRsp);
     _cbOnRspUnSubForQuoteRsp = NativeOnRspUnSubForQuoteRsp;
     CtpMdNative.SetOnRspUnSubForQuoteRsp(_instance, _cbOnRspUnSubForQuoteRsp);
     _cbOnRtnDepthMarketData = NativeOnRtnDepthMarketData;
     CtpMdNative.SetOnRtnDepthMarketData(_instance, _cbOnRtnDepthMarketData);
     _cbOnRtnForQuoteRsp = NativeOnRtnForQuoteRsp;
     CtpMdNative.SetOnRtnForQuoteRsp(_instance, _cbOnRtnForQuoteRsp);
 }
Пример #2
0
 public void Release()
 {
     if (_instance == IntPtr.Zero)
     {
         return;
     }
     CtpMdNative.Release(_instance);
     _instance = IntPtr.Zero;
 }
Пример #3
0
 private void InitApi(string flowPath)
 {
     _instance = CtpMdNative.Create(flowPath);
 }
Пример #4
0
 ///登出请求
 public int ReqUserLogout(CtpUserLogout userLogout, int requestId)
 {
     return(CtpMdNative.ReqUserLogout(_instance, userLogout, requestId));
 }
Пример #5
0
 ///用户登录请求
 public int ReqUserLogin(CtpReqUserLogin reqUserLoginField, int requestId)
 {
     return(CtpMdNative.ReqUserLogin(_instance, reqUserLoginField, requestId));
 }
Пример #6
0
 ///退订询价。
 ///@param ppInstrumentID 合约ID
 ///@param nCount 要订阅/退订行情的合约个数
 ///@remark
 public int UnSubscribeForQuoteRsp(string[] instrumentID, int count)
 {
     return(CtpMdNative.UnSubscribeForQuoteRsp(_instance, instrumentID, count));
 }
Пример #7
0
 ///退订行情。
 ///@param ppInstrumentID 合约ID
 ///@param nCount 要订阅/退订行情的合约个数
 ///@remark
 public int UnSubscribeMarketData(string[] instrumentID, int count)
 {
     return(CtpMdNative.UnSubscribeMarketData(_instance, instrumentID, count));
 }
Пример #8
0
 ///注册名字服务器网络地址
 ///@param pszNsAddress:名字服务器网络地址。
 ///@remark 网络地址的格式为:“protocol://ipaddress:port”,如:”tcp://127.0.0.1:12001”。
 ///@remark “tcp”代表传输协议,“127.0.0.1”代表服务器地址。”12001”代表服务器端口号。
 ///@remark RegisterNameServer优先于RegisterFront
 public void RegisterNameServer(string nsAddress)
 {
     CtpMdNative.RegisterNameServer(_instance, nsAddress);
 }
Пример #9
0
 ///注册前置机网络地址
 ///@param pszFrontAddress:前置机网络地址。
 ///@remark 网络地址的格式为:“protocol://ipaddress:port”,如:”tcp://127.0.0.1:17001”。
 ///@remark “tcp”代表传输协议,“127.0.0.1”代表服务器地址。”17001”代表服务器端口号。
 public void RegisterFront(string frontAddress)
 {
     CtpMdNative.RegisterFront(_instance, frontAddress);
 }
Пример #10
0
 ///获取当前交易日
 ///@retrun 获取到的交易日
 ///@remark 只有登录成功后,才能得到正确的交易日
 public string GetTradingDay()
 {
     return(CtpMdNative.GetTradingDay(_instance));
 }
Пример #11
0
 public int Join()
 {
     return(CtpMdNative.Join(_instance));
 }
Пример #12
0
 public void Init()
 {
     CtpMdNative.Init(_instance);
 }
Пример #13
0
        private int DoReqUserLogout(ref CtpRequest req)
        {
            var data = req.Args.AsUserLogout;

            return(CtpMdNative.ReqUserLogout(_instance, data, req.RequestID));
        }
Пример #14
0
        private int DoUnSubscribeForQuoteRsp(ref CtpRequest req)
        {
            var data = req.Args.AsStringArray;

            return(CtpMdNative.UnSubscribeForQuoteRsp(_instance, data, data.Length));
        }
Пример #15
0
        private int DoSubscribeMarketData(ref CtpRequest req)
        {
            var data = req.Args.AsStringArray;

            return(CtpMdNative.SubscribeMarketData(_instance, data, data.Length));
        }
Пример #16
0
 ///注册名字服务器用户信息
 ///@param fensUserInfo:用户信息。
 public void RegisterFensUserInfo(CtpFensUserInfo fensUserInfo)
 {
     CtpMdNative.RegisterFensUserInfo(_instance, fensUserInfo);
 }