@@ -62,27 +62,27 @@ namespace TIGER_API {
6262 Order () {};
6363
6464 Order (const utility::string_t order_type, const utility::string_t account, Contract &contract,
65- const utility::string_t action, long total_quantity) :
65+ const utility::string_t action, long long total_quantity) :
6666 order_type (order_type), account(account), contract(contract), action(action),
6767 total_quantity (total_quantity) {};
6868
6969 Order (const utility::string_t order_type, const utility::string_t account, Contract &contract,
70- const utility::string_t action, long total_quantity,
70+ const utility::string_t action, long long total_quantity,
7171 double limit_price, double aux_price = 0 , double trailing_percent = 0 ) :
7272 order_type (order_type), account(account), contract(contract), action(action),
7373 total_quantity (total_quantity),
7474 limit_price (limit_price), aux_price(aux_price), trailing_percent(trailing_percent) {};
7575
7676 Contract contract;
7777 utility::string_t account;
78- long id = 0 ;
78+ unsigned long long id = 0 ;
7979 long order_id = 0 ;
8080 /* * 订单类型, 'MKT' 市价单 / 'LMT' 限价单 / 'STP' 止损单 / 'STP_LMT' 止损限价单 / 'TRAIL' 跟踪止损单 **/
8181 utility::string_t order_type;
8282 /* * 交易方向, 'BUY' / 'SELL' **/
8383 utility::string_t action;
8484 /* * 下单数量 **/
85- long total_quantity = 0 ;
85+ long long total_quantity = 0 ;
8686 /* * 限价单价格 **/
8787 double limit_price = 0 ;
8888 /* * 在止损单中, 表示触发止损单的价格, 在移动止损单中, 表示跟踪的价差 **/
@@ -100,12 +100,12 @@ namespace TIGER_API {
100100 */
101101 bool adjust_limit;
102102 utility::string_t user_mark;
103- long expire_time = 0 ;
103+ time_t expire_time = 0 ;
104104
105105 // 订单状态
106106 utility::string_t status;
107107 // 主订单id, 目前只用于 TigerTrade App端的附加订单中
108- long parent_id;
108+ unsigned long long parent_id;
109109 // 下单时间
110110 time_t open_time;
111111 // 下单失败时, 会返回失败原因的描述
@@ -115,7 +115,7 @@ namespace TIGER_API {
115115 // order updated time
116116 time_t update_time;
117117 // 成交数量
118- long filled_quantity;
118+ long long filled_quantity;
119119 // 包含佣金的平均成交价
120120 double avg_fill_price;
121121 // 实现盈亏
@@ -179,31 +179,31 @@ namespace TIGER_API {
179179 user_mark = json.at (U (" userMark" )).as_string ();
180180 }
181181 if (json.has_field (U (" expireTime" ))) {
182- expire_time = json.at (U (" expireTime" )).as_integer ();
182+ expire_time = json.at (U (" expireTime" )).as_number (). to_int64 ();
183183 }
184184 if (json.has_field (U (" status" ))) {
185185 status = json.at (U (" status" )).as_string ();
186186 }
187187 if (json.has_field (U (" parentId" ))) {
188- parent_id = json.at (U (" parentId" )).as_integer ();
188+ parent_id = json.at (U (" parentId" )).as_number (). to_uint64 ();
189189 }
190190 if (json.has_field (U (" openTime" ))) {
191- open_time = json.at (U (" openTime" )).as_integer ();
191+ open_time = json.at (U (" openTime" )).as_number (). to_int64 ();
192192 }
193193 if (json.has_field (U (" reason" ))) {
194194 reason = json.at (U (" reason" )).as_string ();
195195 }
196196 if (json.has_field (U (" latestTime" ))) {
197- latest_time = json.at (U (" latestTime" )).as_integer ();
197+ latest_time = json.at (U (" latestTime" )).as_number (). to_int64 ();
198198 }
199199 if (json.has_field (U (" updateTime" ))) {
200- update_time = json.at (U (" updateTime" )).as_integer ();
200+ update_time = json.at (U (" updateTime" )).as_number (). to_int64 ();
201201 }
202202 if (json.has_field (U (" filledQuantity" ))) {
203- filled_quantity = json.at (U (" filledQuantity" )).as_integer ();
203+ filled_quantity = json.at (U (" filledQuantity" )).as_number (). to_int64 ();
204204 }
205205 if (json.has_field (U (" totalQuantity" ))) {
206- total_quantity = json.at (U (" totalQuantity" )).as_integer ();
206+ total_quantity = json.at (U (" totalQuantity" )).as_number (). to_int64 ();
207207 }
208208 if (json.has_field (U (" avgFillPrice" ))) {
209209 avg_fill_price = json.at (U (" avgFillPrice" )).as_double ();
@@ -228,7 +228,7 @@ namespace TIGER_API {
228228 public:
229229 Position () {};
230230
231- Position (const utility::string_t &account, const Contract &contract, int position = 0 ,
231+ Position (const utility::string_t &account, const Contract &contract, long long position = 0 ,
232232 double average_cost = 0.0 ,
233233 double latest_price = 0.0 , double market_value = 0.0 , double realized_pnl = 0.0 ,
234234 double unrealized_pnl = 0.0 )
@@ -276,7 +276,7 @@ namespace TIGER_API {
276276 latest_price = json.at (U (" latestPrice" )).as_double ();
277277 }
278278 if (json.has_field (U (" updateTimestamp" ))) {
279- update_timestamp = ( long ) json.at (U (" updateTimestamp" )).as_number ().to_uint64 ();
279+ update_timestamp = json.at (U (" updateTimestamp" )).as_number ().to_uint64 ();
280280 }
281281 if (json.has_field (U (" status" ))) {
282282 status = json.at (U (" status" )).as_integer ();
@@ -285,14 +285,14 @@ namespace TIGER_API {
285285
286286 utility::string_t account;
287287 Contract contract;
288- long position;
288+ long long position;
289289 double average_cost;
290290 double market_value;
291291 double realized_pnl;
292292 double unrealized_pnl;
293293 double latest_price;
294294 int status;
295- long update_timestamp;
295+ time_t update_timestamp;
296296
297297
298298 utility::string_t to_string () {
@@ -467,9 +467,9 @@ namespace TIGER_API {
467467 double low = 0 ;
468468 double close = 0 ;
469469 time_t time;
470- long volume = 0 ;
470+ long long volume = 0 ;
471471 time_t last_time;
472- long open_interest = 0 ;
472+ long long open_interest = 0 ;
473473 double settlement = 0 ;
474474
475475 void from_json (const web::json::value& j) {
@@ -525,7 +525,7 @@ namespace TIGER_API {
525525 double high = 0 ;
526526 double low = 0 ;
527527 double close = 0 ;
528- long volume = 0 ;
528+ long long volume = 0 ;
529529 double adj_pre_close = 0 ;
530530 double pre_close = 0 ;
531531 double ask_price = 0 ;
@@ -534,12 +534,12 @@ namespace TIGER_API {
534534 double bid_size = 0 ;
535535 double latest_price = 0 ;
536536 time_t latest_time;
537- long latest_size = 0 ;
537+ long long latest_size = 0 ;
538538 utility::string_t status;
539539 utility::string_t symbol;
540540
541541 utility::string_t contract_code;
542- long open_interest = 0 ;
542+ long long open_interest = 0 ;
543543 int limit_down = 0 ;
544544 int limit_up = 0 ;
545545
0 commit comments