コード例 #1
0
ファイル: Program.cs プロジェクト: bingsgit/pyctp-2
        static void Main(string[] args)
        {
            q = new ctp_quote();
            t = new ctp_trade();

            t.SetOnFrontConnected(t_connected);
            t.SetOnRspUserLogin(t_login);
            t.SetOnRtnTradingNotice(t_notice);
            t.SetOnRspAuthenticate(t_auth);

            q.SetOnFrontConnected(connected);
            q.SetOnRspUserLogin(login);

            t.RegisterFront("tcp://180.168.146.187:13030");
            q.RegisterFront("tcp://180.168.146.187:13040");

            //t.ReqUserAuthMethod
            string v = t.GetVersion();

            Console.WriteLine(v);
            t.SubscribePrivateTopic(THOST_TE_RESUME_TYPE.THOST_TERT_QUICK);
            t.SubscribePublicTopic(THOST_TE_RESUME_TYPE.THOST_TERT_QUICK);

            t.Init();
            q.Init();
            Console.ReadLine();
        }
コード例 #2
0
        public CTPTrade()
        {
            //释放接口的C++相关文件
            Directory.CreateDirectory("ctp_dll");
            string[] files = { "ctp_dll\\thosttraderapi.dll", "ctp_dll\\ctp_trade.dll" };
            object[] objs  = { Resources.thosttraderapi, Resources.ctp_trade };

            for (int i = 0; i < files.Length; ++i)
            {
                var bytes = (byte[])objs[i];
                if (!File.Exists(files[i]) || bytes.Length != new FileInfo(files[i]).Length)
                {
                    File.WriteAllBytes(files[i], bytes);
                }
            }
            _t = new ctp_trade("./ctp_dll/ctp_trade.dll");
            this.SetCallBack();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            q = new ctp_quote(new FileInfo("../../../dll/ctp_quote.dll").FullName);
            t = new ctp_trade(new FileInfo("../../../dll/ctp_trade.dll").FullName);

            t.SetOnFrontConnected(t_connected);
            t.SetOnRspUserLogin(t_login);

            q.SetOnFrontConnected(connected);
            q.SetOnRspUserLogin(login);

            t.RegisterFront("tcp://180.168.146.187:10000");
            q.RegisterFront("tcp://180.168.146.187:10010");

            t.Init();
            q.Init();
            Console.ReadLine();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: laoniu2020/ctp_net_core
        static void Main(string[] args)
        {
            q = new ctp_quote("ctp_quote");
            t = new ctp_trade("ctp_trade");

            t.SetOnFrontConnected(t_connected);
            t.SetOnRspUserLogin(t_login);

            q.SetOnFrontConnected(connected);
            q.SetOnRspUserLogin(login);

            t.RegisterFront("tcp://180.168.146.187:10000");
            q.RegisterFront("tcp://180.168.146.187:10010");

            t.Init();
            q.Init();
            Console.ReadLine();
        }
コード例 #5
0
 /// <summary>
 ///
 /// </summary>
 public CTPTrade()
 {
     _t = new ctp_trade();
     this.SetCallBack();
 }
コード例 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pAbsoluteFilePath">ctp_trade.dll文件绝对路径</param>
 public CTPTrade(string pAbsoluteFilePath)
 {
     _t = new ctp_trade(pAbsoluteFilePath);
     this.SetCallBack();
 }