Nest Scripts
Read Nest pool trades and use exact-input swaps and liquidity actions from Python.
Choose the pool
Open Markets in the scripting editor, select Nest, and copy the pool's source. A pair such as UBTC/USDC works when it identifies one initialized pool. If the pair matches several pools, add :classic, :concentrated, or :v4 to select a unique pool of that type. Use the exact market key whenever the pair and pool type still match more than one pool. The picker chooses the shortest unambiguous source.
UBTC/USDC@trades@nest
UBTC/USDC:concentrated@trades@nest
<pool-address>@trades@nest
99901:<hook>:<pool-id>@trades@nestFurge resolves the pool at deployment and keeps that binding for the run, including after a restart.
Read a trade
Replace the example selector with the one copied from the picker.
script = {"name": "watch-nest", "version": "2", "lookback": 20}
SOURCE = "UBTC/USDC@trades@nest"
def on_data(ctx, history):
trade = history.source(SOURCE, 0)
if trade is None:
return
print(f"price={trade['price']} size={trade['size']}")
return {"metrics": {"price": trade["price"], "size": trade["size"]}}A read-only deployment waits for new indexed trades and requires no funded wallet.
Returned record
{"price": 75880.0, "size": 0.01}The numbers are illustrative. price is the amount of quote asset per base token. size is the base-token quantity. The triggering event time is available as ctx.timestamp_ms.
Nest supports live trades, candles, volume delta, and indexed volumes. Historical runs can read candles and aggregate volumes for a registered pool within its stored coverage. Contract execution runs live.
Add execution
In Accounts, configure the HyperEVM Automated Trading Wallet or the Elysium Automated Trading Wallet for the selected pool. Fund it with the input asset and native HYPE for gas.
Use ctx.buy or ctx.sell for an exact-input swap on a pool declared in the script. Classic pools accept deposits and withdrawals. On HyperEVM, concentrated pools accept range actions on positions the wallet owns. Elysium pools support swaps in scripts. See Nest Python actions for the request fields and Execution for confirmation events.
These actions do not stake Classic LP tokens or claim NEST/campaign rewards. Collecting range fees is a separate operation from claiming token incentives. The pool's total APR and rewards badge describe its program, not this script's claimable income. veNEST/HEV HYPE rewards are a separate optional position. See current reward support.
See Execution and Monitoring for deployment and job activity.