Queries + Mutations

type Query {
  """
  Returns the array of supported markets on the protocol.
  Each market is known as an asset, and has an underlying asset it tracks in a specific
  base currency. Currently, all margin is isolated within the markets.
  """
  assets: [AssetV2!]!
  """
  Returns the asset price and 24 hour change in bips for all supported assets.
  """
  assetQuotes: [AssetQuote!]!
  """
  Returns the array of supported perpetual futures pairs on the protocol.
  Each PerpetualPair included the necessary info to begin placing orders for the pair.
  """
  perpetualPairs: [PerpetualPair!]!
  """
  Query to paginate through the reference/index price's OHLC of each asset, based on that
  asset's unique symbol.
  """
  tickerHistory(
    symbol: String!
    start: DateTime!
    end: DateTime!
    interval: PriceHistoryInterval!
    cursor: String
  ): PriceHistory!
  """
  Query to paginate through the reference/index price's OHLC of each asset, based on that
  asset's instrument hash.
  """
  markPriceHistory(
    instrumentHash: String!
    start: DateTime!
    end: DateTime!
    interval: PriceHistoryInterval!
    cursor: String
  ): PriceHistory!
  """
  Query to paginate through the transfer (transfer, trade, liquidation, funding) history of a subaccount.
  """
  transferHistory(
    subaccount: BigInt!
    marketHash: String
    transferType: TransferType
    instrumentType: InstrumentType
    cursor: String
  ): TransferHistory!
  """
  Query to paginate through the equity and PnL history of a subaccount.
  """
  equityHistory(
    subaccount: BigInt!
    lookback: EquityLookback!
  ): [EquityHistoryItem!]!
  """
  Provides an overview of the authenticated account's subaccounts, equity, and PnL.
  """
  accountOverview: AccountOverview!
  """
  Provides details of the autenticated account's reward tier and fees.
  """
  accountDetails: AccountDetails!
  """
  Provides an overview of a subaccount's positions. This includes closed positions.
  """
  positions(
    subaccount: BigInt!
    instrumentType: InstrumentType
  ): [PositionOverview!]!
  """
  Provides the history of funding rates for a given instrument.
  """
  fundingHistory(
    instrumentHash: String!
    start: DateTime!
    end: DateTime!
    cursor: String
  ): FundingHistory!
}

type Mutation {
  """
  Create a market/limit order on the protocol. All positions are opened via orders.
  An optional transfer input and signature input may be provided to transfer
  collateral to the subaccount creating the order before it's submitted.
  """
  placeOrderV2(
    beforeTradeTransfer: TransferInput
    beforeTradeTransferSignature: SignatureInput
    orderInput: PlaceOrderInput!
    signature: SignatureInput!
  ): Boolean!
  """
  Soft/best-effort cancellation of an order. If the order is already submitted on chain,
  it may be filled despite a cancel request.
  """
  cancelOrderV2(orderHash: String!): Boolean!
  """
  Signing keys allow alternative private keys instead of the pimary accounts to
  be used to sign orders. Use this mutation to submit a signing key.
  """
  registerSigningKey(signingKey: SigningKeyInput!, signature: String!): ID!
  """
  Once a signing key is used, you may revoke it with this mutation. No orders
  submitted after the revoke will be usable with the signing key. If a signing
  key is believed to be compromised, the nonce should be incremented on the
  protocol.
  """
  revokeSigningKey(signingKeyHash: String!, authorizer: String!): Boolean!
  """
  Transfer collateral between subaccounts. Note: Margin checks are performed on
  the sending subaccount. This transfer can send to subaccounts owned by different
  users.
  """
  transferERC20Collateral(
    transferInput: TransferInput!
    signature: SignatureInput!
  ): String!
}

Last updated