Exemplo n.º 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();
        }
Exemplo n.º 2
0
 public void Subscribe(string[] codes)
 {
     for (int i = 0; i < codes.Length; i++)
     {
         api_Quote.Subscribe(codes[i], "");
     }
 }
Exemplo n.º 3
0
 public override void SubscribeMarketData(Instrument inst)
 {
     if (mInstruments.Add(inst))
     {
         mMdApi.Subscribe(inst.InstrumentID, "");
         LogUtil.SysLog("订阅合约:" + inst.InstrumentID);
     }
 }
Exemplo n.º 4
0
        private void _onRspQryInstrument(object sender, ref InstrumentField instrument, int size1, bool bIsLast)
        {
            //只订阅期货,并且不订阅套利等其他合约
            Regex re = new Regex(@"^[a-zA-Z]+\d+$", RegexOptions.None);

            if (instrument.Type == InstrumentType.Future &&
                re.IsMatch(instrument.InstrumentID))
            {
                mMdApi.Subscribe(instrument.InstrumentID, instrument.ExchangeID);
            }
        }
Exemplo n.º 5
0
        static void test_Linux_Main(string[] args)
        {
            //Queue queue = new Queue(@"libQuantBox_Queue.so");
            //Queue queue2 = new Queue(@"libQuantBox_Queue.so");

            //ApiManager.QueuePath = @"/home/hetao/works/QuantBox_XAPI/bin/Debug/libQuantBox_Queue.so";
            //XApi api = ApiManager.CreateApi(@"/home/hetao/works/QuantBox_XAPI/bin/Debug/libQuantBox_CTP_Quote.so");
            //XApi api2 = ApiManager.CreateApi(@"/home/hetao/works/QuantBox_XAPI/bin/Debug/libQuantBox_CTP_Trade.so");

            //ApiManager.QueuePath = @"libQuantBox_Queue.so";
            XApi api  = new XApi(@"libQuantBox_CTP_Quote.so");
            XApi api2 = new XApi(@"libQuantBox_CTP_Trade.so");

            api.Server.BrokerID = "1017";
            api.Server.Address  = "tcp://ctpmn1-front1.citicsf.com:51213";

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

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

            api2.Server.BrokerID = "1017";
            api2.Server.Address  = "tcp://ctpmn1-front1.citicsf.com:51205";
            api2.Server.PrivateTopicResumeType = ResumeType.Quick;

            api2.User.UserID   = "00000015";
            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();

            api.Subscribe("IF1412", "");

            Console.ReadKey();

            Thread.Sleep(10000);
            Console.WriteLine(123);
            api.Dispose();
            api2.Dispose();
        }
Exemplo n.º 6
0
        static void Test_Linux_Main(string[] args)
        {
            XApi api  = new XApi(@"libQuantBox_CTP_Quote.so");
            XApi api2 = new XApi(@"libQuantBox_CTP_Trade.so");

            api.Server.BrokerID = "1017";
            api.Server.Address  = "tcp://ctpmn1-front1.citicsf.com:51213";

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

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

            api2.Server.BrokerID = "1017";
            api2.Server.Address  = "tcp://ctpmn1-front1.citicsf.com:51205";
            api2.Server.PrivateTopicResumeType = ResumeType.Quick;

            api2.User.UserID   = "00000015";
            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();

            api.Subscribe("IF1502;IF1503", "");

            Console.ReadKey();

            Thread.Sleep(10000);
            Console.WriteLine(123);
            api.Dispose();
            api2.Dispose();
        }
Exemplo n.º 7
0
 public void Subscribe(string szInstrument, string szExchange)
 {
     api.Subscribe(szInstrument, szExchange);
 }
Exemplo n.º 8
0
        /// <summary>
        /// 订阅行情
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void getDataBt_Click(object sender, EventArgs e)
        {
            //showInfo("begin subscribe quotes");
            api.Subscribe("IF1504", "");
        }