Build / Rules

Trading Guide

Futures order placement (signed qty, GTC/IOC/FOK) and prerequisites.

Trading Guide

This guide explains how to trade on HPDX Hashprice Futures, from placing your first order to managing positions.

Contract 3.3.1. Orders carry signed whole-contract quantity. Positions are unilateral aggregates per (user, expirationAt). Matching is a per-maturity limit order book (walk to limit, fill at maker price). createOrder / createOrders take an explicit time in force (GTC / IOC / FOK). Each side's net updates independently — no bilateral lots.


Prerequisites

Before trading, ensure you have:

  1. Settlement Tokens: USDC or the configured token in your wallet
  2. Wallet Connection: Connected to the correct network (Base)
  3. Margin Deposit: Collateral deposited in the Collateral Vault used by Futures

Understanding Order Types

Long Orders (Buy)

createOrder(price, expirationAt, +qty, tif)   // positive = buy / long
  • Long exposure to hashprice, cash-settled at maturity
  • Profit if settlement (or exit) is above entry

Short Orders (Sell)

createOrder(price, expirationAt, -qty, tif)   // negative = sell / short
  • Short exposure to hashprice, cash-settled at maturity
  • Profit if settlement (or exit) is below entry

One placement creates one FIFO order node with |qty| contracts. Later placements at the same price do not merge into the earlier node.


Order Matching

Each maturity has its own book. An incoming limit order walks the opposite side from best price toward its limit:

  • Buy: match asks while askPrice <= limit; fill at each ask's price
  • Sell: match bids while bidPrice >= limit; fill at each bid's price
  • Unfilled size rests at the taker's limit (FIFO at that level)
flowchart LR
  subgraph book [Order book at one maturity]
    direction TB
    A1[Ask 0.15 Seller A]
    A2[Ask 0.14 Seller B]
    A3[Ask 0.12 Seller C]
    B1[Bid 0.12 Buyer X]
    B2[Bid 0.11 Buyer Y then Z]
    B3[Bid 0.10 Buyer W]
  end
  N1[New buy @ 0.14] -->|walks asks| A3
  N1 -->|then| A2
  N2[New sell @ 0.11] -->|FIFO at bid| B2

FIFO Priority

flowchart LR
  Q1[Buyer A<br/>10:00] --> Q2[Buyer B<br/>10:05] --> Q3[Buyer C<br/>10:10]
  S[New sell @ 0.10] -->|fills first| Q1

Self-trade (net-out)

If the next maker is yourself, quantities cancel against each other — no OrderMatched, no fees. Any leftover on either side stays (or rests) as usual.

Time in force

Every placement carries one: createOrder takes it as the last argument, and each leg of a createOrders / updateOrders batch carries its own.

TIF Behavior
GTC Unfilled size rests on the book
IOC Fill what is available now; cancel remainder (never rests); revert TimeInForceNotFilled if nothing fills
FOK Fill entire size now or revert TimeInForceNotFilled

GTD is not supported.


Positions (aggregates)

After fills, each user holds at most one aggregate per maturity:

Field Meaning
netQuantity Signed whole contracts (+long / −short)
netEntryValue Sum of price × signedFillQty for open exposure
unrealized / settlement pnl = mark × netQuantity − netEntryValue

There is no duration multiplier — one contract settles one unit of price.


Closing Positions

Method 1: Offset Before Maturity

Place an opposite order to reduce netQuantity toward zero:

Open:  +1 @ 4.10
Close: −1 @ 4.12

pnl = 4.12 − 4.10 = +0.02 USDC per contract

Method 2: Cash Settlement at Maturity

Hold until expirationAt. Anyone may call settlePosition(user, expirationAt) (typically a keeper). See Settlement.


Order Limits & Fees

Maximum Orders

Each address may have up to MAX_ORDERS_PER_PARTICIPANT_PER_EXPIRATION (100) resting orders for each delivery date. Expired orders are outside this cap and the active-order views without requiring cleanup. There is no per-order max qty of 127 — quantity is a signed int256 of whole contracts.

Fees

Maker/taker fees are charged on fills (not on resting placements). Defaults may set maker fee to 0.


Read next

Sourced from futures-marketplace/docs/gitbook/04.Trading-Guide.md @ dev. Regenerated on every site build.