static void Main(string[] args) { //可在Config类中修改用户名、密码、合约等信息 MarketTest(); TradeTest(); Thread.Sleep(2000); Console.WriteLine("Press any key to close."); Console.ReadKey(); //关闭连接 if (market != null) { market.Close(); ITradeApi.XFinApi_ReleaseMarketApi(market);//必须释放资源 } if (trade != null) { trade.Close(); ITradeApi.XFinApi_ReleaseTradeApi(trade);//必须释放资源 } Console.WriteLine("Closed."); Console.ReadKey(); }
static void Main(string[] args) { //请先在Config类中设置地址、BrokerID、用户名、密码等信息 if (Cfg.TradeAddress == "" || Cfg.MarketAddress == "" || Cfg.LicenseFile == "" || Cfg.UserName == "" || Cfg.Password == "") { Console.WriteLine("请先在Config类中设置地址账户等信息.\n"); Console.ReadKey(); } MarketTest(); TradeTest(); Thread.Sleep(2000); Console.WriteLine("Press any key to close."); Console.ReadKey(); //关闭连接 if (market != null) { market.Close(); ITradeApi.XFinApi_ReleaseMarketApi(market);//必须释放资源 } if (trade != null) { trade.Close(); ITradeApi.XFinApi_ReleaseTradeApi(trade);//必须释放资源 } Console.WriteLine("Closed."); Console.ReadKey(); }