@@ -469,6 +469,19 @@ class TestPushClient {
469469 push_client->subscribe_tick (symbols);
470470 }
471471
472+ void error_callback (const tigeropen::push::pb::Response& data) {
473+ ucout << " Error callback: " << std::endl;
474+ ucout << " - code: " << data.code () << std::endl;
475+ ucout << " - msg: " << utility::conversions::to_string_t (data.msg ()) << std::endl;
476+ }
477+
478+ void kickout_callback (const tigeropen::push::pb::Response& data) {
479+ ucout << " Kickout callback: " << std::endl;
480+ ucout << " - code: " << data.code () << std::endl;
481+ ucout << " - msg: " << utility::conversions::to_string_t (data.msg ()) << std::endl;
482+
483+ }
484+
472485 void position_changed_callback (const tigeropen::push::pb::PositionData& data) {
473486 ucout << " Position changed:" << std::endl;
474487 ucout << " - symbol: " << utility::conversions::to_string_t (data.symbol ()) << std::endl;
@@ -542,6 +555,8 @@ class TestPushClient {
542555
543556 void start_test (ClientConfig config) {
544557 push_client->set_connected_callback (std::bind (&TestPushClient::connected_callback, this ));
558+ push_client->set_error_callback (std::bind (&TestPushClient::error_callback, this , std::placeholders::_1));
559+ push_client->set_kickout_callback (std::bind (&TestPushClient::kickout_callback, this , std::placeholders::_1));
545560 push_client->set_position_changed_callback (std::bind (&TestPushClient::position_changed_callback, this , std::placeholders::_1));
546561 push_client->set_order_changed_callback (std::bind (&TestPushClient::order_changed_callback, this , std::placeholders::_1));
547562 push_client->set_asset_changed_callback (std::bind (&TestPushClient::asset_changed_callback, this , std::placeholders::_1));
@@ -579,11 +594,29 @@ class TestPushClient {
579594 }
580595};
581596
582- int main ()
583- {
597+ int main (int argc, char * argv[]) {
598+ // // 初始化日志
599+ // START_EASYLOGGINGPP(argc, argv);
600+ //
601+ // 配置日志
602+ el::Configurations defaultConf;
603+ defaultConf.setToDefault ();
604+
605+ // 只显示WARNING和ERROR级别的日志
606+ defaultConf.set (el::Level::Global, el::ConfigurationType::Enabled, " true" );
607+ defaultConf.set (el::Level::Debug, el::ConfigurationType::Enabled, " false" );
608+ defaultConf.set (el::Level::Info, el::ConfigurationType::Enabled, " true" );
609+ defaultConf.set (el::Level::Warning, el::ConfigurationType::Enabled, " true" );
610+ defaultConf.set (el::Level::Error, el::ConfigurationType::Enabled, " true" );
611+
612+ // 应用配置
613+ el::Loggers::reconfigureLogger (" default" , defaultConf);
614+
584615 // Set Tiger OpenAPI SDK configuration
585616 bool sand_box = false ;
586617 ClientConfig config = ClientConfig (false , U (" ../openapi_cpp_test/" ));
618+ // config.set_server_url(U("http://127.0.0.1:8085/gateway"));
619+ // config.set_server_public_key(SANDBOX_TIGER_PUBLIC_KEY);
587620 // config.private_key = U("");
588621 // config.tiger_id = U("");
589622 // config.account = U("");
@@ -593,13 +626,13 @@ int main()
593626 // Create a push client instance
594627 auto push_client = IPushClient::create_push_client (config);
595628 // Run some push test cases
596- // TestPushClient::test_push_client(push_client, config);
629+ TestPushClient::test_push_client (push_client, config);
597630
598631 /* *
599632 * QuoteClient
600633 */
601- std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
602- TestQuoteClient::test_quote (quote_client);
634+ // std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
635+ // TestQuoteClient::test_quote(quote_client);
603636
604637 /* *
605638 * TradeClient
0 commit comments