# summarizeActivity

Add up the matching local activity per asset, overall and for each requested period, without returning its rows.
Amounts are summed as recorded whatever their direction: filter by kind to keep incoming and outgoing apart.
It reads through iterateActivity, so the same global deduplication, bounded hydration and cancellation apply,
and nothing is acknowledged or sent anywhere.

## Import

```ts
import { summarizeActivity } from "@0xcurvy/curvy-sdk/actions";
```

## Usage

```ts
const result = await summarizeActivity({ config });
```

## Signature

```ts
function summarizeActivity(parameters?: SummarizeActivityParameters): Promise<ActivitySummary>
```

## Returns

`Promise<ActivitySummary>`

The action resolves or returns the value shown in the signature.

## Parameters

### `accountId`

- **Type:** `string`
- **Required:** no

The account whose activity is summarized. Defaults to the active account.

```ts
const result = await summarizeActivity({
  accountId, // [!code focus]
});
```

### `filters`

- **Type:** `ActivityFilters`
- **Required:** no

Restrict the summary by free-text query, kinds, network slug or vault token id.

```ts
const result = await summarizeActivity({
  filters, // [!code focus]
});
```

### `excludeStatuses`

- **Type:** `readonly ActivityItem["status"][]`
- **Required:** no

Entries in these states are left out, for example failed or reorged ones.

```ts
const result = await summarizeActivity({
  excludeStatuses, // [!code focus]
});
```

### `periods`

- **Type:** `readonly number[]`
- **Required:** no

Period starts in Unix milliseconds, strictly ascending. A period runs to the next start and the last has no
end. Entries before the first start are in no period.

```ts
const result = await summarizeActivity({
  periods, // [!code focus]
});
```

### `batchSize`

- **Type:** `number`
- **Required:** no

Maximum rich history rows hydrated together; defaults to 100.

```ts
const result = await summarizeActivity({
  batchSize, // [!code focus]
});
```

### `signal`

- **Type:** `AbortSignal`
- **Required:** no

Aborts the summary before later batches are hydrated.

```ts
const result = await summarizeActivity({
  signal, // [!code focus]
});
```

### `config`

- **Type:** `CurvyConfig`
- **Required:** no

Curvy config to use. Defaults to the ambient config.

```ts
const result = await summarizeActivity({
  config, // [!code focus]
});
```

## Errors

Errors from config resolution and the underlying SDK operation are propagated to the caller.

## Related

- [Interacting with assets guide](/for-programmers/interacting-with-assets)

## Source

[packages/@0xcurvy/sdk/src/actions/views/summarizeActivity.ts](https://github.com/0xCurvy/curvy-monorepo/blob/main/packages/@0xcurvy/sdk/src/actions/views/summarizeActivity.ts)
