carry Open your desk

Docs/Reference

The tech

How the pieces fit together, the loop's code, where every number comes from, and how to check any of it yourself.

The pieces

YoursYour wallet

Owns the account. Approves and removes the key. The only thing that can withdraw.

Yours, on HyperliquidYour account

Holds the HYPE, the short, the loan and the USDC. Public to read.

HyperliquidPublic API

Prices, funding, loan rates and any account's positions. No login.

Carry, not yet run liveThe keeper

keeper/. Holds the trade-only key. Reads the account, decides, and places both orders.

CarryThe loop

core/loop.mjs. Pure maths, no network. The keeper, the record and the pages all run this one file.

CarryThe site and its server

Reads the public API, saves the hourly record, serves the pages. Holds no key.

Blue is yours. The site can read and cannot trade. The keeper can trade and can never withdraw. It is built and tested, and has not yet run on a real account.

There is no smart contract. Nothing is deployed on any chain, so there are no contract addresses to list. The position is made of ordinary Hyperliquid orders in an ordinary Hyperliquid account.

The loop

The whole strategy is one small file with no dependencies and no network calls. It takes a state and an hour of data and returns the next state. Because it is pure, the same code can be tested, replayed over history and run live.

// One hour. `fundingRate` positive means longs pay shorts, so the position collects.
export function step(s, { price, fundingRate, borrowApr }, cfg) {
  // 1. The short's gain or loss settles in USDC. The HYPE moves the other way.
  let usdc = s.usdc + s.units * (s.price - price);
  // 2. Funding on the size of the short.
  const funding = s.units * price * fundingRate;
  // Carry's 5%, on payments received only.
  const carry = Math.max(0, funding) * cfg.carryFee;
  usdc += funding - carry;
  // 3. Interest on whatever is borrowed.
  const interest = (Math.max(0, -usdc) * borrowApr) / HOURS_PER_YEAR;
  usdc -= interest;
  // 4. Trade both sides back to the target if they have drifted too far.
  if (Math.abs(leverage / s.target - 1) > cfg.band || borrowUse > cfg.maxUse) resize();
}

A position is three numbers: units of HYPE (held and short, always equal), the price, and usdc. Above 1x usdc is negative: that is the loan. At 0.67x it is positive: that is the margin. The same code runs both.

The settings

SettingValueWhere it comes from
Leverage choices0.67x, 1x, 1.5x, 2xCarry. 2.5x would open at 92% of the borrow limit.
Small-account setting0.67xCarry. Two thirds in HYPE, one third as USDC margin, no loan.
Carry's fee5%Carry. Of each funding payment received.
Resize band10%Carry. Trade back when leverage is this far from the target.
Resize line on the loan90%Carry. Trade back when the loan reaches this share of the limit.
Lending limit for HYPE65%Hyperliquid, read live
Loan rate5.0%Hyperliquid, read live
Spot taker fee0.070%Hyperliquid's base tier
Perp taker fee0.045%Hyperliquid's base tier
Margin needed on a HYPE short5%Hyperliquid. Half the 10% needed to open at its 10x maximum.
Portfolio margin minimum$10,000Hyperliquid. Below it only 0.67x is offered.

Where the numbers come from

Everything is read from Hyperliquid's public info endpoint. None of it needs an account or a key.

RequestUsed for
fundingHistoryEvery hourly funding rate. The saved record.
candleSnapshotHourly HYPE prices for the record.
metaAndAssetCtxsThe live price, the running funding rate, open interest.
allBorrowLendReserveStatesThe loan rate, the lending limit, how much of the pool is lent out.
clearinghouseStateAn account's perp positions, for the desk.
spotClearinghouseStateAn account's HYPE and USDC balances.
borrowLendUserStateAn account's loan and health.
userFundingThe funding payments an account received.
extraAgentsThe keys an account has approved.

Check it yourself

You do not have to trust this site's numbers. Ask Hyperliquid directly. This returns the last hours of HYPE funding:

