public void Run() { api = new CTPMDAdapter(); api.OnFrontConnected += new FrontConnected(OnFrontConnected); api.OnFrontDisconnected += new FrontDisconnected(OnFrontDisconnected); api.OnHeartBeatWarning += new HeartBeatWarning(OnHeartBeatWarning); api.OnRspError += new RspError(OnRspError); api.OnRspSubMarketData += new RspSubMarketData(OnRspSubMarketData); api.OnRspUnSubMarketData += new RspUnSubMarketData(OnRspUnSubMarketData); api.OnRspUserLogin += new RspUserLogin(OnRspUserLogin); api.OnRspUserLogout += new RspUserLogout(OnRspUserLogout); api.OnRtnDepthMarketData += new RtnDepthMarketData(OnRtnDepthMarketData); try { api.RegisterFront(FRONT_ADDR); api.Init(); api.Join(); // 阻塞直到关闭或者CTRL+C } catch (Exception e) { Console.WriteLine(e.Message); } finally { api.Release(); } }
public void Release() { if (mdApi != null) { mdApi.Release(); mdApi = null; } }