Skip to content

Commit a4cd662

Browse files
committed
modify cout
1 parent 6743e85 commit a4cd662

File tree

5 files changed

+81
-80
lines changed

5 files changed

+81
-80
lines changed

demo/src/quote_client_demo.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,74 +20,74 @@ class TestTradeClient {
2020
public:
2121
static void test_get_prime_asset(const std::shared_ptr<TradeClient>& trade_client) {
2222
value res = trade_client->get_prime_asset();
23-
cout << "asset: " << res << endl;
23+
ucout << "asset: " << res << endl;
2424
}
2525

2626
static void test_get_prime_portfolio(const std::shared_ptr<TradeClient>& trade_client) {
2727
PortfolioAccount res = trade_client->get_prime_portfolio();
28-
cout << "portfolio: " << res.to_string() << endl;
28+
ucout << "portfolio: " << res.to_string() << endl;
2929
}
3030

3131
static void test_get_asset(const std::shared_ptr<TradeClient>& trade_client) {
3232
value res = trade_client->get_asset();
33-
cout << "asset: " << res << endl;
33+
ucout << "asset: " << res << endl;
3434
}
3535

3636
static void test_get_position(const std::shared_ptr<TradeClient>& trade_client) {
3737
value res = trade_client->get_positions();
38-
cout << "position: " << res << endl;
38+
ucout << "position: " << res << endl;
3939
}
4040

4141
static void test_get_position_list(const std::shared_ptr<TradeClient>& trade_client) {
4242
vector<Position> res = trade_client->get_position_list();
43-
cout << "position size: " << res.size() << " , first item: " << res[0].to_string() << endl;
43+
ucout << "position size: " << res.size() << " , first item: " << res[0].to_string() << endl;
4444
}
4545

4646
static void test_get_orders(const std::shared_ptr<TradeClient>& trade_client) {
4747
value res = trade_client->get_orders();
48-
cout << "orders: " << res << endl;
48+
ucout << "orders: " << res << endl;
4949
}
5050

5151
static void test_get_active_orders(const std::shared_ptr<TradeClient>& trade_client) {
5252
value res = trade_client->get_active_orders();
53-
cout << "active orders: " << res << endl;
53+
ucout << "active orders: " << res << endl;
5454
}
5555

5656
static void test_get_contract(const std::shared_ptr<TradeClient>& trade_client) {
5757
value res = trade_client->get_contract("AAPL");
58-
cout << "contract: " << res << endl;
58+
ucout << "contract: " << res << endl;
5959
}
6060

6161
static void test_place_order(const std::shared_ptr<TradeClient>& trade_client) {
6262
Contract contract = stock_contract("AAPL", "USD");
6363
Order order = limit_order(contract, "BUY", 1, 100.0);
6464
value res = trade_client->place_order(order);
6565
long id = res["id"].as_integer();
66-
cout << "order id: " << id << endl;
67-
cout << "place order result: " << res << endl;
66+
ucout << "order id: " << id << endl;
67+
ucout << "place order result: " << res << endl;
6868
}
6969

7070
static void test_get_order(const std::shared_ptr<TradeClient>& trade_client) {
7171
// Contract contract = stock_contract("AAPL", "USD");
7272
// Order order = limit_order(contract, "BUY", 1, 100.0);
7373
// trade_client->place_order(order);
7474
Order my_order = trade_client->get_order(29270263515317248);
75-
cout << "order : " << my_order.to_string() << endl;
75+
ucout << "order : " << my_order.to_string() << endl;
7676
}
7777

7878
static void test_cancel_order(const std::shared_ptr<TradeClient>& trade_client) {
7979
value res = trade_client->cancel_order(29270263515317248);
80-
cout << "cancel order : " << res << endl;
80+
ucout << "cancel order : " << res << endl;
8181
}
8282

8383
static void test_modify_order(const std::shared_ptr<TradeClient>& trade_client) {
8484
Contract contract = stock_contract("AAPL", "USD");
8585
Order order = limit_order(contract, "BUY", 1, 100.0);
8686
long id = (long) trade_client->place_order(order)["id"].as_number().to_uint64();
8787
value res = trade_client->modify_order(order, 105);
88-
cout << "modify order res: " << res << endl;
88+
ucout << "modify order res: " << res << endl;
8989
Order mod_order = trade_client->get_order(id);
90-
cout << "modified order: " << mod_order.to_string() << endl;
90+
ucout << "modified order: " << mod_order.to_string() << endl;
9191
}
9292

9393

@@ -105,35 +105,35 @@ class TestQuoteClient {
105105
public:
106106
static void test_grab_quote_permission(std::shared_ptr<QuoteClient> quote_client) {
107107
value perms = quote_client->grab_quote_permission();
108-
cout << "Quote perms: " << perms << endl;
108+
ucout << "Quote perms: " << perms << endl;
109109
}
110110

111111
static void test_get_symbols(std::shared_ptr<QuoteClient> quote_client) {
112112
value result = quote_client->get_symbols();
113-
cout << "result: " << result << endl;
113+
ucout << "result: " << result << endl;
114114
}
115115

116116
static void test_get_symbols_names(std::shared_ptr<QuoteClient> quote_client) {
117117
// value result = quote_client->get_all_symbol_names("HK");
118118
value result = quote_client->get_all_symbol_names(Market::HK);
119-
cout << "result: " << result << endl;
119+
ucout << "result: " << result << endl;
120120
}
121121

122122
static void test_get_kline(std::shared_ptr<QuoteClient> quote_client) {
123123
value symbols = value::array();
124124
symbols[0] = value::string("AAPL");
125125
symbols[1] = value::string("JD");
126-
cout << "symbols " << symbols << endl;
126+
ucout << "symbols " << symbols << endl;
127127
value result = quote_client->get_kline(symbols);
128-
cout << "result: " << result << endl;
128+
ucout << "result: " << result << endl;
129129
}
130130

131131
static void test_get_quote_stock_trade(std::shared_ptr<QuoteClient> quote_client) {
132132
value symbols = value::array();
133133
symbols[0] = value::string("AAPL");
134134
symbols[1] = value::string("JD");
135135
value result = quote_client->get_quote_stock_trade(symbols);
136-
cout << "Result: " << result << endl;
136+
ucout << "Result: " << result << endl;
137137
}
138138

139139
static void test_quote(std::shared_ptr<QuoteClient> quote_client) {
@@ -150,7 +150,7 @@ class TestTigerApi {
150150
static void test_grab_quote_permission(std::shared_ptr<TigerClient> tigerapi) {
151151
value obj = value::object(true);
152152
value perms = tigerapi->post(GRAB_QUOTE_PERMISSION, obj);
153-
cout << "quote perms: " << perms << endl;
153+
ucout << "quote perms: " << perms << endl;
154154
}
155155

156156
static void test_get_market_status(std::shared_ptr<TigerClient> tigerapi) {
@@ -168,7 +168,7 @@ class TestTigerApi {
168168
};
169169

170170
int main(int argc, char *args[]) {
171-
cout << "Tiger Api main" << endl;
171+
ucout << "Tiger Api main" << endl;
172172
/************************** set config **********************/
173173
ClientConfig config = ClientConfig(true);
174174

include/tigerapi/quote_client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "tiger_client.h"
99
#include "client_config.h"
1010
#include "enums.h"
11-
#include "../include/tigerapi/service_types.h"
11+
#include "service_types.h"
1212

1313
namespace TIGER_API {
1414
class QuoteClient : public TigerClient {

src/common/sign_util.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ RSA * create_rsa(utility::char_t *key, bool is_private) {
8787
}
8888
BIO_free_all(keybio);
8989
} else {
90-
cout << U("Failed to create key BIO");
90+
ucout << U("Failed to create key BIO");
9191
}
9292

9393
if (rsa == nullptr) {
94-
cout << U("Failed to create RSA");
94+
ucout << U("Failed to create RSA");
9595
}
9696

9797
return rsa;
@@ -169,11 +169,11 @@ RSA * create_rsa(utility::char_t *key, bool is_private) {
169169
}
170170
BIO_free_all(keybio);
171171
} else {
172-
cout << U("Failed to create key BIO");
172+
ucout << U("Failed to create key BIO");
173173
}
174174

175175
if (rsa == nullptr) {
176-
cout << U("Failed to create RSA");
176+
ucout << U("Failed to create RSA");
177177
}
178178

179179
return rsa;
@@ -251,11 +251,11 @@ RSA * create_rsa(utility::char_t *key, bool is_private) {
251251
}
252252
BIO_free_all(keybio);
253253
} else {
254-
cout << U("Failed to create key BIO");
254+
ucout << U("Failed to create key BIO");
255255
}
256256

257257
if (rsa == nullptr) {
258-
cout << U("Failed to create RSA");
258+
ucout << U("Failed to create RSA");
259259
}
260260

261261
return rsa;

0 commit comments

Comments
 (0)