perpLong action enables Vincent Apps to open or increase long positions on Hyperliquid’s perpetuals market using a Vincent User’s HyperCore perp balance.
Prerequisites
Before executing theperpLong action, the following conditions must be met:
- Perp Balance on HyperCore: The Vincent User Agent Wallet must have sufficient USDC in their HyperCore perp balance to cover the margin requirements for the position.
- Order Parameters: You must provide a valid perp symbol (e.g., “SOL”, “ETH”), price, size, leverage, and margin mode according to Hyperliquid’s trading rules.
To learn more about executing Vincent Abilities, see the Executing
Abilities guide.
Executing the precheck Function
The precheck function validates some prerequisites for executing a perp long, without actually performing the operation.
For the perpLong action, the precheck function will validate the following:
- The Vincent User Agent Wallet has sufficient USDC in their HyperCore perp balance to cover the margin requirements.
- Parameters
- Implementation
- Response
The
precheck function requires the following parameters:Executing the execute Function
The execute function performs the actual long operation, placing a long order on Hyperliquid’s perpetuals market.
For the perpLong action, the execute function will:
- Place a long order for the specified perpetual at the given price and size with the specified leverage.
- Return the order result from Hyperliquid.
- Parameters
- Implementation
- Response
The
execute function requires the following parameters:Important Considerations
Price and Size Formatting Rules
Price and Size Formatting Rules
Hyperliquid has strict formatting requirements for perp orders. See the Hyperliquid API documentation for more details.
Symbol Format
Symbol Format
Perpetual symbols use the base asset only (e.g., “SOL”, “ETH”, “BTC”), not the full pair
notation like “SOL-USD” or “SOL-PERP”. This is different from spot markets which use pairs like
“PURR/USDC”.
Leverage and Margin
Leverage and Margin
- Leverage controls how much position size you can open relative to the margin you put up.
- Example: at 2x leverage, 100 position.
- Higher leverage increases both potential gains and liquidation risk.
- Margin modes:
- Cross margin (
isCross: true): Your entire perp balance backs all positions. Profits and losses are shared across positions. - Isolated margin (
isCross: false): Only the margin assigned to a specific position is at risk. Other balances remain protected.
- Cross margin (
Position Management
Position Management
- Long positions profit when price goes up
- Opening a long when you already have a long position will increase your position size
- Position size is tracked as
szi(signed size, positive for longs) - Uses USDC from your HyperCore perp balance for margin
Getting Current Market Prices
Getting Current Market Prices
You’ll need to fetch the current market price before placing an order. Use the Hyperliquid API or
SDK to get the mid price for your perpetual, then adjust it based on your strategy (e.g., 1% above
mid price for market longs).
Order Types
Order Types
You can specify either a limit or market order using the
orderType parameter. See the
Parameters section for more details.Verifying Order Success
Verifying Order Success
After the order is executed, you can verify the positions by checking the clearinghouse state using a Hyperliquid SDK, or by using the Hyperliquid API.
Reference Implementation
For a complete working example showing the full perp long workflow including balance verification and price calculation, see the long.spec.ts end-to-end test in theability-hyperliquid package.

