FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
openapi/examples/cpp/today_orders/main.cpp at r1 · kallydev/openapi · GitHub
kallydev
/
openapi
Public
forked from
longbridge/openapi
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
openapi
/
examples
/
cpp
/
today_orders
/
main.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (41 loc) · 1.1 KB
Breadcrumbs
openapi
/
examples
/
cpp
/
today_orders
/
main.cpp
Copy path
File metadata and controls
49 lines (41 loc) · 1.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
include
<
iostream
>
#
include
<
longport.hpp
>
#
ifdef
WIN32
#
include
<
windows.h
>
#
endif
using
namespace
longport
;
using
namespace
longport
::trade
;
int
main
(
int
argc,
char
const
* argv[])
{
#
ifdef
WIN32
SetConsoleOutputCP
(
CP_UTF8
);
#
endif
Config config;
Status status =
Config::from_env
(config);
if
(!status) {
std::cout <<
"
failed to load configuration from environment:
"
<< status.
message
() << std::endl;
return
-
1
;
}
TradeContext::create
(config, [](
auto
res) {
if
(!res) {
std::cout <<
"
failed to create trade context:
"
<< res.
status
().
message
()
<< std::endl;
return
;
}
res.
context
().
today_orders
(std::
nullopt
, [](
auto
res) {
if
(!res) {
std::cout <<
"
failed to get today orders:
"
<< res.
status
().
message
()
<< std::endl;
return
;
}
for
(
auto
it = res->
cbegin
(); it != res->
cend
(); ++it) {
std::cout <<
"
order_id=
"
<< it->
order_id
<<
"
quantity=
"
<< it->
quantity
<<
"
submitted_at=
"
<< it->
submitted_at
<< std::endl;
}
});
});
std::cin.
get
();
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL