示例#1
0
 public static XApi CreateApi(string path)
 {
     lock (locker)
     {
         Queue queue = new Queue(QueuePath);
         XApi api = new XApi(path, new Queue(QueuePath));
         dict.TryAdd(api, queue);
         return api;
     }
 }
示例#2
0
        internal BaseApi(string path1,Queue queue)
        {
            _Path1 = path1;
            
            // 这里是因为回调函数可能被GC回收
            _XRespone = _OnRespone;
            _Queue = queue;

            ReconnectInterval = 0;
        }
示例#3
0
 internal XApi(string path1, Queue queue)
     : base(path1, queue)
 {
 }
示例#4
0
        static void test_LTS_Main(string[] args)
        {
            Queue queue = new Queue(@"QuantBox_Queue.dll");
            Queue queue2 = new Queue(@"QuantBox_Queue.dll");
            XApi api = new XApi("QuantBox_LTS_Quote.dll", queue);
            XApi api2 = new XApi("QuantBox_C2LTS_Trade.dll", queue2);

            api.Server.BrokerID = "2010";
            api.Server.Address = "tcp://211.144.195.163:44513";

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

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

            api2.Server.BrokerID = "2010";
            api2.Server.Address = "tcp://211.144.195.163:44505";

            api2.User.UserID = "0020090001134";
            api2.User.Password = "******";

            api2.OnConnectionStatus = OnConnectionStatus2;
            api2.OnRspQryInstrument = OnRspQryInstrument;
            api2.OnRspQryTradingAccount = OnRspQryTradingAccount;
            api2.OnRspQrySettlementInfo = OnRspQrySettlementInfo;
            api2.OnRtnOrder = OnRtnOrder;
            api2.OnRtnError = OnRtnError;
            api2.OnRtnTrade = OnRtnTrade;

            api.Connect();
            api2.Connect();

            Console.ReadKey();

            api2.ReqQryInstrument("", "");

            Console.ReadKey();

            api.Dispose();
            api2.Dispose();
            //queue.Dispose();
        }