C++ SDK
Encrypted C++17 client for the GoDark API. Headers under godark/.
Requirements: C++17, CMake
Status: Beta — contact GoDark for SDK access.
Installation
Public Conan/vcpkg packages are not yet available. Approved integrators receive build instructions directly.
Build from source with CMake:
cmake -B build -S .
cmake --build build -j
Quickstart
#include <cstdlib>
#include <iostream>
#include <godark/rest_client.hpp>
int main() {
godark::GodarkRestClient::Config cfg;
cfg.api_key_id = std::getenv("GDX_API_KEY_ID");
cfg.api_secret = std::getenv("GDX_API_SECRET");
godark::GodarkRestClient client{cfg};
client.connect();
auto ack = client.place_order(
"BTC-USDC-PERP",
godark::Side::BUY,
godark::OrderType::LIMIT,
0.01,
std::optional<double>{95000.0},
godark::TimeInForce::GTC,
false,
std::nullopt,
std::nullopt,
std::optional<std::string>{"my-first-order"});
std::cout << "placed " << ack.order_id << "\n";
client.disconnect();
return 0;
}
See Place Order for all request fields.
Clients
| Type | Header | Description |
|---|---|---|
GodarkRestClient | godark/rest_client.hpp | REST-only encrypted trading |
GodarkClient | godark/client.hpp | WebSocket trading + streams |
MarketDataClient | godark/market_data.hpp | External venue feeds |
Configure via GodarkRestClient::Config: api_key_id, api_secret, rest_base_url, optional passphrase and symbol_overrides.
Environment variables: GDX_API_KEY_ID, GDX_API_SECRET, GDX_REST_URL, GODARK_EDGE_URL / GDX_EDGE_URL.
GodarkRestClient methods
| Method | Docs reference |
|---|---|
connect() / disconnect() | Authentication, Encryption |
place_order(...) | Place Order |
cancel_order(...) | Cancel Order |
cancel_order_by_client_id(...) | Cancel Order |
modify_order(...) | Modify Order |
get_order(...) | Get Order |
await_terminal_status(...) | Poll until terminal order state |
Bundled examples
Includes quickstart.cpp, full_trader_rest.cpp, full_trader_example.cpp, local_e2e.cpp, and market_data_example.cpp.