Пример #1
0
        static void test_CTP_Main(string[] args)
        {
            Type type = Type.GetType("XAPI.Callback.XApi, XAPI_CSharp");
            var  a    = (IXApi)Activator.CreateInstance(type, @"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\x86\CTP\CTP_Quote_x86.dll");

            //api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP\x86\QuantBox_CTP_Quote.dll");

            //api.Server.BrokerID = "1017";
            //api.Server.Address = "tcp://ctpmn1-front1.citicsf.com:51213";
            //api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\x86\CTP\CTP_Trade_x86.dll");
            api = a;

            api.Server.BrokerID = "9999";
            api.Server.Address  = "tcp://180.168.146.187:10010";
            api.Server.PrivateTopicResumeType = ResumeType.Undefined;

            api.User.UserID   = "037505";
            api.User.Password = "******";

            api.OnConnectionStatus     = OnConnectionStatus;
            api.OnRtnDepthMarketData   = OnRtnDepthMarketData;
            api.OnRspQryInstrument     = OnRspQryInstrument;
            api.OnRspQrySettlementInfo = OnRspQrySettlementInfo;

            api.Connect();
            Thread.Sleep(3 * 1000);
            api.Subscribe("IF1802;au1806;au000;IF000", "");

            Console.ReadKey();
            api.Unsubscribe("au1806", "");
            Console.ReadKey();
            api.Unsubscribe("au000", "");
            Console.ReadKey();
            api.Unsubscribe("au1806", "");
            Console.ReadKey();


            api.Subscribe("au1806;au000", "");
            Console.ReadKey();
            api.Unsubscribe("au000", "");
            Console.ReadKey();
            Thread.Sleep(1000 * 1000);

            api.Dispose();

            Thread.Sleep(5 * 1000);
        }
Пример #2
0
 public void Unsubscribe(string instrument, string exchange, InstrumentType type)
 {
     _api.Unsubscribe(instrument, exchange, type);
 }