@@ -53,11 +53,36 @@ class TestTradeClient {
5353 ucout << U (" active orders: " ) << res << endl;
5454 }
5555
56+ static void test_get_transactions (const std::shared_ptr<TradeClient>& trade_client) {
57+ value res = trade_client->get_transactions (trade_client->client_config .account , U (" AAPL" ));
58+ ucout << U (" transactions: " ) << res << endl;
59+ }
60+
5661 static void test_get_contract (const std::shared_ptr<TradeClient>& trade_client) {
5762 value res = trade_client->get_contract (U (" AAPL" ));
5863 ucout << U (" contract: " ) << res << endl;
5964 }
6065
66+ static void test_get_contracts (const std::shared_ptr<TradeClient>& trade_client) {
67+ value symbols = value::array ();
68+ symbols[0 ] = value::string (U (" AAPL" ));
69+ symbols[1 ] = value::string (U (" JD" ));
70+ value res = trade_client->get_contracts (symbols, U (" STK" ));
71+ ucout << U (" contracts: " ) << res << endl;
72+ }
73+
74+ static void test_get_quote_contract (const std::shared_ptr<TradeClient>& trade_client) {
75+ value res = trade_client->get_quote_contract (U (" 00700" ), U (" IOPT" ), U (" 20230728" ));
76+ ucout << U (" quote contract: " ) << res << endl;
77+ }
78+
79+ static void test_get_estimate_tradable_quantity (const std::shared_ptr<TradeClient>& trade_client) {
80+ Contract contract = ContractUtil::stock_contract (U (" AAPL" ), U (" USD" ));
81+ Order order = OrderUtil::limit_order (contract, U (" BUY" ), 1 , 100.0 );
82+ value res = trade_client->get_estimate_tradable_quantity (order);
83+ ucout << U (" estimate tradable quantity: " ) << res << endl;
84+ }
85+
6186 static void test_place_order (const std::shared_ptr<TradeClient>& trade_client) {
6287 Contract contract = ContractUtil::stock_contract (U (" AAPL" ), U (" USD" ));
6388 Order order = OrderUtil::limit_order (contract, U (" BUY" ), 1 , 100.0 );
@@ -115,9 +140,35 @@ class TestTradeClient {
115140 ucout << U (" modified order: " ) << mod_order.to_string () << endl;
116141 }
117142
143+ static void test_get_analytics_asset (const std::shared_ptr<TradeClient>& trade_client) {
144+ value res = trade_client->get_analytics_asset (trade_client->client_config .account , U (" 2023-11-01" ),
145+ U (" 2023-12-31" ));
146+ ucout << U (" analytics asset: " ) << res << endl;
147+ }
148+
149+ static void test_get_segment_fund_history (const std::shared_ptr<TradeClient>& trade_client) {
150+ value res = trade_client->get_segment_fund_history ();
151+ ucout << U (" segment fund history: " ) << res << endl;
152+ }
153+
154+ static void test_get_segment_fund_available (const std::shared_ptr<TradeClient>& trade_client) {
155+ value res = trade_client->get_segment_fund_available (U (" SEC" ));
156+ ucout << U (" segment fund available: " ) << res << endl;
157+ }
158+
159+ static void test_transfer_segment_fund (const std::shared_ptr<TradeClient>& trade_client) {
160+ value res = trade_client->transfer_segment_fund (U (" SEC" ), U (" FUT" ), 10.0 );
161+ ucout << U (" transfer segment fund: " ) << res << endl;
162+ }
163+
164+ static void test_place_forex_order (const std::shared_ptr<TradeClient>& trade_client) {
165+ value res = trade_client->place_forex_order (U (" SEC" ), U (" USD" ), U (" HKD" ), 1.0 );
166+ ucout << U (" place forex order: " ) << res << endl;
167+ }
168+
118169
119170 static void test_trade (const std::shared_ptr<TradeClient>& trade_client) {
120- TestTradeClient::test_get_orders (trade_client);
171+ TestTradeClient::test_get_contract (trade_client);
121172 }
122173};
123174
@@ -327,8 +378,24 @@ class TestQuoteClient {
327378 ucout << U (" result: " ) << result << endl;
328379 }
329380
381+ static void test_get_warrant_real_time_quote (std::shared_ptr<QuoteClient> quote_client) {
382+ value result = quote_client->get_warrant_real_time_quote (U (" 15792" ));
383+ ucout << U (" result: " ) << result << endl;
384+ }
385+
386+ static void test_get_warrant_filter (std::shared_ptr<QuoteClient> quote_client) {
387+ value result = quote_client->get_warrant_filter (U (" 00700" ));
388+ ucout << U (" result: " ) << result << endl;
389+ }
390+
391+ static void test_get_kline_quota (std::shared_ptr<QuoteClient> quote_client) {
392+ value result = quote_client->get_kline_quota ();
393+ ucout << U (" result: " ) << result << endl;
394+ }
395+
396+
330397 static void test_quote (const std::shared_ptr<QuoteClient> quote_client) {
331- TestQuoteClient::test_get_quote_real_time (quote_client);
398+ TestQuoteClient::test_get_kline_quota (quote_client);
332399 }
333400};
334401
@@ -361,10 +428,11 @@ class TestTigerApi {
361428int main ()
362429{
363430 /* ************************* set config **********************/
364- ClientConfig config = ClientConfig ();
365- config.private_key = U (" " );
366- config.tiger_id = U (" " );
367- config.account = U (" " );
431+ ClientConfig config = ClientConfig (true );
432+ config.private_key = U (" MIICXQIBAAKBgQC1amZa5YsGTklry7DAsUBOwXJCgrsZZtB21PImw/yLmrbqRfsS3vawvMigLWcCwIDnHa+hpdpeze0eHIwbZzJzUDGvRALYK9t3D8pwPVxpwX1OF8RfHCM7YQvSOvPPnHHuVQvKaR7NNm1/WmvGXC9kVJdkYQ7kCmh52siFoy1MLQIDAQABAoGAVabcmIHTt7ByncBXvUJymDxhE+HhMEcImXJEueTCca8kOUu9FNXMJvmax3VoMzZsJbIwX+OMTEJxd0wHIlEA0gECjDwFK4Q42q+ptO4QABJQVSC6I+dOt2OIY28uvT3rkenOO8KRIDt4F52PFd71ZdB1aaXixORORq1MdSLi8EkCQQDiviAB+L5R/HVxwxvqZfJ530OtFd5IipZC9YZlY1CtXWCmu89LK7UUlEuNXyGsOxyz5jLqFuNRsie5AC23tfEPAkEAzNMCa8axJWfPZIH4tGrbZ1F3I41BQdgp2zBmR7AyUMBDkli86OzmJ7QUCJA/PJxK43/IYUWm4OU5Q+SvXCr3AwJBAJTBj1Y7zwES1CpSitn5EF+MbmX71t1YrsQ3OHkD80YJ4QMCbDkw75gUwox5QSoxjd8ow3Z4laJfc1gYGeZQ41kCQQCCiQwm8cceBq3W6To+iUdw7itWngRz2Ta7uXnFwFYgvpeR4jnq3GfF7+9AkeWrVBQqLtrem0xCUfQP/+N+gudPAkBFLbt78/MpQGEDc7jyu/KE5Mp4wMMDQQwch9VLvsAZwWLysB6rZWpo3jIfp9zZ7c3zOYGNMWAZjtMmNkRJ8COH" );
433+ config.tiger_id = U (" 1" );
434+ config.account = U (" 402901" );
435+
368436
369437
370438
@@ -374,14 +442,14 @@ int main()
374442 /* *
375443 * ʹ�÷�װ�������ӿ� QuoteClient
376444 */
377- std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
378- TestQuoteClient::test_quote (quote_client);
445+ // std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
446+ // TestQuoteClient::test_quote(quote_client);
379447
380448 /* *
381449 * ʹ�÷�װ��Ľ��ӿ� TradeClient
382450 */
383- // std::shared_ptr<TradeClient> trade_client = std::make_shared<TradeClient>(config);
384- // TestTradeClient::test_trade(trade_client);
451+ std::shared_ptr<TradeClient> trade_client = std::make_shared<TradeClient>(config);
452+ TestTradeClient::test_trade (trade_client);
385453
386454 /* *
387455 * ֱ��ʹ��δ��װ�� TigerApi
0 commit comments