Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        public ExsampleTdCTPApi()
        {
            tdApi = TdApiClr.GetInstance();
            var path = $"{ Path.GetFullPath(".")}\\tdApiConPath\\";

            tdApi.CreateCenter();
            unsafe { tdApi.CreateTdApi_(PIntPtrData.GetIntPtrString(path)); }

            OnFrontConnectedDelegate    onFrontConnectDelegate      = OnFrontConnected_;
            OnFrontDisconnectedDelegate onFrontDisconnectedDelegate = OnFrontDisconnected_;
            OnAuthenticateDelegate      onAuthenticateDelegate      = OnRspAuthenticate_;
            OnRspUserLoginDelegate      onRspUserLoginDelegate      = OnRspUserLogin_;
            OnRspUserLogoutDelegate     onRspUserLogoutDelegate     = OnRspUserLogout_;
            OnRspErrorDelegate          onRspErrorDelegate          = OnRspError_;

            //OnRspOrderInsertDelegate(OrderInsert^ orderInsert, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspOrderActionDelegate(OrderAction^ orderAction, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspSettlementInfoConfirmDelegate(RspSettlementInfoConfirm^ settelment, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspQuoteInsertDelegate(RspInputQuoteField^ inputQuote, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspQuoteActionDelegate(RspQuoteActionField^ action, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspQryInvestorPositionDelegate(RspInvestorPositionField^ investorPosition, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspQryTradingAccountDelegate(RspTradingAccountField^ tradingAccount, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspQryInvestorDelegate(RspInvestorField^ investor, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspQryInstrumentDelegate(RspInstrumentField^ code, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspQrySettlementInfoDelegate(RspSettlementInfoField^ settlementInfo, ErrorInfo^ pRspInfo, int pResquesID, bool bIsLast);
            //OnRspQryInvestorPositionDetailDelegate(RspInvestorPositionDelailField^ investorPositionDelail, ErrorInfo^ pRspInfo, int pRequestID, bool bIsLast);
            //OnRspQrySettlementInfoConfirmDelegate(RspSettlementInfoConfirm^ settelment, ErrorInfo^ pRspInfo, int nRequestID, bool bIsLast);
            //OnRspQryInvestorPositionCombineDetailDelegate(RspInvestorPositionCombineDetailField^ investorPositionCombineDetail, ErrorInfo^ pRequestID, int nRequestID, bool bIsLast);
            //OnRtnOrderDelegate(RtnOrderField^ rtnOrder);
            //OnRtnTradeDelegate(RtnTradeField^ rtnTrade);
            tdApi.SetOnFrontConnectedDelegate(onFrontConnectDelegate);
            tdApi.SetOnFrontDisconnectedDelegate(onFrontDisconnectedDelegate);
            tdApi.SetOnRspErrorDelegate(onRspErrorDelegate);
            tdApi.SetAuthenDelegate(onAuthenticateDelegate);
            tdApi.SetOnRspUserLoginDelegate(onRspUserLoginDelegate);
            tdApi.SetOnRspUserLogoutDelegate(onRspUserLogoutDelegate);
        }
Ejemplo n.º 3
0
 public static extern void RegisterOnFrontConnectedCallback(IntPtr phandler, [MarshalAs(UnmanagedType.FunctionPtr)] OnFrontConnectedDelegate callback);