Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            m_md_spi = new CThostFtdcMdSpi();
            m_md_spi.onFrontConnected        = new FunOnFrontConnected(CThostFtdcMdSpiImpl.FrontConnected);
            m_md_spi.onFrontDisconnected     = new FunOnFrontDisconnected(CThostFtdcMdSpiImpl.FrontDisconnected);
            m_md_spi.onHeartBeatWarning      = new FunOnHeartBeatWarning(CThostFtdcMdSpiImpl.HeartBeatWarning);
            m_md_spi.onRspUserLogin          = new FunOnRspUserLogin(CThostFtdcMdSpiImpl.RspUserLogin);
            m_md_spi.onRspUserLogout         = new FunOnRspUserLogout(CThostFtdcMdSpiImpl.RspUserLogout);
            m_md_spi.onRspError              = new FunOnRspError(CThostFtdcMdSpiImpl.RspError);
            m_md_spi.onRspSubMarketData      = new FunOnRspSubMarketData(CThostFtdcMdSpiImpl.RspSubMarketData);
            m_md_spi.onRspUnSubMarketData    = new FunOnRspUnSubMarketData(CThostFtdcMdSpiImpl.RspUnSubMarketData);
            m_md_spi.onRspQryInstrument      = new FunOnRspQryInstrument(CThostFtdcMdSpiImpl.RspQryInstrument);
            m_md_spi.onRtnDepthMarketData    = new FunOnRtnDepthMarketData(CThostFtdcMdSpiImpl.RtnDepthMarketData);
            m_md_spi.onRtnExchangeStatus     = new FunOnRtnExchangeStatus(CThostFtdcMdSpiImpl.RtnExchangeStatus);
            m_md_spi.onRtnOptionsInfo        = new FunOnRtnOptionsInfo(CThostFtdcMdSpiImpl.RtnOptionsInfo);
            m_md_spi.onRtnTemplateMarketData = new FunOnRtnTemplateMarketData(CThostFtdcMdSpiImpl.RtnTemplateMarketData);

            int size = Marshal.SizeOf(m_md_spi);

            m_md_spi_point = Marshal.AllocHGlobal(size);
            Marshal.StructureToPtr(m_md_spi, m_md_spi_point, true);

            CThostFtdcMdApi.CreateFtdcMdApi_C();
            CThostFtdcMdApi.RegisterSpi(m_md_spi_point);
            CThostFtdcMdApi.RegisterFront("tcp://192.168.1.54:15999");
            CThostFtdcMdApi.Init();
        }
Ejemplo n.º 2
0
 public virtual void RegisterSpi(CThostFtdcMdSpi pSpi)
 {
     CTPMarketCppWrapperPINVOKE.CThostFtdcMdApi_RegisterSpi(swigCPtr, CThostFtdcMdSpi.getCPtr(pSpi));
 }
Ejemplo n.º 3
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CThostFtdcMdSpi obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 4
0
 public virtual void RegisterSpi(CThostFtdcMdSpi pSpi)
 {
     thostmdapiPINVOKE.CThostFtdcMdApi_RegisterSpi(swigCPtr, CThostFtdcMdSpi.getCPtr(pSpi));
 }