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

# PortfolioApi

The user's positions and portfolio summary. Every method requires a session (`UNAUTHENTICATED` without
one, before any request).

## Methods

### get()

> **get**(`params?`, `options?`): `Promise`<[`Portfolio`](Portfolio.md)>

Portfolio summary: totals, open positions and open orders.

#### Parameters

##### params?

[`NoParams`](../../sdk/type-aliases/NoParams.md)

##### options?

[`CallOptions`](../../sdk/interfaces/CallOptions.md)

#### Returns

`Promise`<[`Portfolio`](Portfolio.md)>

#### Example

```ts
const { totalValue, openPositions, openOrders } = await predictions.portfolio.get()
```

#### Throws

As in [PortfolioApi.listPositions](#listpositions).

***

### getPosition()

> **getPosition**(`input`, `options?`): `Promise`<[`MarketPosition`](MarketPosition.md)>

The user's position in a market, summed per side. Without a position, the numbers come as `0` (not an error).
The gateway sums only the first page of 10 positions of the market.

#### Parameters

##### input

###### marketId

`string`

##### options?

[`CallOptions`](../../sdk/interfaces/CallOptions.md)

#### Returns

`Promise`<[`MarketPosition`](MarketPosition.md)>

#### Example

```ts
const { yesQuantity, yesAvgPrice } = await predictions.portfolio.getPosition({ marketId: 'mkt-1' })
```

#### Throws

`CONFIGURATION_ERROR` without a request if `marketId` is empty, has whitespace
at the start or end, has `/`, is `.` or `..`, and the errors of [PortfolioApi.listPositions](#listpositions).

***

### listPositions()

> **listPositions**(`params?`, `options?`): `Promise`<[`Position`](Position.md)\[]>

Lists the user's positions. The gateway ignores filters and pagination: it always returns the first
page of 100.

#### Parameters

##### params?

[`NoParams`](../../sdk/type-aliases/NoParams.md)

##### options?

[`CallOptions`](../../sdk/interfaces/CallOptions.md)

#### Returns

`Promise`<[`Position`](Position.md)\[]>

#### Example

```ts
const positions = await predictions.portfolio.listPositions()
```

#### Throws

`UNAUTHENTICATED` without a session, `NETWORK_ERROR`, `TIMEOUT`, `ABORTED`,
`VALIDATION_ERROR` or `CONFIGURATION_ERROR` (including after `dispose()`). Identify with
`isEnginexError(error, code)`.
