Exemple #1
0
        static void test_KingstarGold_Main(string[] args)
        {
            api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\KingstarGold\QuantBox_KingstarGold.dll");

            api.Server.BrokerID = "";
            api.Server.Address  = "tcp://124.74.239.38:18961";

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

            api.OnConnectionStatus   = OnConnectionStatus;
            api.OnRtnDepthMarketData = OnRtnDepthMarketData;

            api.Connect();

            Console.ReadKey();
            api.Subscribe("IF1411", "");

            Console.ReadKey();

            api.Dispose();

            Console.ReadKey();

            Console.ReadKey();
        }
Exemple #2
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 = 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("IF000;IF_WI;IF_IH_1803;IF888", "");

            Console.ReadKey();
            Thread.Sleep(1000 * 1000);

            api.Dispose();

            Thread.Sleep(5 * 1000);
        }
Exemple #3
0
        static void test_CTP_Main(string[] args)
        {
            Type type = Type.GetType("XAPI.Callback.XApi, XAPI_CSharp");
            var  a    = (IXApi)Activator.CreateInstance(type, @"d:\Users\Kan\Documents\GitHub\XAPI3\bin\Debug64\x64\CTP_SE\CTP_SE_Quote_x64.dll");

            api = a;

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

            api.Connect(
                @"d:\Users\Kan\Documents\GitHub\XAPI3\bin\Debug64\x64\CTP_SE\md_1.json",
                @"d:\Users\Kan\Documents\GitHub\XAPI3\bin\Debug64\x64\CTP_SE\md_2.json",
                Path.GetTempPath());
            Thread.Sleep(3 * 1000);
            api.Subscribe("IF2103", "");

            Console.ReadKey();
            Thread.Sleep(1000 * 1000);

            api.Dispose();

            Thread.Sleep(5 * 1000);
        }
Exemple #4
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);
        }
 public void Subscribe(string instrument, string exchange, InstrumentType type)
 {
     _api.Subscribe(instrument, exchange, type);
 }