> ## Documentation Index
> Fetch the complete documentation index at: https://v3.docs.derive.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Trades by instrument

> Channel name: `trades.{instrument_name}`. Public channel that streams the public trade tape for a single instrument, where {instrument_name} is the market whose fills you want to follow.



## AsyncAPI

````yaml subscriptions.asyncapi.json tradesByInstrument
id: tradesByInstrument
title: Trades by instrument
description: >-
  Channel name: `trades.{instrument_name}`. Public channel that streams the
  public trade tape for a single instrument, where {instrument_name} is the
  market whose fills you want to follow.
servers:
  - id: production
    protocol: wss
    host: api.derive.xyz
    bindings: []
    variables: []
  - id: testnet
    protocol: wss
    host: testnet.api.derive.xyz
    bindings: []
    variables: []
address: /v3/ws
parameters: []
bindings: []
operations:
  - &ref_8
    id: receive_tradesByInstrument
    title: Receive_trades by instrument
    type: send
    messages:
      - &ref_11
        id: tradesByInstrumentNotification
        payload:
          - name: tradesByInstrumentNotification
            description: Pushed as a JSON array; each element has the fields below.
            type: object
            properties:
              - name: direction
                type: string
                enumValues:
                  - buy
                  - sell
                required: true
              - name: index_price
                type: string
                required: true
              - name: instrument_name
                type: string
                required: true
              - name: mark_price
                type: string
                required: true
              - name: quote_id
                type: &ref_0
                  - string
                  - 'null'
                required: false
              - name: rfq_id
                type: &ref_1
                  - string
                  - 'null'
                required: false
              - name: timestamp
                type: integer
                required: true
              - name: trade_amount
                type: string
                required: true
              - name: trade_id
                type: string
                required: true
              - name: trade_price
                type: string
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - direction
            - index_price
            - instrument_name
            - mark_price
            - timestamp
            - trade_amount
            - trade_id
            - trade_price
          properties:
            direction:
              type: string
              enum:
                - buy
                - sell
              x-parser-schema-id: Direction
            index_price:
              type: string
              x-parser-schema-id: <anonymous-schema-202>
            instrument_name:
              type: string
              x-parser-schema-id: <anonymous-schema-203>
            mark_price:
              type: string
              x-parser-schema-id: <anonymous-schema-204>
            quote_id:
              type: *ref_0
              x-parser-schema-id: <anonymous-schema-205>
            rfq_id:
              type: *ref_1
              x-parser-schema-id: <anonymous-schema-206>
            timestamp:
              type: integer
              format: int64
              x-parser-schema-id: <anonymous-schema-207>
            trade_amount:
              type: string
              x-parser-schema-id: <anonymous-schema-208>
            trade_id:
              type: string
              x-parser-schema-id: <anonymous-schema-209>
            trade_price:
              type: string
              x-parser-schema-id: <anonymous-schema-210>
          x-parser-schema-id: PublicTrade
        title: Trades by instrument notification
        description: Pushed as a JSON array; each element has the fields below.
        example: |-
          {
            "direction": "<string>",
            "index_price": "<string>",
            "instrument_name": "<string>",
            "mark_price": "<string>",
            "timestamp": 123,
            "trade_amount": "<string>",
            "trade_id": "<string>",
            "trade_price": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: tradesByInstrumentNotification
    bindings: []
    extensions: &ref_6
      - id: x-parser-unique-object-id
        value: tradesByInstrument
  - &ref_7
    id: send_subscribe_tradesByInstrument
    title: Send_subscribe_trades by instrument
    type: receive
    messages:
      - &ref_9
        id: subscribeRequest
        payload:
          - name: subscribeRequest
            description: >-
              Send to subscribe: list this channel's address (with the {param}
              segments filled, e.g. orderbook.ETH-PERP.10.20) in
              params.channels.
            type: object
            properties:
              - name: headers
                type: &ref_2
                  - object
                  - 'null'
                description: Non-standard; used by `auth/login`.
                required: false
              - name: id
                type: anyOf
                required: true
              - name: method
                type: string
                description: subscribe
                required: true
              - name: params
                type: object
                description: >-
                  Params for `subscribe`. `channels` is the required list of
                  channel names to subscribe to.
                required: true
                properties:
                  - name: channels
                    type: array
                    required: true
                    properties:
                      - name: item
                        type: string
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - method
            - params
          properties:
            headers:
              description: Non-standard; used by `auth/login`.
              type: *ref_2
              additionalProperties: true
              x-parser-schema-id: <anonymous-schema-16>
            id: &ref_4
              anyOf:
                - type: string
                  x-parser-schema-id: <anonymous-schema-17>
                - type: number
                  x-parser-schema-id: <anonymous-schema-18>
                - type: 'null'
                  x-parser-schema-id: <anonymous-schema-19>
              x-parser-schema-id: JsonRpcId
            method:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-20>
            params:
              description: >-
                Params for `subscribe`. `channels` is the required list of
                channel names to subscribe to.
              type: object
              required:
                - channels
              properties:
                channels:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-22>
                  x-parser-schema-id: <anonymous-schema-21>
              x-parser-schema-id: SubscribeParams
          x-parser-schema-id: <anonymous-schema-15>
        title: Subscribe request
        description: >-
          Send to subscribe: list this channel's address (with the {param}
          segments filled, e.g. orderbook.ETH-PERP.10.20) in params.channels.
        example: |-
          {
            "id": 1,
            "method": "subscribe",
            "params": {
              "channels": [
                "orderbook.ETH-PERP.10.20"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
      - &ref_10
        id: unsubscribeRequest
        payload:
          - name: unsubscribeRequest
            description: >-
              Send to unsubscribe: list the channel addresses to drop in
              params.channels, or omit it to unsubscribe from everything.
            type: object
            properties:
              - name: headers
                type: &ref_3
                  - object
                  - 'null'
                description: Non-standard; used by `auth/login`.
                required: false
              - name: id
                type: anyOf
                required: true
              - name: method
                type: string
                description: unsubscribe
                required: true
              - name: params
                type: object
                description: >-
                  Params for `unsubscribe`. `channels` is optional.


                  When omitted (or null) the connection unsubscribes from all
                  channels.
                required: true
                properties:
                  - name: channels
                    type: &ref_5
                      - array
                      - 'null'
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - method
            - params
          properties:
            headers:
              description: Non-standard; used by `auth/login`.
              type: *ref_3
              additionalProperties: true
              x-parser-schema-id: <anonymous-schema-24>
            id: *ref_4
            method:
              type: string
              const: unsubscribe
              x-parser-schema-id: <anonymous-schema-25>
            params:
              description: >-
                Params for `unsubscribe`. `channels` is optional.


                When omitted (or null) the connection unsubscribes from all
                channels.
              type: object
              properties:
                channels:
                  default: null
                  type: *ref_5
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-27>
                  x-parser-schema-id: <anonymous-schema-26>
              x-parser-schema-id: UnsubscribeParams
          x-parser-schema-id: <anonymous-schema-23>
        title: Unsubscribe request
        description: >-
          Send to unsubscribe: list the channel addresses to drop in
          params.channels, or omit it to unsubscribe from everything.
        example: |-
          {
            "method": "<string>",
            "params": {}
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribeRequest
    bindings: []
    extensions: *ref_6
sendOperations:
  - *ref_7
receiveOperations:
  - *ref_8
sendMessages:
  - *ref_9
  - *ref_10
receiveMessages:
  - *ref_11
extensions:
  - id: x-parser-unique-object-id
    value: tradesByInstrument
securitySchemes: []

````

## Related topics

- [Trades by instrument type currency](/api-reference/channels/tradesbyinstrumenttypecurrency.md)
- [Get trade OHLCV candles for an instrument](/api-reference/market-data/get-trade-ohlcv-candles-for-an-instrument.md)
- [Trades by instrument type currency tx status](/api-reference/channels/tradesbyinstrumenttypecurrencytxstatus.md)
