@@ -61,21 +61,25 @@ static void OnRtnTrade(object sender, ref TradeField trade)
6161
6262 static void Main ( string [ ] args )
6363 {
64- for ( int i = 0 ; i < 10000 ; ++ i )
64+ // for (int i = 0; i < 10000; ++i)
6565 {
66- test_CTP_Main ( args ) ;
66+ test_Linux_Main ( args ) ;
6767 }
6868 Console . ReadKey ( ) ;
6969 }
7070
7171 static void test_Linux_Main ( string [ ] args )
7272 {
73- //Console.WriteLine (Path.GetTempPath());
74- //return;
75- Queue queue = new Queue ( @"libQuantBox_Queue.so" ) ;
73+ //Queue queue = new Queue(@"libQuantBox_Queue.so");
7674 //Queue queue2 = new Queue(@"libQuantBox_Queue.so");
77- XApi api = new XApi ( @"/home/hetao/works/QuantBox_X/QuantBox.XAPI/bin/libQuantBox_CTP_Quote.so" , queue ) ;
78- //TraderApi api2 = new TraderApi(@"C:\Program Files\SmartQuant Ltd\OpenQuant 2014\TAPI\CTP\QuantBox.C2CTP.Trade.dll", queue2);
75+
76+ //ApiManager.QueuePath = @"/home/hetao/works/QuantBox_XAPI/bin/Debug/libQuantBox_Queue.so";
77+ //XApi api = ApiManager.CreateApi(@"/home/hetao/works/QuantBox_XAPI/bin/Debug/libQuantBox_CTP_Quote.so");
78+ //XApi api2 = ApiManager.CreateApi(@"/home/hetao/works/QuantBox_XAPI/bin/Debug/libQuantBox_CTP_Trade.so");
79+
80+ ApiManager . QueuePath = @"libQuantBox_Queue.so" ;
81+ XApi api = ApiManager . CreateApi ( @"libQuantBox_CTP_Quote.so" ) ;
82+ XApi api2 = ApiManager . CreateApi ( @"libQuantBox_CTP_Trade.so" ) ;
7983
8084 api . Server . BrokerID = "1017" ;
8185 api . Server . Address = "tcp://ctpmn1-front1.citicsf.com:51213" ;
@@ -86,31 +90,33 @@ static void test_Linux_Main(string[] args)
8690 api . OnConnectionStatus = OnConnectionStatus ;
8791 api . OnRtnDepthMarketData = OnRtnDepthMarketData ;
8892
89- /* api2.Server.BrokerID = "1017";
93+ api2 . Server . BrokerID = "1017" ;
9094 api2 . Server . Address = "tcp://ctpmn1-front1.citicsf.com:51205" ;
91- api2.Server.ResumeType = ResumeType.Restart ;
95+ api2 . Server . PrivateTopicResumeType = ResumeType . Quick ;
9296
9397 api2 . User . UserID = "00000015" ;
9498 api2 . User . Password = "123456" ;
9599
100+
96101 api2 . OnConnectionStatus = OnConnectionStatus2 ;
97102 api2 . OnRspQryInstrument = OnRspQryInstrument ;
98103 api2 . OnRspQryTradingAccount = OnRspQryTradingAccount ;
99104 api2 . OnRspQrySettlementInfo = OnRspQrySettlementInfo ;
100105 api2 . OnRtnOrder = OnRtnOrder ;
101106 api2 . OnRtnError = OnRtnError ;
102- api2.OnRtnTrade = OnRtnTrade;*/
107+ api2 . OnRtnTrade = OnRtnTrade ;
103108
104109 api . Connect ( ) ;
105- // api2.Connect();
110+ api2 . Connect ( ) ;
106111
107- api . Subscribe ( "IF1410 " , "" ) ;
112+ api . Subscribe ( "IF1412 " , "" ) ;
108113
109114 Console . ReadKey ( ) ;
110115
111- Console . ReadKey ( ) ;
112-
113- api . Dispose ( ) ;
116+ Thread . Sleep ( 10000 ) ;
117+ Console . WriteLine ( 123 ) ;
118+ ApiManager . ReleaseApi ( api ) ;
119+ ApiManager . ReleaseApi ( api2 ) ;
114120 }
115121
116122 #region LTS
@@ -181,12 +187,6 @@ static void test_CTP_Main(string[] args)
181187
182188 ApiManager . ReleaseApi ( api ) ;
183189
184-
185-
186-
187-
188- //api.Dispose();
189- //queue.Dispose();
190190 }
191191
192192 static void test_KingstarGold_Main ( string [ ] args )
@@ -215,9 +215,6 @@ static void test_KingstarGold_Main(string[] args)
215215 Console . ReadKey ( ) ;
216216
217217 Console . ReadKey ( ) ;
218-
219- //api.Dispose();
220- //queue.Dispose();
221218 }
222219 }
223220}
0 commit comments