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

# Market Data Streaming

> Connect to TradeWatch WebSocket API for real-time market data streaming. Subscribe to live forex, crypto, stock, and commodity price updates instantly.

<Tip>
  **Don't have an API key?** [Start your free trial](https://dash.tradewatch.io/register) — WebSocket access is included from the Pro plan onwards. No credit card required.
</Tip>

<Steps>
  <Step title="Install WebSocket client">
    We recommend using [websocat](https://github.com/vi/websocat) for testing WebSocket connections.

    <CodeGroup>
      ```bash macOS theme={null}
      brew install websocat
      ```

      ```bash Linux theme={null}
      wget -qO websocat https://github.com/vi/websocat/releases/latest/download/websocat.x86_64-unknown-linux-musl
      chmod a+x websocat
      sudo mv websocat /usr/local/bin/
      ```

      ```bash Windows theme={null}
      Pre-built binaries for Windows, OS X and Android are available on the releases page: https://github.com/vi/websocat/releases
      ```
    </CodeGroup>
  </Step>

  <Step title="Connect">
    Connect to the WebSocket API using your API key. Replace `<YOUR_API_KEY>` with your actual key. You can connect to any of the supported channels, such as `currencies/quotes`.

    ```bash theme={null}
    websocat -H='api-key: <YOUR-API-KEY>' wss://api.tradewatch.io/currencies/quotes
    ```

    Upon connecting, you will receive a status message indicating the current subscriptions (initially empty):

    ```json theme={null}
    {"event": "status", "symbols": []}
    ```
  </Step>

  <Step title="Subscribe">
    Once connected, paste the following JSON message to subscribe to currency pairs:

    ```json theme={null}
    {
      "action": "subscribe",
      "symbols": [
        "EURUSD",
        "GBPUSD"
      ]
    }
    ```
  </Step>

  <Step title="Receive Data">
    You will receive a status message confirming your subscription, followed by live quote updates.

    ```json theme={null}
    {"event": "status", "symbols": ["EURUSD", "GBPUSD"]}
    {"symbol": "EURUSD", "timestamp": "1767389239253", "ask": "1.17174", "bid": "1.17164", "mid": "1.17169"}
    {"symbol": "GBPUSD", "timestamp": "1767389242294", "ask": "1.34556", "bid": "1.34543", "mid": "1.3455"}
    ```
  </Step>

  <Step title="Unsubscribe">
    To stop receiving updates for specific symbols, send an unsubscribe message:

    ```json theme={null}
    {
      "action": "unsubscribe",
      "symbols": [
        "EURUSD"
      ]
    }
    ```

    You will receive a confirmation message with the list of remaining subscribed symbols:

    ```json theme={null}
    {"event": "status", "symbols": ["GBPUSD"]}
    ```
  </Step>
</Steps>

## What's Next

Now that you're connected, check out these resources to build your integration:

<CardGroup cols={2}>
  <Card title="API Reference" icon="book" href="/websocket-api/introduction">
    Explore the full WebSocket API reference documentation.
  </Card>

  <Card title="HTTP API Quickstart" icon="globe" href="/quickstart/http-api">
    Need on-demand data? Get started with the REST API.
  </Card>
</CardGroup>

If the connection closes unexpectedly or a subscription does not produce data, see [Errors & Troubleshooting](/platform/errors-and-troubleshooting).

<Card title="Start streaming live market data →" icon="bolt" href="https://dash.tradewatch.io/register" color="#B63592">
  Get your API key and connect to real-time Forex, Crypto, Stocks, and Indices feeds in minutes.
</Card>
