33#include " tigerapi/quote_client.h"
44#include " tigerapi/trade_client.h"
55#include " tigerapi/contract_util.h"
6+ #include " tigerapi/model.h"
67#include " tigerapi/order_util.h"
78#include " tigerapi/utils.h"
89#include < cpprest/details/basic_types.h>
@@ -150,8 +151,8 @@ class TestQuoteClient {
150151 value symbols = value::array ();
151152 symbols[0 ] = value::string (U (" AAPL" ));
152153 symbols[1 ] = value::string (U (" JD" ));
153- value result = quote_client->get_quote_real_time (symbols);
154- ucout << U (" result: " ) << result << endl;
154+ auto result = quote_client->get_quote_real_time (symbols);
155+ ucout << U (" result: " ) << result. at ( 0 ). to_string () << endl;
155156 }
156157
157158 static void test_get_quote_delay (const std::shared_ptr<QuoteClient> quote_client) {
@@ -183,9 +184,9 @@ class TestQuoteClient {
183184 symbols[0 ] = value::string (U (" AAPL" ));
184185 symbols[1 ] = value::string (U (" JD" ));
185186 // ucout << U("symbols ") << symbols << endl;
186- value result = quote_client->get_kline (symbols, U (" day" ), -1 , -1 , U (" br" ), 5 );
187- // ucout << U("result: ") << result << endl ;
188- // LOG(INFO) << U(" result: ") << result.serialize () << endl;
187+ // value result = quote_client->get_kline(symbols, U("day"), -1, -1, U("br"), 5);
188+ vector<Kline> result = quote_client-> get_kline (symbols, " day " , - 1 , - 1 , 5 ) ;
189+ cout << result. at ( 0 ). to_string () << endl;
189190 }
190191
191192 static void test_get_quote_stock_trade (std::shared_ptr<QuoteClient> quote_client) {
@@ -200,7 +201,7 @@ class TestQuoteClient {
200201 value symbols = value::array ();
201202 symbols[0 ] = value::string (U (" AAPL" ));
202203 symbols[1 ] = value::string (U (" JD" ));
203- value result = quote_client->get_trade_tick (symbols, 0 , 100 );
204+ value result = quote_client->get_trade_tick (symbols, 0 , 100000000 );
204205 ucout << U (" Result: " ) << result << endl;
205206 }
206207
@@ -248,8 +249,9 @@ class TestQuoteClient {
248249 value symbols = value::array ();
249250 symbols[0 ] = value::string (U (" CL2303" ));
250251 ucout << U (" symbols " ) << symbols << endl;
251- value result = quote_client->get_future_kline (symbols);
252- ucout << U (" result: " ) << result << endl;
252+ // value result = quote_client->get_future_kline(symbols);
253+ vector<Kline> result = quote_client->get_future_kline (symbols, BarPeriod::DAY);
254+ ucout << U (" result: " ) << result.at (0 ).to_string () << endl;
253255 }
254256
255257 static void test_get_future_tick (std::shared_ptr<QuoteClient> quote_client) {
@@ -261,8 +263,9 @@ class TestQuoteClient {
261263 value symbols = value::array ();
262264 symbols[0 ] = value::string (U (" CL2303" ));
263265 ucout << U (" symbols " ) << symbols << endl;
264- value result = quote_client->get_future_real_time_quote (symbols);
265- ucout << U (" result: " ) << result << endl;
266+ // value result = quote_client->get_future_real_time_quote(symbols);
267+ auto result = quote_client->get_future_real_time_quote (symbols);
268+ ucout << U (" result: " ) << result.at (0 ).to_string () << endl;
266269 }
267270
268271 static void test_get_option_expiration (std::shared_ptr<QuoteClient> quote_client) {
@@ -280,26 +283,27 @@ class TestQuoteClient {
280283
281284
282285 static void test_get_option_brief (std::shared_ptr<QuoteClient> quote_client) {
283- value result = quote_client->get_option_brief (U (" AAPL 230317C000135000 " ));
286+ value result = quote_client->get_option_brief (U (" AAPL 230224C000150000 " ));
284287 ucout << U (" result: " ) << result << endl;
285288 }
286289
287290 static void test_get_option_kline (std::shared_ptr<QuoteClient> quote_client) {
288291 value identifiers = value::array ();
289- identifiers[0 ] = value::string (U (" AMD 220819C000165000" ));
290- value result = quote_client->get_option_kline (identifiers, 1639026000000 , 1649026000000 );
291- ucout << U (" result: " ) << result << endl;
292+ identifiers[0 ] = value::string (U (" AAPL 230224C000150000" ));
293+ // value result = quote_client->get_option_kline(identifiers, 1639026000000, 1649026000000);
294+ vector<Kline> result = quote_client->get_option_kline (identifiers, 1639026000000 , 1649026000000 );
295+ ucout << U (" result: " ) << result.at (0 ).to_string () << endl;
292296 }
293297
294298 static void test_get_option_trade_tick (std::shared_ptr<QuoteClient> quote_client) {
295299 value identifiers = value::array ();
296- identifiers[0 ] = value::string (U (" AAPL 230317C000135000 " ));
300+ identifiers[0 ] = value::string (U (" AAPL 230224C000150000 " ));
297301 value result = quote_client->get_option_trade_tick (identifiers);
298302 ucout << U (" result: " ) << result << endl;
299303 }
300304
301305 static void test_quote (const std::shared_ptr<QuoteClient> quote_client) {
302- TestQuoteClient::test_get_quote_delay (quote_client);
306+ TestQuoteClient::test_get_kline (quote_client);
303307 }
304308};
305309
@@ -337,6 +341,8 @@ int main()
337341 config.private_key = U (" " );
338342 config.tiger_id = U (" " );
339343 config.account = U (" " );
344+
345+
340346// config.lang = U("en_US");
341347
342348
@@ -349,8 +355,8 @@ int main()
349355 /* *
350356 * ʹ�÷�װ��Ľ��ӿ� TradeClient
351357 */
352- std::shared_ptr<TradeClient> trade_client = std::make_shared<TradeClient>(config);
353- TestTradeClient::test_trade (trade_client);
358+ // std::shared_ptr<TradeClient> trade_client = std::make_shared<TradeClient>(config);
359+ // TestTradeClient::test_trade(trade_client);
354360
355361 /* *
356362 * ֱ��ʹ��δ��װ�� TigerApi
0 commit comments