---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk-predictions/realtime/variables/predictionsTopics.md
---
[Reference](../../../../index.md) / [@getenginex/sdk-predictions/realtime](../index.md) / predictionsTopics

# predictionsTopics

> `const` **predictionsTopics**: `object`

Predictions realtime topics, for `realtime.subscribe` from `@getenginex/sdk/realtime`. The
three market ones are public (they work without a session); `orders()` is private: it uses the session's
user and requires login. All enums arrive in lowercase, without the protobuf prefix.

## Type Declaration

### market()

> **market**(`input`): [`Topic`](../../../sdk/extension/interfaces/Topic.md)<[`MarketUpdate`](../interfaces/MarketUpdate.md)>

Prices, volume and status of a market (`market:<marketId>`, `market_update`). The sequenced-mode
snapshot has the same format and is delivered (`meta.kind === 'snapshot'`).

#### Parameters

##### input

`MarketTopicInput`

`marketId`: market id.

#### Returns

[`Topic`](../../../sdk/extension/interfaces/Topic.md)<[`MarketUpdate`](../interfaces/MarketUpdate.md)>

#### Example

```ts
realtime.subscribe(predictionsTopics.market({ marketId: 'mkt-1' }), (m) => setPrice(m.lastPriceYes))
```

#### Throws

`CONFIGURATION_ERROR`, as in `orderbook`.

### orderbook()

> **orderbook**(`input`): [`Topic`](../../../sdk/extension/interfaces/Topic.md)<[`OrderbookUpdate`](../interfaces/OrderbookUpdate.md)>

Orderbook of a market (`predictions:orderbook:<marketId>`, `orderbook_update` messages). In
sequenced mode the snapshot is delivered (`meta.kind === 'snapshot'`). The SDK does not apply deltas:
load the base with `markets.getOrderbook` and reload on `onResync`.

#### Parameters

##### input

`MarketTopicInput`

`marketId`: market id.

#### Returns

[`Topic`](../../../sdk/extension/interfaces/Topic.md)<[`OrderbookUpdate`](../interfaces/OrderbookUpdate.md)>

#### Example

```ts
realtime.subscribe(predictionsTopics.orderbook({ marketId: 'mkt-1' }), (book, meta) => apply(book, meta.kind))
```

#### Throws

`CONFIGURATION_ERROR` if `marketId` is empty or outside
`^[a-zA-Z0-9_:.-]+$` (letters, digits, `_`, `:`, `.`, `-`).

### orders()

> **orders**(): [`Topic`](../../../sdk/extension/interfaces/Topic.md)<[`OrderStatusUpdate`](../interfaces/OrderStatusUpdate.md)>

Status changes of the user's orders (`predictions:orders:<sub>`, `order_status_update`).
Private: the id is the session's `sub`. `realtime.subscribe` without a session throws `UNAUTHENTICATED`.

#### Returns

[`Topic`](../../../sdk/extension/interfaces/Topic.md)<[`OrderStatusUpdate`](../interfaces/OrderStatusUpdate.md)>

#### Example

```ts
realtime.subscribe(predictionsTopics.orders(), (o) => console.log(o.orderId, o.status))
```

#### Throws

`CONFIGURATION_ERROR` if it receives an id (the topic takes no arguments).

### trades()

> **trades**(`input`): [`Topic`](../../../sdk/extension/interfaces/Topic.md)<[`TradeUpdate`](../interfaces/TradeUpdate.md)>

Executed trades of a market (`predictions:trades:<marketId>`, `trade_update`). The sequenced-mode
snapshot (price history, another format) is **not** delivered: use
`markets.getPriceHistory` for the base.

#### Parameters

##### input

`MarketTopicInput`

`marketId`: market id.

#### Returns

[`Topic`](../../../sdk/extension/interfaces/Topic.md)<[`TradeUpdate`](../interfaces/TradeUpdate.md)>

#### Example

```ts
realtime.subscribe(predictionsTopics.trades({ marketId: 'mkt-1' }), (t) => tape.push(t))
```

#### Throws

`CONFIGURATION_ERROR`, as in `orderbook`.

## Example

```ts
import { createRealtime } from '@getenginex/sdk/realtime'
import { predictionsTopics } from '@getenginex/sdk-predictions/realtime'

const realtime = createRealtime(enginex)
const off = realtime.subscribe(predictionsTopics.orderbook({ marketId: 'mkt-1' }), (book) => render(book))
```
