# Stream Accounting API

## Overview

Streams move value every second, but accounting tools don’t record value transfer on a real-time basis (typically it’s monthly). The Stream Accounting API can be used to represent your streams in a manner that’s consumable by your traditional accounting tools.

## Functionality

The Stream Accounting API is RESTful and exposes a single endpoint which allows for fetching stream data across all Superfluid tokens and networks.

The API lets you **chop up the amounts an address has been streaming over time into accounting periods of your choice** (monthly, daily, even hourly).

**Token Pricing**

If the token you are streaming has price tracking from Coingecko, then you will be able to get price information for each period in a currency of your choice as well. You can also select price granularity. This lets you choose whether you want to get your prices as an average over a lagging timeframe of your choice or just the instantaneous price for each period.

**Accommodating Flow Rate Updates**

The Stream Accounting API accommodates changes in stream flow rates. Basically, a “stream period” is a period over which a stream’s flow rate is the same. Once the flow rate is updated, a new stream period begins. When getting accounting data over a certain duration in which the account in concern has a stream whose flow rate has been updated, you’ll see that the data is segmented into separate stream periods for each different flow rate.

**Outgoing & Incoming**

The API accounts for both outgoing and incoming streams in the same data export, denoting incoming streams with positive values and outbound streams with negative values.

**All Networks and All Tokens**

The Stream Accounting API supports all Superfluid-supported networks and tokens through use of the [Superfluid Subgraphs](https://docs.superfluid.finance/superfluid/developers/subgraph).

## Example

Alice is paying Bob in a stream of 0.1 ETHx per month.

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2F9rywosn2TnMTuqX1jjRV%2Fimage.png?alt=media&#x26;token=9b992961-85c0-4c29-a1bc-509e553a9835" alt=""><figcaption></figcaption></figure>

You want to get accounting info on the stream Alice is sending on a monthly basis between **June 1st and September 15th**.

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2FnmugmHIwgwhS6do8BOaO%2Fimage.png?alt=media&#x26;token=29fcabc3-f356-49f7-939d-abf2de288db0" alt=""><figcaption></figcaption></figure>

The Stream Accounting API gives you information for the months between June 1st and September 15th.

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2Ftkt0Ex4djIlGjXyZ3Yel%2Fimage.png?alt=media&#x26;token=b039cd1a-eb27-4a19-9b7a-6c29676f006d" alt=""><figcaption></figcaption></figure>

Let’s say Alice had updated her stream to 0.2 ETHx/month on September 15th.

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2FBPxigVWChY5GWxuLKZ6H%2Fimage.png?alt=media&#x26;token=1e7d48f2-290a-42c0-91ba-4e360d3f4b5a" alt=""><figcaption></figcaption></figure>

Now, you want to get accounting info on the stream Alice is sending on a month basis between June 1st and **December 1st**.

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2F0geOUKwUpzECgJaHUL71%2Fimage.png?alt=media&#x26;token=5a3e5346-8253-48b1-a978-fa3f35c642de" alt=""><figcaption></figcaption></figure>

The Stream Accounting API gives you information for the month between June 1st and December 1st.

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2Fz55Bfse37pfdmmhGvTnc%2Fimage.png?alt=media&#x26;token=81db7372-bc4e-49fd-ae20-aea3b26b6cd5" alt=""><figcaption></figcaption></figure>

## Using the Stream Accounting API

{% embed url="<https://superfluidhq.notion.site/Using-the-Stream-Accounting-API-3d161745acfe4750acf43c546f84c724>" %}
