> For the complete documentation index, see [llms.txt](https://docs.sfox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sfox.com/connect/websocket-api/market-data/users-2.md).

# Ticker

Receive aggregated 24-hour OHLCV data from all supported exchanges and the last price before each update every 3 seconds.&#x20;

Subscriptions to the ticker feed will receive realtime trades that occur on any of the liquidity venues that are active on the sFOX platform.

### Subscription Instructions

<table><thead><tr><th width="272.75611055915493">Subscription Format</th><th>Example</th></tr></thead><tbody><tr><td><code>ticker.sfox.&#x3C;basequote></code></td><td><code>ticker.sfox.btcusd</code></td></tr></tbody></table>

### Payload Details

<table><thead><tr><th width="178">Key</th><th>Description</th></tr></thead><tbody><tr><td><code>amount</code></td><td>Quantity of the most recent trade on this pair</td></tr><tr><td><code>exchange</code></td><td>Location of the most recent trade on this pair</td></tr><tr><td><code>last</code></td><td>Price of the most recent trade on this pair</td></tr><tr><td><code>high</code></td><td>High price since 00:00:00 GMT</td></tr><tr><td><code>low</code></td><td>Low price since 00:00:00 GMT</td></tr><tr><td><code>open</code></td><td>Open price at 00:00:00 GMT</td></tr><tr><td><code>pair</code></td><td>Currency pair</td></tr><tr><td><code>source</code></td><td>Data source</td></tr><tr><td><code>timestamp</code></td><td>Time of the trade</td></tr><tr><td><code>volume</code></td><td>Volume traded since 00:00:00 GMT (base currency)</td></tr><tr><td><code>vwap</code></td><td>Volume-weighted average price since 00:00:00 GMT</td></tr></tbody></table>

### Example Code & Trades Message

{% tabs %}
{% tab title="NodeJS" %}

```javascript
const WebSocket = require('ws')

const ws = new WebSocket('wss://ws.sfox.com/ws')

ws.on('open', function() {
  const authMessage = {
   type: 'authenticate',
   apiKey: '<ENTERPRISE_API_KEY>',
   enterprise: 'true'
  }
  
  ws.send(JSON.stringify(authMessage))
})

// After successful authentication, subscribe to ticker feed
const subscribeMsg = {
  type: 'subscribe',
  feeds: ['ticker.sfox.btcusd', 'ticker.sfox.ethusd']
}

ws.send(JSON.stringify(subscribeMsg))
```

{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import asyncio
import json
import websockets

async def main(uri):
    async with websockets.connect(uri) as ws:
        await ws.send(json.dumps({
            "type": "authenticate",
            "apiKey": "<ENTERPRISE_API_KEY>",
            "enterprise": "true"
        }))

        # After successful authentication message, subscribe to the trades feed
        await ws.send(json.dumps({
            "type": "subscribe",
            "feeds": ["ticker.sfox.btcusd"]
        }))
        async for msg in ws:
            print(msg)


asyncio.run(main("wss://ws.sfox.com/ws"))
```

{% endcode %}
{% endtab %}

{% tab title="Example Message" %}

```json
{
  "sequence": 4,
  "recipient": "ticker.sfox.btcusd",
  "timestamp": 1649901842979345289,
  "payload": {
    "amount": 0.00005737,
    "exchange": "coinbase",
    "high": 41512.43,
    "last": 41420.58,
    "low": 41058.82,
    "open": 41141.31,
    "pair": "btcusd",
    "route": "Smart",
    "source": "ticker-info",
    "timestamp": "2022-04-14T02:04:02.481Z",
    "volume": 1387.77211046,
    "vwap": 41283.96339697249
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sfox.com/connect/websocket-api/market-data/users-2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
