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

# Price by token

> Subscribe to price updates for a specific token from the primary pool



## AsyncAPI

````yaml datastream/prices.json priceByToken
id: priceByToken
title: Price by token
description: Subscribe to price updates for a specific token from the primary pool
servers:
  - id: production
    protocol: wss
    host: datastream.solanatracker.io
    bindings: []
    variables:
      - id: apiKey
        description: Your unique API key from Data API subscription
        allowedValues: []
        examples: []
address: /
parameters: []
bindings: []
operations:
  - &ref_1
    id: subscribeToPriceToken
    title: Subscribe to price token
    description: Subscribe to token price
    type: receive
    messages:
      - &ref_5
        id: joinPriceToken
        payload:
          - name: joinPriceToken
            description: Subscribe to token price updates
            type: object
            properties:
              - name: type
                type: string
                description: join
                required: true
              - name: room
                type: string
                description: Price token room (price-by-token:{tokenAddress})
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - room
          properties:
            type:
              type: string
              const: join
              default: join
              x-parser-schema-id: <anonymous-schema-47>
            room:
              type: string
              pattern: ^price-by-token:[A-Za-z0-9]{32,44}$
              description: Price token room (price-by-token:{tokenAddress})
              default: price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
              x-parser-schema-id: <anonymous-schema-48>
          examples:
            - type: join
              room: price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
          x-parser-schema-id: <anonymous-schema-46>
        title: Join price token
        description: Subscribe to token price updates
        example: |-
          {
            "type": "join",
            "room": "price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: joinPriceToken
          - id: x-parser-message-name
            value: joinPriceToken
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: priceByToken
  - &ref_3
    id: receivePriceTokenConfirmation
    title: Receive price token confirmation
    description: Receive confirmation
    type: send
    messages:
      - &ref_7
        id: priceTokenJoined
        payload:
          - name: priceTokenJoined
            description: Token price subscription confirmed
            type: object
            properties:
              - name: type
                type: string
                description: joined
                required: false
              - name: room
                type: string
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              const: joined
              x-parser-schema-id: <anonymous-schema-50>
            room:
              type: string
              x-parser-schema-id: <anonymous-schema-51>
          examples:
            - type: joined
              room: price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
          x-parser-schema-id: <anonymous-schema-49>
        title: Price token joined
        description: Token price subscription confirmed
        example: |-
          {
            "type": "joined",
            "room": "price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: priceTokenJoined
          - id: x-parser-message-name
            value: priceTokenJoined
    bindings: []
    extensions: *ref_0
  - &ref_4
    id: receivePriceTokenData
    title: Receive price token data
    description: Receive price updates
    type: send
    messages:
      - &ref_8
        id: priceTokenMessage
        payload:
          - name: priceTokenMessage
            description: Token price update notification
            type: object
            properties:
              - name: type
                type: string
                description: message
                required: false
              - name: room
                type: string
                required: false
              - name: data
                type: object
                required: false
                properties:
                  - name: price
                    type: number
                    required: false
                  - name: price_quote
                    type: number
                    required: false
                  - name: pool
                    type: string
                    required: false
                  - name: token
                    type: string
                    required: false
                  - name: time
                    type: integer
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            type:
              type: string
              const: message
              x-parser-schema-id: <anonymous-schema-53>
            room:
              type: string
              x-parser-schema-id: <anonymous-schema-54>
            data:
              type: object
              properties:
                price:
                  type: number
                  x-parser-schema-id: <anonymous-schema-10>
                price_quote:
                  type: number
                  x-parser-schema-id: <anonymous-schema-11>
                pool:
                  type: string
                  x-parser-schema-id: <anonymous-schema-12>
                token:
                  type: string
                  x-parser-schema-id: <anonymous-schema-13>
                time:
                  type: integer
                  x-parser-schema-id: <anonymous-schema-14>
              x-parser-schema-id: PriceUpdate
          examples:
            - type: message
              room: price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
              data:
                price: 0.008006
                price_quote: 0.00010064
                pool: EWiYmq3nWQpoTkcU4UfGYEoYvDHduDsXhpPvqmoqpump
                token: 9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
                time: 1723728065246
          x-parser-schema-id: <anonymous-schema-52>
        title: Price token message
        description: Token price update notification
        example: |-
          {
            "type": "message",
            "room": "price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
            "data": {
              "price": 0.008006,
              "price_quote": 0.00010064,
              "pool": "EWiYmq3nWQpoTkcU4UfGYEoYvDHduDsXhpPvqmoqpump",
              "token": "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
              "time": 1723728065246
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: priceTokenMessage
          - id: x-parser-message-name
            value: priceTokenMessage
    bindings: []
    extensions: *ref_0
  - &ref_2
    id: unsubscribeFromPriceToken
    title: Unsubscribe from price token
    description: Unsubscribe
    type: receive
    messages:
      - &ref_6
        id: leavePriceToken
        payload:
          - name: leavePriceToken
            description: Unsubscribe from token price
            type: object
            properties:
              - name: type
                type: string
                description: leave
                required: true
              - name: room
                type: string
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - room
          properties:
            type:
              type: string
              const: leave
              default: leave
              x-parser-schema-id: <anonymous-schema-56>
            room:
              type: string
              default: price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
              x-parser-schema-id: <anonymous-schema-57>
          examples:
            - type: leave
              room: price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
          x-parser-schema-id: <anonymous-schema-55>
        title: Leave price token
        description: Unsubscribe from token price
        example: |-
          {
            "type": "leave",
            "room": "price-by-token:9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: leavePriceToken
          - id: x-parser-message-name
            value: leavePriceToken
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
  - *ref_2
receiveOperations:
  - *ref_3
  - *ref_4
sendMessages:
  - *ref_5
  - *ref_6
receiveMessages:
  - *ref_7
  - *ref_8
extensions:
  - id: x-parser-unique-object-id
    value: priceByToken
securitySchemes:
  - id: apiKeyAuth
    name: apiKey
    type: httpApiKey
    description: >-
      API key for authentication. Include your Datastream key in the connection
      URL: wss://datastream.solanatracker.io/{DATASTREAM_KEY}
    in: header
    extensions: []

````