curl -s https://api.hyperliquid.xyz/info \
  -H 'content-type: application/json' \
  -d '{"type":"fundingHistory","coin":"HYPE","startTime":'$(( ($(date +%s) - 21600) * 1000 ))'}'

Each entry has a fundingRate for one hour. Multiply it by the size of a short in dollars and you have that hour's payment. A rate of 0.0000125 on a $20,000 short is $0.25.

The site's own server exposes what it has read, as plain JSON:

AddressReturns
/api/liveThe price, the running rate, the last and next payment, the loan market
/api/historyThe whole saved record: time, price and funding rate for every hour
/api/account?user=0x…One account, read from Hyperliquid: positions, loan, payments, keys

The keeper

Built, in keeper/. It runs inside the site's server or from a command line. It has passed its tests against a stand-in exchange and has never traded on a real account. This is how it works.

  1. One key per account. Approved by you, named, trade-only, with Hyperliquid's expiry.
  2. After each hourly payment it reads the account, runs the loop's step on what it finds, and does nothing unless the step says resize.
  3. A resize is two orders of the same size, one on each side, so the hedge holds while it trades.
  4. It sizes from the account, not from memory. If the two sides do not match, because of a missed fill or because Hyperliquid closed the short, matching them comes first.
  5. Its fee rides on its own trades. It keeps a running total of 5% of funding received and adds it, as a builder fee, to the resizes and the close, never above the cap you approved.
  6. Every order it places is visible in your account's history on Hyperliquid.

Its safety rules

  • Dry run by default. It reads and decides and signs nothing unless it is started live on purpose, with two separate switches.
  • It refuses what it does not recognise. An account holding other coins, a long on the perp, the wrong account mode, or spot and perp prices more than 3% apart all stop the desk with a written reason.
  • Orders cannot run away. Each is immediate-or-cancel, may fill at most 0.4% past the mid price, and is capped in size. Buying the perp is always marked reduce-only, so it can never open a long.
  • It never resends. If a signed order may have reached Hyperliquid and the reply was lost, it stops and reads the account again on the next pass.
  • A stop file halts everything before anything is signed.
  • Keys are sealed on disk with AES-256-GCM. Without the keeper's secret the file is useless.
  • Everything is journaled: what it saw, what it decided, what it sent and what filled.

Who may command a desk

The server trusts no caller. A desk acts for an account only after two things that only the owner's wallet can do: approving the desk's key on Hyperliquid, which the keeper checks on Hyperliquid itself, and signing each command as typed data. The server recovers the signer from the signature and accepts a command only if it is the desk's own account, signed in the last five minutes, and newer than the last command. Anyone can ask for a desk to be prepared for any address. That only makes a key nobody has approved, which can do nothing.

Signing with no outside code

Hyperliquid orders are signed the way Ethereum transactions are: keccak-256 hashing and a secp256k1 signature over typed data. The keeper does this with its own code, about 200 lines, with no library. It is checked three ways: published test vectors, an exact match against an independent implementation on random keys, and Hyperliquid's testnet itself, which names the address it recovers from a signature. A tampered order recovers a different address.

node keeper/dev/echo.mjs                       # ask Hyperliquid's testnet whose signature this is
node keeper/run.mjs look 0xYourAccount 0.67    # what Carry would do with an account. Reads only.

Built with

  • Plain JavaScript modules in the browser and Node.js on the server. No frameworks and no third-party libraries in anything that ships.
  • The server keeps no database. The record is two JSON files, topped up from Hyperliquid every hour.
  • 39 automated tests: 17 on the loop, 7 on signing and 15 on the keeper, plus a 16-step run of the whole flow in a browser with a pretend wallet. The loop's include a check that a flat price with steady funding gives exactly the rule-of-thumb result.
  • For AI tools, the full text of these docs is at /docs/llms.txt.

Carry is new software and nothing here is financial advice. Numbers marked live are read from Hyperliquid as you load the page. Carry's only site is carryhl.com and its only account is @carrypaid_ on X.