Exemple #1
0
        public MdApiExsample()
        {
            MdapiClr_ = MdapiClr.GetInstance();
            var path = $"{ Path.GetFullPath(".")}\\mdApiConPath\\";
            ///设置回调函数的绑定
            OnFrontConnectedDelegate     onConnectDelegate    = OnFrontConnected_;
            OnFrontDisconnectedDelegate  onDisConnectDelegate = OnFrontDisconnected_;
            OnRspUserLoginDelegate       onLoginDelegate      = OnRspUserLogin_;
            OnRspUserLogoutDelegate      onLogoutDelegate     = OnRspUserLogout_;
            OnRspErrorDelegate           onErrorDelegate      = OnRspError_;
            OnRtnDepthMarketDataDelegate onMarketDataDelegate = OnRtnDepthMarketData_;

            MdapiClr_.SetOnFrontConnectedDelegate(onConnectDelegate);
            MdapiClr_.SetOnFrontDisConnectedDelegate(onDisConnectDelegate);
            MdapiClr_.SetOnRspUserLoginDelegate(onLoginDelegate);
            MdapiClr_.SetOnRspUserLogoutDelegate(onLogoutDelegate);
            MdapiClr_.SetOnRspErrorDelegate(onErrorDelegate);
            MdapiClr_.SetOnRtnDepthMarketDataDelegate(onMarketDataDelegate);
            unsafe
            {
                var p = PIntPtrData.GetIntPtrString(path);
                MdapiClr_.CreateCenter();
                MdapiClr_.CreateMdApi_(p);
            }
        }
 public static extern void RegisterOnRtnDepthMarketDataCallback(IntPtr phandler, [MarshalAs(UnmanagedType.FunctionPtr)] OnRtnDepthMarketDataDelegate callback);