private void QueryAccountPositionInstrument_Thread()
        {
            ReqQueryField query = new ReqQueryField();

            query.PortfolioID1 = DefaultPortfolioID1;
            query.PortfolioID2 = DefaultPortfolioID2;
            query.PortfolioID3 = DefaultPortfolioID3;
            query.Business     = DefaultBusiness;


            Thread.Sleep(3000);
            // 查合约
            if (IsApiConnected(_ItApi))
            {
                _ItApi.ReqQuery(QueryType.ReqQryInstrument, query);
            }

            // 查持仓,查资金
            Thread.Sleep(3000);
            if (IsApiConnected(_QueryApi))
            {
                _dictPositions_current.Clear();
                _QueryApi.ReqQuery(QueryType.ReqQryInvestorPosition, query);
            }

            // 晚一点通知上层会不会更稳定一些?
            base.Status = ProviderStatus.Connected;

            Thread.Sleep(3000);
            if (IsApiConnected(_QueryApi))
            {
                _dictAccounts_current.Clear();
                _QueryApi.ReqQuery(QueryType.ReqQryTradingAccount, query);
            }
        }
Beispiel #2
0
        private void QueryAccountPositionInstrument_Thread()
        {
            ReqQueryField query = new ReqQueryField();

            query.PortfolioID1 = DefaultPortfolioID1;
            query.PortfolioID2 = DefaultPortfolioID2;
            query.PortfolioID3 = DefaultPortfolioID3;
            query.Business     = DefaultBusiness;

            // 查合约
            if (IsApiConnected(_ItApi))
            {
                Thread.Sleep(3000);
                _ItApi.ReqQuery(QueryType.ReqQryInstrument, query);
            }

            // 查持仓,查资金
            if (IsApiConnected(_QueryApi))
            {
                Thread.Sleep(3000);
                _QueryApi.ReqQuery(QueryType.ReqQryTradingAccount, query);
            }

            if (IsApiConnected(_QueryApi))
            {
                Thread.Sleep(3000);
                _QueryApi.ReqQuery(QueryType.ReqQryInvestorPosition, query);
            }
        }
Beispiel #3
0
        static void test_TongShi_Main(string[] args)
        {
            api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\TongShi\x86\QuantBox_TongShi_Quote.dll");

            api.Server.Address = "D:\\Scengine\\Stock.dll";

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

            api.Connect();
            Thread.Sleep(10 * 1000);
            ReqQueryField query = new ReqQueryField();

            api.ReqQuery(QueryType.ReqQryInstrument, query);

            Thread.Sleep(300 * 1000);

            api.Dispose();

            Thread.Sleep(5 * 1000);
        }
Beispiel #4
0
        static void Test_Tdx_Main(string[] args)
        {
            api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\x86\Tdx\Tdx_Trade_x86.dll");


            api.Server.Address        = @"D:\tc_yhzq_v6\Login.lua";
            api.Server.ExtInfoChar128 = @"D:\tc_yhzq_v6\";
            api.User.UserID           = "16206";
            api.User.Password         = "******";

            api.Server.Address        = @"D:\new_gjzq_v6\Login.lua";
            api.Server.ExtInfoChar128 = @"D:\new_gjzq_v6\";
            api.User.UserID           = "31244679";
            api.User.Password         = "******";

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

            api.Connect();

            Console.ReadKey();
            Console.WriteLine("回车后开始查持仓");
            Console.ReadKey();

            ReqQueryField query = new ReqQueryField()
            {
                Int32ID = -1
            };

            api.ReqQuery(QueryType.ReqQryInvestorPosition, query);

            // api.Dispose();

            Console.ReadKey();

            Console.WriteLine("回车后退出");
            Console.ReadKey();
        }
Beispiel #5
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_Trade_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://218.202.237.33:10002";
            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(5 * 1000);
            //api.Subscribe("IF1502", "");
            ReqQueryField query = new ReqQueryField();

            query.DateStart = 20161124;
            api.ReqQuery(QueryType.ReqQrySettlementInfo, query);

            Thread.Sleep(10 * 1000);

            api.Dispose();

            Thread.Sleep(5 * 1000);
        }