Example Queries

Assuming your address is 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 (Hi Vitalik 👋), here are some sample GraphQL queries to get you quickly started with OptSwaps subgraphs. Feel free to explore all the other entities and fields available!

Refer to the associated smart contracts documentation for full details about the various returned enumerated types and denominations.

My Orders

# All My Orders
query MyOrders {
  optSwapOrders(where: { user: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" }) {
    id
    contract
    optionStyle
    optionType
    strike0
    strike1
    expiry
    lotSize
    orderType
    premium
    lots
    user
    timestamp
    blockNumber
  }
}

# Response:
{
  "data": {
    "optSwapOrders": [
      {
        "id": "0x18bb81e4153528cd8823857726b2ca6f994450ae010bd20a9bb5550436fb6498-2",
        "contract": "0xdbebcddf47ea77561ab5f98c40baf2f89a6770d4",
        "optionStyle": 0, # European Style Option
        "optionType": 1, # Call Option
        "strike0": "12000000", # in basis points of the cash token
        "strike1": "170141183460469231731687303715884105728", # 2^127 for Call Options
        "expiry": "1657267200", # Unix timestamp
        "lotSize": "10000", # in basis points
        "orderType": 1, # Buy Order
        "premium": "100", # in basis points of the cash token
        "lots": "10",
        "user": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
        "timestamp": "1656920647", # Unix timestamp
        "blockNumber": "27025991"
      },
      ...
    ]
  }
}

My Positions

Latest Blocks

Last updated

Was this helpful?