public static void TDCreate() { if (g_hTDClient == IntPtr.Zero) { onconnected = new lpOnConnectedParam(OnConnected); ondisconnected = new lpOnDisconnectedParam(OnDisconnected); onheartbeatwarning = new lpOnHeartBeatWarningParam(OnHeartBeatWarning); oninterrupted = new lpOnInterruptedParam(OnInterrupted); onrspuserlogin = new lpOnRspUserLoginParam(OnRspUserLogin); onrspuserlogout = new lpOnRspUserLogoutParam(OnRspUserLogout); onrspqryinstrument = new lpOnRspQryInstrumentParam(OnRspQryInstrument); onrspqryholding = new lpOnRspQryHoldingParam(OnRspQryHolding); onrspqrycash = new lpOnRspQryCashParam(OnRspQryCash); onrspqryorderstoday = new lpOnRspQryOrdersTodayParam(OnRspQryOrdersToday); onrspqrydealstoday = new lpOnRspQryDealsTodayParam(OnRspQryDealsToday); onrtnorder = new lpOnRtnOrderParam(OnRtnOrder); onrtndeal = new lpOnRtnDealParam(OnRtnDeal); onrtnholding = new lpOnRspQryHoldingParam(OnRtnHolding); onrtncash = new lpOnRspQryCashParam(OnRtnCash); onrsperror = new lpOnRspErrorParam(OnRspError); g_hTDClient = WinfairTdApi_CreateWinfairTdApi(Marshal.StringToHGlobalAnsi("MyClient")); WinfairTdApi_SetTdApiCallback(g_hTDClient, IntPtr.Zero, onconnected, ondisconnected, onheartbeatwarning, oninterrupted, onrspuserlogin, onrspuserlogout, onrspqryinstrument, onrspqryholding, onrspqrycash, onrspqryorderstoday, onrspqrydealstoday, onrtnorder, onrtndeal, onrtnholding, onrtncash, onrsperror); if (g_hTDClient != IntPtr.Zero) { Str_log = Str_log + "\nAPI Created"; } } else { // Console.WriteLine("API Already Created"); } }
public extern static void WinfairTdApi_SetTdApiCallback(IntPtr hClient, IntPtr pContex, lpOnConnectedParam pfnConnected, lpOnDisconnectedParam pfnDisconnected, lpOnHeartBeatWarningParam pfnHeartBeatWarning, lpOnInterruptedParam pfnInterrupted, lpOnRspUserLoginParam pfnRspUserLogin, lpOnRspUserLogoutParam pfnRspUserLogout, lpOnRspQryInstrumentParam pfnRspQryInstrument, lpOnRspQryHoldingParam pfnRspQryHolding, lpOnRspQryCashParam pfnRspQryCash, lpOnRspQryOrdersTodayParam pfnRspQryOrdersToday, lpOnRspQryDealsTodayParam pfnRspQryDealsToday, lpOnRtnOrderParam pfnRtnOrder, lpOnRtnDealParam pfnRtnDeal, lpOnRspQryHoldingParam pfnRtnHolding, lpOnRspQryCashParam pfnRtnCash, lpOnRspErrorParam pfnRspError);