Open a market

Open a market with your API key, on the EVM chains or on Solana.

Aqua0 opens a market at the current market price. Opening one that already exists returns it with created: false.

POST /api/vaults/markets/open opens a Uniswap V4 market for a pair and fee, or a 1inch Aqua range for a pair, fee and ticks.

curl -X POST "$AQUA0_API/api/vaults/markets/open" \
  -H "X-API-Key: $AQUA0_API_KEY" -H "Content-Type: application/json" \
  -d '{ "chainId": 8453, "venue": "v4", "tokenA": "0x...", "tokenB": "0x...", "fee": 3000 }'
  • fee is in hundredths of a basis point. Uniswap V4 takes 100, 500, 3000 or 10000. 1inch Aqua takes any multiple of 100 up to 100000.
  • Both tokens need an asset vault that is not paused.
  • For 1inch Aqua, add tickLower and tickUpper. The range must sit on the fee's tick grid and contain the current price.
  • GET /api/vaults/markets/open-quote takes the same fields and says whether the open has a network fee, and how much.

Pay the network fee

When an open has a network fee, it returns 402 with the code PAYMENT_REQUIRED and the transfer in details. Name the wallet that will pay in payer.

{
  "code": "PAYMENT_REQUIRED",
  "message": "Opening this market has a network fee of about 0.0000042 ETH. Send exactly amountWei to the address in details with no data within the hour, then call again with its hash in payments.",
  "details": { "to": "0x...", "amountWei": "4200000000000", "costWei": "4200000000000", "paidWei": "0", "payer": "0x..." }
}
  1. From payer, send exactly amountWei of the chain's native coin to to as a plain transfer with no data, within the hour. A transfer that carries data is refused.
  2. Call the open again with the same payer and the transaction hash in payments.

GET /api/vaults/markets/open-quote returns the same transfer ahead of time as payment: { to, value }. A payment counts for that market only. If the fee rose meanwhile, you get 402 again for the rest, and you list both hashes. The fee is quoted high, and any amount over it is not returned. A payment that does not count returns 422 with the code PAYMENT_NOT_ACCEPTED and the reason in details.reason.

POST /api/solana/strategies/pools opens an Orca or Raydium market for a pair, with its strategy. Pick the pool from GET /api/solana/strategies/pools?tokenA=<mint>&tokenB=<mint>, which lists each venue's config, tickSpacing and, on Orca, feeTierIndex.

curl -X POST "$AQUA0_API/api/solana/strategies/pools" \
  -H "X-API-Key: $AQUA0_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "owner": "<wallet>",
    "venue": "orca",
    "tokenA": "<mint>",
    "tokenB": "<mint>",
    "config": "<config>",
    "tickSpacing": 64,
    "feeTierIndex": 0,
    "tickLower": -1024,
    "tickUpper": 1024
  }'

The response has the market's pool and strategy.

Pay the network fee

A new market's setup is paid by the wallet. Then the open returns 402 with the code SETUP_PAYMENT_REQUIRED.

  1. Send the same body to POST /api/solana/strategies/pools/payment. It returns a requestId, the unsigned transaction and the lamports it pays.
  2. Sign the transaction in the wallet and send it to POST /api/solana/vaults/transactions/{requestId}/submit.
  3. Call the open again with that requestId in payments.

Reference: pools for a pair, open, setup payment.

Opens have their own limits per key. See Limits.