A C++23 SDK for the Hyperliquid perpetuals and spot exchange API — REST (/info, /exchange) and WebSocket, with typed request/response models.
This SDK signs and submits real transactions on mainnet. Test against Environment::Testnet before pointing any code at Environment::Mainnet.
Requires CMake 3.16+, a C++23 compiler, and vcpkg for dependencies (OpenSSL, Boost.Asio/Beast, simdjson, nlohmann-json, spdlog, zlib, secp256k1, GTest).
git clone https://github.com/TuxedoFish/hyperliquid-sdk-cpp.git
cd hyperliquid-sdk-cpp
export VCPKG_ROOT=/path/to/vcpkg
cmake --preset default
cmake --build build -j "$(getconf _NPROCESSORS_ONLN)"The default preset sets HYPERLIQUID_BUILD_EXAMPLES=ON and HYPERLIQUID_BUILD_TESTS=ON, and points CMAKE_TOOLCHAIN_FILE at $VCPKG_ROOT. To build only the library, configure manually with those options off:
cmake -B build -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
-DHYPERLIQUID_BUILD_EXAMPLES=OFF -DHYPERLIQUID_BUILD_TESTS=OFF
cmake --build build -j "$(getconf _NPROCESSORS_ONLN)"Run the test suite:
ctest --test-dir build#include <hyperliquid/rest/RestApi.h>
#include <hyperliquid/config/Config.h>
int main() {
hyperliquid::ApiConfig config;
config.env = hyperliquid::Environment::Testnet;
hyperliquid::RestApi api(config);
auto meta = api.meta();
for (const auto& asset : meta.universe) {
// asset.name, asset.szDecimals, asset.maxLeverage
}
}See the Quickstart guide for the WebSocket equivalent and the async/typed-listener paths, and the Examples index for every runnable example in examples/ (order placement/modification, transfers, staking, vaults, and every websocket channel, over both REST and WebSocket).
Most examples read credentials from examples/test.json, a local, gitignored file you create yourself - it's never committed and the repo doesn't ship one. Copy the template at examples/example.json to examples/test.json and fill it in, or create it directly:
{
"wallet": "0xYourAccountAddress",
"privateKey": "yourPrivateKeyHex",
"subaccount": "0xOptionalSubaccountAddress"
}wallet/privateKey are required (subaccount is only read by the handful of examples that need one, e.g. ws_subaccount). Point this at a testnet wallet, not mainnet, while trying things out.
The tables below track which parts of the Hyperliquid API this SDK implements, cross-referenced against the current docs. This reflects main as of this writing — parallel work in the issue tracker is filling in gaps, so treat "not yet" as a snapshot, not a permanent gap.
Legend: ✅ implemented — ⬜ not yet implemented.
| Category | Endpoint (type) |
Status | SDK method |
|---|---|---|---|
| General | allMids |
✅ | RestApi::allMids |
| General | openOrders |
✅ | RestApi::openOrders |
| General | frontendOpenOrders |
✅ | RestApi::frontendOpenOrders |
| General | userFills |
✅ | RestApi::userFills |
| General | userFillsByTime |
✅ | RestApi::userFillsByTime |
| General | userRateLimit |
✅ | RestApi::userRateLimit |
| General | orderStatus |
✅ | RestApi::orderStatus |
| General | l2Book |
✅ | RestApi::l2Book |
| General | candleSnapshot |
✅ | RestApi::candleSnapshot |
| General | maxBuilderFee |
✅ | RestApi::maxBuilderFee |
| General | historicalOrders |
✅ | RestApi::historicalOrders |
| General | userTwapSliceFills |
✅ | RestApi::userTwapSliceFills |
| General | subAccounts |
✅ | RestApi::subAccounts |
| General | vaultDetails |
✅ | RestApi::vaultDetails |
| General | userVaultEquities |
✅ | RestApi::userVaultEquities |
| General | userRole |
✅ | RestApi::userRole |
| General | portfolio |
✅ | RestApi::portfolio |
| General | referral |
✅ | RestApi::referral |
| General | userFees |
✅ | RestApi::userFees |
| General | delegations |
✅ | RestApi::delegations |
| General | delegatorSummary |
✅ | RestApi::delegatorSummary |
| General | delegatorHistory |
✅ | RestApi::delegatorHistory |
| General | delegatorRewards |
✅ | RestApi::delegatorRewards |
| General | userDexAbstraction |
✅ | RestApi::userDexAbstractionState |
| General | userAbstraction |
✅ | RestApi::userAbstraction |
| General | borrowLendUserState |
✅ | RestApi::borrowLendUserState |
| General | borrowLendReserveState |
✅ | RestApi::borrowLendReserveState |
| General | allBorrowLendReserveStates |
✅ | RestApi::allBorrowLendReserveStates |
| General | approvedBuilders |
✅ | RestApi::approvedBuilders |
| General | exchangeStatus |
✅ | RestApi::exchangeStatus |
| General | extraAgents |
⬜ | |
| General | gossipPriorityAuctionStatus |
⬜ | |
| General | gossipRootIps |
⬜ | |
| General | isVip |
⬜ | |
| General | leadingVaults |
⬜ | |
| General | legalCheck |
⬜ | |
| General | preTransferCheck |
⬜ | |
| General | subAccounts2 |
⬜ | |
| General | twapHistory |
✅ | RestApi::twapHistory |
| General | usdcRouting |
⬜ | |
| General | userBorrowLendInterest |
✅ | RestApi::userBorrowLendInterest |
| General | userToMultiSigSigners |
⬜ | |
| General | userTwapSliceFillsByTime |
✅ | RestApi::userTwapSliceFillsByTime |
| General | validatorL1Votes |
⬜ | |
| General | validatorSummaries |
⬜ | |
| General | vaultSummaries |
⬜ | |
| General | webData2 (deprecated, use webData3) |
⬜ | |
| Perpetuals | perpDexs |
✅ | RestApi::perpDexs |
| Perpetuals | meta |
✅ | RestApi::meta |
| Perpetuals | metaAndAssetCtxs |
✅ | RestApi::metaAndAssetCtxs |
| Perpetuals | clearinghouseState |
✅ | RestApi::clearinghouseState |
| Perpetuals | userFunding |
✅ | RestApi::userFunding |
| Perpetuals | userNonFundingLedgerUpdates |
✅ | RestApi::userNonFundingLedgerUpdates |
| Perpetuals | fundingHistory |
✅ | RestApi::fundingHistory |
| Perpetuals | predictedFundings |
✅ | RestApi::predictedFundings |
| Perpetuals | perpsAtOpenInterestCap |
✅ | RestApi::perpsAtOpenInterestCap |
| Perpetuals | perpDeployAuctionStatus |
✅ | RestApi::perpDeployAuctionStatus |
| Perpetuals | activeAssetData |
✅ | RestApi::activeAssetData |
| Perpetuals | perpDexLimits |
✅ | RestApi::perpDexLimits |
| Perpetuals | perpDexStatus |
✅ | RestApi::perpDexStatus |
| Perpetuals | allPerpMetas |
✅ | RestApi::allPerpMetas |
| Perpetuals | perpAnnotation |
✅ | RestApi::perpAnnotation |
| Perpetuals | perpCategories |
✅ | RestApi::perpCategories |
| Perpetuals | perpConciseAnnotations |
✅ | RestApi::perpConciseAnnotations |
| Perpetuals | liquidatable |
✅ | RestApi::liquidatable |
| Perpetuals | marginTable |
⬜ | |
| Perpetuals | maxMarketOrderNtls |
⬜ | |
| Perpetuals | recentTrades |
✅ | RestApi::recentTrades |
| Spot / Outcomes | spotMeta |
✅ | RestApi::spotMeta |
| Spot / Outcomes | spotMetaAndAssetCtxs |
✅ | RestApi::spotMetaAndAssetCtxs |
| Spot / Outcomes | spotClearinghouseState |
✅ | RestApi::spotClearinghouseState |
| Spot / Outcomes | spotDeployState |
✅ | RestApi::spotDeployState |
| Spot / Outcomes | spotPairDeployAuctionStatus |
✅ | RestApi::spotPairDeployAuctionStatus |
| Spot / Outcomes | tokenDetails |
⬜ | |
| Spot / Outcomes | outcomeMeta |
✅ | RestApi::outcomeMeta |
| Spot / Outcomes | settledOutcome |
✅ | RestApi::settledOutcome |
| Spot / Outcomes | outcomeDeployerLimits |
⬜ | |
| Spot / Outcomes | outcomeTemplates |
⬜ |
59 of 78 documented info endpoints implemented. One (tokenDetails) has a RestEndpointType enum value reserved but no request builder or method yet.
Action (type) |
Status | SDK method |
|---|---|---|
order |
✅ | RestApi::placeOrder |
cancel |
✅ | RestApi::cancelOrder |
cancelByCloid |
✅ | RestApi::cancelOrderByCloid |
scheduleCancel |
✅ | RestApi::scheduleCancel |
modify |
✅ | RestApi::modifyOrder |
batchModify |
✅ | RestApi::batchModifyOrder |
updateLeverage |
✅ | RestApi::updateLeverage |
updateIsolatedMargin |
✅ | RestApi::updateIsolatedMargin |
approveAgent |
✅ | RestApi::approveAgent |
agentSetAbstraction |
✅ | RestApi::agentSetAbstraction |
approveBuilderFee |
✅ | RestApi::approveBuilderFee |
userSetAbstraction |
✅ | RestApi::userSetAbstraction |
sendAsset |
✅ | RestApi::sendAsset |
agentSendAsset |
✅ | RestApi::agentSendAsset |
sendToEvmWithData |
✅ | RestApi::sendToEvmWithData |
usdSend |
✅ | RestApi::usdSend |
spotSend |
✅ | RestApi::spotSend |
withdraw3 |
✅ | RestApi::withdraw3 |
usdClassTransfer |
✅ | RestApi::usdClassTransfer |
cDeposit |
✅ | RestApi::cDeposit |
cWithdraw |
✅ | RestApi::cWithdraw |
tokenDelegate |
✅ | RestApi::tokenDelegate |
vaultTransfer |
✅ | RestApi::vaultTransfer |
hip3LiquidatorTransfer |
✅ | RestApi::hip3LiquidatorTransfer |
twapOrder |
✅ | RestApi::twapOrder |
twapCancel |
✅ | RestApi::twapCancel |
reserveRequestWeight |
✅ | RestApi::reserveRequestWeight |
noop |
✅ | RestApi::noop |
userDexAbstraction (deprecated, use userSetAbstraction) |
✅ | RestApi::userDexAbstraction |
borrowLend |
✅ | RestApi::borrowLend |
perpDeploy (registerAsset2 only - see note below) |
✅ | RestApi::perpDeployRegisterAsset2 |
setReferrer |
✅ | RestApi::setReferrer |
activateOutcomeDeployer |
⬜ | |
agentEnableDexAbstraction (deprecated, use agentSetAbstraction) |
⬜ | |
authorizeAqav2Role |
⬜ | |
claimRewards |
⬜ | |
convertToMultiSigUser |
⬜ | |
createSubAccount |
✅ | RestApi::createSubAccount |
createVault |
✅ | RestApi::createVault |
cSignerAction |
⬜ | |
cValidatorAction |
⬜ | |
evmUserModify |
⬜ | |
finalizeEvmContract |
⬜ | |
gossipPriorityBid |
⬜ | |
linkStakingUser |
⬜ | |
registerReferrer |
⬜ | |
setDisplayName |
⬜ | |
spotDeploy (registerToken2) |
✅ | RestApi::spotDeployRegisterToken2 |
spotDeploy (userGenesis) |
✅ | RestApi::spotDeployUserGenesis |
spotDeploy (genesis) |
✅ | RestApi::spotDeployGenesis |
spotDeploy (registerSpot) |
✅ | RestApi::spotDeployRegisterSpot |
spotDeploy (registerHyperliquidity) |
✅ | RestApi::spotDeployRegisterHyperliquidity |
spotDeploy (setDeployerTradingFeeShare) |
⬜ | |
spotDeploy (enableQuoteToken) |
⬜ | |
spotDeploy (disableQuoteToken) |
⬜ | |
spotDeploy (requestEvmContract) |
⬜ | |
spotDeploy (outcome) |
⬜ | |
spotUser |
⬜ | |
stakingLinkDisableTradingUser |
⬜ | |
subAccountModify |
⬜ | |
subAccountSpotTransfer |
⬜ | |
subAccountTransfer |
✅ | RestApi::subAccountTransfer |
topUpIsolatedOnlyMargin |
⬜ | |
userOutcome |
⬜ | |
userPortfolioMargin |
✅ | RestApi::userPortfolioMargin |
validatorL1Stream |
⬜ | |
vaultDistribute |
⬜ | |
vaultModify |
⬜ |
41 of 68 documented exchange actions implemented on REST (RestApi). WebsocketApi covers a smaller subset — placeOrder, cancelOrder, cancelOrderByCloid, scheduleCancel, modifyOrder, batchModifyOrder — plus posting meta/spotMeta/outcomeMeta/perpDexs info reads over the socket; the newer transfer/staking/TWAP actions are REST-only so far.
perpDeploy is a large multi-variant action (16 sub-actions sharing "type": "perpDeploy"); only registerAsset2 (deploying a new HIP-3 perp asset, optionally creating a new dex) is implemented. The other 15 variants (registerAsset, setOracle, setFundingMultipliers, setFundingInterestRates, haltTrading, setMarginTableIds, insertMarginTable, setFeeRecipient, setOpenInterestCaps, setSubDeployers, setMarginModes, setFeeScale, setGrowthModes, setPerpAnnotation, disableDex) are post-deployment admin/config actions for an already-deployed dex and are not yet implemented.
spotDeploy is likewise a multi-variant action (10 sub-actions sharing "type": "spotDeploy"); the 5 that make up the "create and launch a new spot token" (HIP-1/HIP-2) flow are implemented: registerToken2, userGenesis, genesis, registerSpot, registerHyperliquidity. The other 5 variants (setDeployerTradingFeeShare, enableQuoteToken, disableQuoteToken, requestEvmContract, outcome) are post-deployment admin/config actions on an already-deployed token and are not yet implemented.
| Channel | Status | SubscriptionType / callback |
|---|---|---|
l2Book |
✅ | L2Book → onL2Book |
bbo |
✅ | Bbo → onBbo |
trades |
✅ | Trades → onTrade |
candle |
✅ | Candle → onCandle |
allMids |
✅ | AllMids → onAllMidsEntry |
activeAssetCtx |
✅ | ActiveAssetCtx → onPerpAssetCtx / onSpotAssetCtx |
orderUpdates |
✅ | OrderUpdates → onOrderUpdate |
userFills |
✅ | UserFills → onUserFill |
userEvents |
✅ | UserEvents → onUserFill / onLiquidation / onNonUserCancel |
userFundings |
✅ | UserFundings → onUserFundingUpdate |
userNonFundingLedgerUpdates |
✅ | UserNonFundingLedgerUpdates → onLedgerUpdate |
webData3 |
✅ | WebData3 → onWebData3 |
clearinghouseState |
✅ | ClearingHouseState → onClearinghouseState |
openOrders |
✅ | OpenOrders → onOpenOrdersSnapshot |
notification |
✅ | Notification → onNotification |
twapStates |
✅ | TwapStates → onTwapStates |
activeAssetData |
✅ | ActiveAssetData → onActiveAssetData |
userTwapSliceFills |
✅ | UserTwapSliceFills → onUserTwapSliceFill |
userTwapHistory |
✅ | UserTwapHistory → onUserTwapHistory |
spotState |
✅ | SpotState → onSpotState |
allDexsClearinghouseState |
✅ | AllDexsClearinghouseState → onAllDexsClearinghouseState |
allDexsAssetCtxs |
✅ | AllDexsAssetCtxs → onAllDexsAssetCtxs |
fastAssetCtxs |
✅ | FastAssetCtxs → onFastAssetCtx |
outcomeMetaUpdates |
✅ | OutcomeMetaUpdates → onOutcomeMetaUpdate |
24 of 24 documented channels have full typed parsing. fastAssetCtxs payloads are raw-DEFLATE (RFC 1951) compressed on the wire and decompressed internally (zlib) before parsing. outcomeMetaUpdates's data is itself an array of discriminated-union entries (one of outcomeCreated/outcomeSettled/questionUpdated/questionSettled per entry) - each entry dispatches its own onOutcomeMetaUpdate call.
- exchange-gateways — a multi-exchange connectivity layer providing low-latency order routing to Deribit (FIX 4.4) and Hyperliquid (WebSocket).
Using this SDK in your own project? Open a PR adding it here.
This SDK is under active development. Remaining endpoint and channel coverage is tracked in the issue tracker. See CHANGELOG.md for release history.
After cmake --install, downstream projects can consume the SDK via find_package:
find_package(hyperliquid-sdk CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE hyperliquid-sdk::hyperliquid-sdk)Contributions are welcome — see CONTRIBUTING.md for the repeatable pattern used to add a new endpoint, action, or websocket channel. This project follows a Code of Conduct; please report security vulnerabilities per SECURITY.md rather than in a public issue.
MIT — see LICENSE.