Longbridge OpenAPI SDK for C++
Longbridge OpenAPI SDK offer to use your Auth to create HttpClient and WebSocketClient.
del method, and you can use it to call the API conveniently.
send_request method, and you can register the message callback and the WebSocket State callback.
You can have the user-defined function to handle the push message and WebSocket State change.
Meanwhile the SDK offer the log utility, user can have custom log path, and default path is path
except macOS system’s is
$HOME/Library/Logs/Longbridge OpenAPI. The log file default is
If you have any question about using the SDK, please raising an issue。
- C++ compile (at least C++11 standard)
- clang (MacOS)
- gcc (Unix)
- msvc (Windows only)
- CMake build system
- Protobuf installed
Download the SDK
# clone sdk repo cd /your/path git clone https://github.com/longbridgeapp//openapi-cpp.git # init submodule about proto cd openapi-cpp git submodule update --init
NOTE: Use need know yourself dev environment, and select the suitable arch static lib.
Open the Longbridge OpenAPI official site, and get your App Key, App Secret, Access Token.
Unzip the downloaded static lib to the path
And you can use the SDK’s HttpClient and WebSocketClient develop yourself application.
demo/src/const/value.h as the value you get from forward step.
Clion user can open the project, and demo has three binary target, you can run directly.
Unix-like user else can run follow shell.
cd /path/to/lb-openapi-cpp mkdir build cmake .. make # run the binary # cd demo # ./http # ./ws_test # ./logger
Windows user can config cmake plugin in VS Code, press
CMD + Shift + Popen the command window, input
CMake:Config, auto create the build directory. and the bottom button run the selected binary.
Other user can read the follow Fully Document to config project as yourself.
User Fully Document
demo └─src -- demo src └─proto -- protobuf generate .cc/.h file docs -- gendoc.sh will gen the doc in the directory include -- SDK include file lib -- User downloaded static lib proto -- proto definition src -- SDK cpp implementation
SDK mostly contain:
- Log utility
- proto file
- demo example
proto directory submodule another repo, store the Protobuf Message definition from the site,
demo/src/proto store the generated cpp from proto file.
You can generate the cpp file by yourself.