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(); }
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_Quote_x86.dll"); api = a; api.Server.BrokerID = "9999"; api.Server.Address = "tcp://180.168.146.187:10010"; 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(3 * 1000); api.Subscribe("IF000;IF_WI;IF_IH_1803;IF888", ""); Console.ReadKey(); Thread.Sleep(1000 * 1000); api.Dispose(); Thread.Sleep(5 * 1000); }
static void test_CTP_Main2(string[] args) { Type type = Type.GetType("XAPI.Callback.XApi, XAPI_CSharp"); var a = (IXApi)Activator.CreateInstance(type, @"d:\Users\Kan\Documents\GitHub\XAPI3\bin\Debug64\x64\CTP_SE\CTP_SE_Trade_x64.dll"); api = a; api.OnConnectionStatus = OnConnectionStatus; api.OnRtnDepthMarketData = OnRtnDepthMarketData; api.OnRspQryInstrument = OnRspQryInstrument; api.OnRspQrySettlementInfo = OnRspQrySettlementInfo; api.Connect( @"d:\Users\Kan\Documents\GitHub\XAPI3\bin\Debug64\x64\CTP_SE\td_1.json", @"d:\Users\Kan\Documents\GitHub\XAPI3\bin\Debug64\x64\CTP_SE\td_2.json", Path.GetTempPath()); Thread.Sleep(3 * 1000); Console.ReadKey(); Thread.Sleep(1000 * 1000); api.Dispose(); Thread.Sleep(5 * 1000); }
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_Quote_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://180.168.146.187:10010"; 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(3 * 1000); api.Subscribe("IF1802;au1806;au000;IF000", ""); Console.ReadKey(); api.Unsubscribe("au1806", ""); Console.ReadKey(); api.Unsubscribe("au000", ""); Console.ReadKey(); api.Unsubscribe("au1806", ""); Console.ReadKey(); api.Subscribe("au1806;au000", ""); Console.ReadKey(); api.Unsubscribe("au000", ""); Console.ReadKey(); Thread.Sleep(1000 * 1000); api.Dispose(); Thread.Sleep(5 * 1000); }
static void test_KingstarStock_Main(string[] args) { //ApiManager.QueuePath = @"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\QuantBox_CTP_Trade.dll"; api = new XApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\KingstarStock\x86\QuantBox_KingstarStock_Trade.dll"); api.Server.BrokerID = "1017"; api.Server.Address = "tcp://ctpmn1-front1.citicsf.com:51205"; api.User.UserID = "00000015"; api.User.Password = "******"; api.OnConnectionStatus = OnConnectionStatus; api.OnRtnDepthMarketData = OnRtnDepthMarketData; api.OnRtnError = OnRtnError; api.Connect(); Thread.Sleep(5 * 1000); api.Dispose(); }
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); }
private void _DisconnectToApi(IXApi api) { try { if (api != null) { // 断开连接可能卡死 api.ReconnectInterval = 0; api.Disconnect(); api.Dispose(); api = null; } } catch (Exception ex) { xlog.Error(ex.Message); } finally { api = null; } }
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); }