Ticker
Subscribe to the ticker stream.
note
- This topic utilises the snapshot field and delta field. If a response param is not found in the message, then its value has not changed.
- Spot & Option tickers message are
snapshot
only
Push frequency: Derivatives & Options - 100ms, Spot - real-time
Topic:
tickers.{symbol}
Response Parameters
- Linear/Inverse
- Option
- Spot
Parameter | Type | Comments |
---|---|---|
topic | string | Topic name |
type | string | Data type. snapshot ,delta |
cs | integer | Cross sequence |
ts | number | The timestamp (ms) that the system generates the data |
data | array | Object |
> symbol | string | Symbol name |
> tickDirection | string | Tick direction |
> price24hPcnt | string | Percentage change of market price in the last 24 hours |
> lastPrice | string | Last price |
> prevPrice24h | string | Market price 24 hours ago |
> highPrice24h | string | The highest price in the last 24 hours |
> lowPrice24h | string | The lowest price in the last 24 hours |
> prevPrice1h | string | Market price an hour ago |
> markPrice | string | Mark price |
> indexPrice | string | Index price |
> openInterest | string | Open interest size |
> openInterestValue | string | Open interest value |
> turnover24h | string | Turnover for 24h |
> volume24h | string | Volume for 24h |
> nextFundingTime | string | Next funding timestamp (ms) |
> fundingRate | string | Funding rate |
> bid1Price | string | Best bid price |
> bid1Size | string | Best bid size |
> ask1Price | string | Best ask price |
> ask1Size | string | Best ask size |
> deliveryTime | datetime | Delivery date time (UTC+0). Unique field for inverse futures & USDC futures |
> basisRate | string | Basis rate. Unique field for inverse futures & USDC futures |
> deliveryFeeRate | string | Delivery fee rate. Unique field for inverse futures & USDC futures |
> predictedDeliveryPrice | string | Predicated delivery price. Unique field for inverse futures & USDC futures |
> preOpenPrice | string | Estimated pre-market contract open price |
> preQty | string | Estimated pre-market contract open qty |
> curPreListingPhase | string | The current pre-market contract phase |
Parameter | Type | Comments |
---|---|---|
topic | string | Topic name |
type | string | Data type. snapshot |
id | string | message ID |
ts | number | The timestamp (ms) that the system generates the data |
data | array | Object |
> symbol | string | Symbol name |
> bidPrice | string | Best bid price |
> bidSize | string | Best bid size |
> bidIv | string | Best bid iv |
> askPrice | string | Best ask price |
> askSize | string | Best ask size |
> askIv | string | Best ask iv |
> lastPrice | string | Last price |
> highPrice24h | string | The highest price in the last 24 hours |
> lowPrice24h | string | The lowest price in the last 24 hours |
> markPrice | string | Mark price |
> indexPrice | string | Index price |
> markPriceIv | string | Mark price iv |
> underlyingPrice | string | Underlying price |
> openInterest | string | Open interest size |
> turnover24h | string | Turnover for 24h |
> volume24h | string | Volume for 24h |
> totalVolume | string | Total volume |
> totalTurnover | string | Total turnover |
> delta | string | Delta |
> gamma | string | Gamma |
> vega | string | Vega |
> theta | string | Theta |
> predictedDeliveryPrice | string | Predicated delivery price. It has value when 30 min before delivery |
> change24h | string | The change in the last 24 hous |
Parameter | Type | Comments |
---|---|---|
topic | string | Topic name |
ts | number | The timestamp (ms) that the system generates the data |
type | string | Data type. snapshot |
cs | integer | Cross sequence |
data | array | Object |
> symbol | string | Symbol name |
> lastPrice | string | Last price |
> highPrice24h | string | The highest price in the last 24 hours |
> lowPrice24h | string | The lowest price in the last 24 hours |
> prevPrice24h | string | Percentage change of market price relative to 24h |
> volume24h | string | Volume for 24h |
> turnover24h | string | Turnover for 24h |
> price24hPcnt | string | Percentage change of market price relative to 24h |
> usdIndexPrice | string | USD index price
|
Subscribe Example
- Linear
- Option
- Spot
from pybit.unified_trading import WebSocket
from time import sleep
ws = WebSocket(
testnet=True,
channel_type="linear",
)
def handle_message(message):
print(message)
ws.ticker_stream(
symbol="BTCUSDT",
callback=handle_message
)
while True:
sleep(1)
from pybit.unified_trading import WebSocket
from time import sleep
ws = WebSocket(
testnet=True,
channel_type="option",
)
def handle_message(message):
print(message)
ws.ticker_stream(
symbol="tickers.BTC-22JAN23-17500-C",
callback=handle_message
)
while True:
sleep(1)
from pybit.unified_trading import WebSocket
from time import sleep
ws = WebSocket(
testnet=True,
channel_type="spot",
)
def handle_message(message):
print(message)
ws.ticker_stream(
symbol="BTCUSDT",
callback=handle_message
)
while True:
sleep(1)
Response Example
- Linear
- Option
- Spot
{
"topic": "tickers.BTCUSDT",
"type": "snapshot",
"data": {
"symbol": "BTCUSDT",
"tickDirection": "PlusTick",
"price24hPcnt": "0.017103",
"lastPrice": "17216.00",
"prevPrice24h": "16926.50",
"highPrice24h": "17281.50",
"lowPrice24h": "16915.00",
"prevPrice1h": "17238.00",
"markPrice": "17217.33",
"indexPrice": "17227.36",
"openInterest": "68744.761",
"openInterestValue": "1183601235.91",
"turnover24h": "1570383121.943499",
"volume24h": "91705.276",
"nextFundingTime": "1673280000000",
"fundingRate": "-0.000212",
"bid1Price": "17215.50",
"bid1Size": "84.489",
"ask1Price": "17216.00",
"ask1Size": "83.020"
},
"cs": 24987956059,
"ts": 1673272861686
}
{
"id": "tickers.BTC-6JAN23-17500-C-2480334983-1672917511074",
"topic": "tickers.BTC-6JAN23-17500-C",
"ts": 1672917511074,
"data": {
"symbol": "BTC-6JAN23-17500-C",
"bidPrice": "0",
"bidSize": "0",
"bidIv": "0",
"askPrice": "10",
"askSize": "5.1",
"askIv": "0.514",
"lastPrice": "10",
"highPrice24h": "25",
"lowPrice24h": "5",
"markPrice": "7.86976724",
"indexPrice": "16823.73",
"markPriceIv": "0.4896",
"underlyingPrice": "16815.1",
"openInterest": "49.85",
"turnover24h": "446802.8473",
"volume24h": "26.55",
"totalVolume": "86",
"totalTurnover": "1437431",
"delta": "0.047831",
"gamma": "0.00021453",
"vega": "0.81351067",
"theta": "-19.9115368",
"predictedDeliveryPrice": "0",
"change24h": "-0.33333334"
},
"type": "snapshot"
}
{
"topic": "tickers.BTCUSDT",
"ts": 1673853746003,
"type": "snapshot",
"cs": 2588407389,
"data": {
"symbol": "BTCUSDT",
"lastPrice": "21109.77",
"highPrice24h": "21426.99",
"lowPrice24h": "20575",
"prevPrice24h": "20704.93",
"volume24h": "6780.866843",
"turnover24h": "141946527.22907118",
"price24hPcnt": "0.0196",
"usdIndexPrice": "21120.2400136"
}
}