Language reference
Every value a condition can read, every operator, and every action, with the exact ranges the compiler accepts.
Shape of a line
A strategy is if <condition> then <action>. The leading if is optional. Up to four actions follow then, separated by , or and. Keywords and coin names are case-insensitive.
Market values
A value is COIN.name, where COIN is any HyperCore perp (HYPE, BTC, ETH, SOL and the rest of Hyperliquid's listing). Every value is a fixed-point number with 8 decimals.
| Value | Meaning | Parameter |
|---|---|---|
HYPE.mark | Perp mark price, USD | |
HYPE.mid | Mid price, USD | |
HYPE.oracle | Perp oracle price, USD | |
HYPE.funding | Current hourly funding rate (0.0000125 is 0.00125% per hour) | |
HYPE.oi | Open interest, in coins | |
HYPE.imbalance(10) | (bid size - ask size) / (bid size + ask size) over the first N book levels, -1 to 1 | levels 1 to 20, default 5 |
HYPE.change(1h) | (mid now - mid then) / mid then | window 60s to 12h, default 1h |
HYPE.bigtrade(1m) | Largest single trade notional in USD over the window | window 1s to 1h, default 1m |
kHYPE.rate | Kinetiq exchange rate, HYPE per kHYPE |
trade is accepted as a synonym for bigtrade. Windows are written as durations: 90s, 10m, 1h.
Positions and spot
0xADDRESS.COIN.position reads the signed position size, in coins, that an address holds on a perp: positive is long, negative is short. pos and size also work. A strategy watches at most 8 addresses.
if 0x0000000000000000000000000000000000000001.HYPE.position > 1000 then twap long 100 USDC of HYPE in 5 slices every 1mA token that trades only on HyperCore spot (a USDC pair) has one value, .mid. Any other name on a spot-only token is an error that says so.
Stocks, commodities, indices
Hyperliquid's builder-deployed (HIP-3) perps put equities, commodities, indices and FX on HyperCore, trading around the clock. Scriptcore reads them exactly like crypto perps: every value above works on them. The engine loads every live HIP-3 dex from perpDexs at start (today xyz, para, io and mkts, 178 markets) and subscribes per dex.
| You write | Resolves to | Why |
|---|---|---|
NVDA.mark | xyz:NVDA | a bare symbol goes to the first dex in perpDexs order that lists it live |
io:NVDA.mark | io:NVDA | dex:SYMBOL picks a dex |
BTC.mark | BTC | a core perp always wins its bare name |
SP500.change(1h) | xyz:SP500 | indices: SP500, XYZ100, JP225, KR200 |
GOLD.oi | xyz:GOLD | commodities: GOLD, SILVER, CL, BRENTOIL, NATGAS, COPPER |
The rule is fixed, so the same line always compiles to the same bytes. A delisted market does not resolve. The asset id in the bytecode is HyperCore's own: 100000 + dex index x 10000 + market index (xyz:NVDA is 110002), the id CoreWriter orders take.
if xyz:TSLA.funding > 0.0001 for 10m then short 20 USDC of TSLA if SP500.change(1h) < -1% then reduce NVDA by 50% if GOLD.mark crosses above 4000 then long 20 USDC of GOLD
Sessions and the weekend gap
NYSE and Nasdaq close at night, on weekends and on holidays. HyperCore does not. While the US market is shut, the HIP-3 mark is the only live price for these names, and the distance between it and the last official close is the gap the market will open on. Two values read it.
| Value | Meaning | Source |
|---|---|---|
market_open(NYSE) | true during the US regular session (9:30 to 16:00 ET, early closes and holidays included). NASDAQ is accepted and means the same session. | Nasdaq market-info API, mrktStatus, every 60 s |
NVDA.close | Last regular-session close of the US listing | Nasdaq quote API, every 60 s |
NVDA.gap | (NVDA.mark - NVDA.close) / NVDA.close | the line above, written for you |
if not market_open(NYSE) and NVDA.gap < -3% then short 20 USDC of NVDA if market_open(NYSE) and AAPL.gap > 2% then reduce AAPL by 25%
The close is read from Nasdaq's public quote API (api.nasdaq.com/api/quote/NVDA/info). While the market is closed it is the last sale of the session. In pre-market and after-hours it is the session close Nasdaq reports next to the extended-hours trade. During the session it is the previous close (last sale minus net change). On Sunday 2026-11-29 it read NVDA 150.49, the close of Friday's half day, while xyz:NVDA marked 151.4 on HyperCore.
.close and .gap exist only where a HIP-3 market tracks a US listing. The engine ships that map (128 live markets) and built it by matching each HIP-3 mark to the US last sale within 25%, so GOLD.gap is an error: gold the commodity is not the stock that trades under GOLD. A value that has not refreshed in 5 minutes is stale and the strategy refuses to fire, the same rule as every other value.
On chain these are two new slot kinds (US_CLOSE 0x0B, SESSION 0x0C). The keeper supplies them like funding or open interest: the chain re-runs the program on those values and commits them in the fire record, but no precompile can check them, so they are not slashable. The registry live today was deployed before these kinds; they register on the next StrategyRegistry, the one the stake switch deploys. Mark, oracle, funding and the rest of the HIP-3 values register today.
Operators
| Operator | Notes |
|---|---|
+ - * / | Arithmetic on values and constants. * and / bind tighter than + and -. Division by zero makes the condition false. |
-x | Unary minus. |
< <= > >= | Comparisons. Each side can be any arithmetic expression. |
not | Binds tightest of the logic words. |
and | Binds tighter than or. |
or | Loosest. |
( ) | Group conditions or arithmetic. |
10% | A percentage is the number divided by 100: -10% is -0.1. |
if BTC.mid crosses below 90000 and ETH.funding > 0.00001 then short 20 USDC of BTC if not (HYPE.oi > 30000000) and kHYPE.rate > 1 then sell 1 KNTQ for HYPE if HYPE.imbalance(10) > 0.6 or HYPE.bigtrade(1m) > 1000000 then long 15 USDC of HYPE
Crosses and durations
VALUE crosses above N is true only in the market update where the value moves from below N to N or more; crosses below is the mirror. The left side must be a single market value and the right side a constant.
CONDITION for 3m holds once the condition has been true without a break for the duration. Durations run from 1s to 30d and are whole numbers of s, m, h or d.
if HYPE.mark crosses above 35.5 then buy 0.001 HYPE of KNTQ min 100 if (HYPE.mark - HYPE.oracle) / HYPE.oracle > 0.2% for 3m then reduce HYPE by 50%
Actions
| Action | Venue | Syntax and bounds |
|---|---|---|
buy | Elysium | buy 0.01 HYPE of KNTQ, optional min P: least KNTQ per HYPE. |
sell | Elysium | sell 1 KNTQ for HYPE, optional min P. |
send | Elysium | send 0.001 HYPE to 0x..., native HYPE from the escrow. |
long / short | HyperCore | long 15 USDC of HYPE, from 1 USDC (the book needs 10 USDC). |
close | HyperCore | close HYPE, the whole position, reduce-only. |
reduce | HyperCore | reduce HYPE by 50%, 1% to 100%, reduce-only. |
twap | HyperCore | twap long 100 USDC of HYPE in 5 slices every 1m, 2 to 20 slices, every 30s to 1h. |
notify | either | notify "https://...", an https URL up to 200 characters. |
HyperCore actions take slip 0.5%: the IOC limit price is the live mark moved by that much against you, up to 10%. The default is 1%. Swaps route through the KNTQ/WHYPE Uniswap v4 pool, the one pool Scriptcore routes today; their output goes to the strategy owner.
Limits and errors
- One venue per strategy: Elysium actions and HyperCore actions cannot mix. notify joins either.
- At most 4 actions, 32 distinct values, 8 watched addresses, and 1024 bytes of condition program.
- Constant arithmetic that overflows fails at compile time, with the reason.
- Every error carries the column it starts at, so the editor can point at it.
{"ok": false, "error": {"col": 14, "msg": "expected a comparison: <, <=, >, >= or crosses above/below"}}