> ## Documentation Index
> Fetch the complete documentation index at: https://sequence-0fb8d9e6-codex-update-discord-invite.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Marketplace Analytics Examples

Additionally, you can get deep insights into how your Sequence Marketplace is performing so you can report, track, and refine to earn more revenue.

<Note>
  Replace the PROJECT\_ID and SECRET\_API\_ACCESS\_KEY variables with your project ID and
  secret token from Sequence Builder.
</Note>

## Fetch Transactions on your Marketplace

Fetching the number of transaction events on the Sequence marketplace - these can used either be by total or a fixed time interval.

### Total

<CodeGroup>
  ```sh cURL theme={null}
  curl 'https://api.sequence.build/rpc/Analytics/MarketTxnEventTotal' \
    -H 'accept: */*' \
    -H 'authorization: BEARER <SECRET_API_ACCESS_KEY>' \
    -H 'content-type: application/json' \
    --data-raw '{"filter":{"projectId":<PROJECT_ID>,"startDate":"2024-04-23","endDate":"2024-05-23"}}'
  ```

  ```ts TypeScript theme={null}
  // Works in both a Webapp (browser) or Node.js by importing cross-fetch:
  // import fetch from "cross-fetch";
  (async () => {
    const res = await fetch(
      "https://api.sequence.build/rpc/Analytics/MarketTxnEventTotal",
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json"
        },
        body: JSON.stringify({
          filter: {
            projectId: 4859,
            startDate: "2024-01-23",
            endDate: "2024-05-23",
            dateInterval: "DAY"
          }
        })
      }
    );
    console.log("res", await res.json());
  })();
  ```
</CodeGroup>

### Time Interval

<CodeGroup>
  ```sh cURL theme={null}
  curl 'https://api.sequence.build/rpc/Analytics/MarketTxnEventDaily' \
    -H 'accept: */*' \
    -H 'authorization: BEARER <SECRET_API_ACCESS_KEY>' \
    -H 'content-type: application/json' \
    --data-raw '{"filter":{"projectId":<PROJECT_ID>,"startDate":"2024-04-23","endDate":"2024-05-23", "dateInterval":"DAY"}}'
  ```

  ```ts TypeScript theme={null}
  // Works in both a Webapp (browser) or Node.js by importing cross-fetch:
  // import fetch from "cross-fetch";
  (async () => {
    const res = await fetch(
      "https://api.sequence.build/rpc/Analytics/MarketTxnEventDaily",
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json"
        },
        body: JSON.stringify({
          filter: {
            projectId: 4859,
            startDate: "2024-01-23",
            endDate: "2024-05-23",
            dateInterval: "DAY"
          }
        })
      }
    );
    console.log("res", await res.json());
  })();
  ```
</CodeGroup>

## Fetch Wallets on your Marketplace

Fetch wallets that have interacted with your marketplace - either by total across all time or broken down by days, weeks or months.

### Total

<CodeGroup>
  ```sh cURL theme={null}
  curl 'https://api.sequence.build/rpc/Analytics/MarketWalletsTotal' \
    -H 'accept: */*' \
    -H 'authorization: BEARER <SECRET_API_ACCESS_KEY>' \
    -H 'content-type: application/json' \
    --data-raw '{"filter":{"projectId":<PROJECT_ID>,"startDate":"2024-04-23","endDate":"2024-05-23"}}'
  ```

  ```ts TypeScript theme={null}
  // Works in both a Webapp (browser) or Node.js by importing cross-fetch:
  // import fetch from "cross-fetch";
  (async () => {
    const res = await fetch("https://api.sequence.build/rpc/Analytics/MarketWalletsTotal", {
      method: "POST",
      headers: {
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        filter: {
          projectId: 4859,
          startDate: "2024-01-23",
          endDate: "2024-05-23",
          dateInterval: "DAY"
        }
      })
    });
    console.log("res", await res.json());
  })();
  ```
</CodeGroup>

### Time Interval

<CodeGroup>
  ```sh cURL theme={null}
  curl 'https://api.sequence.build/rpc/Analytics/MarketWalletsDaily' \
    -H 'accept: */*' \
    -H 'authorization: BEARER <SECRET_API_ACCESS_KEY>' \
    -H 'content-type: application/json' \
    --data-raw '{"filter":{"projectId":<PROJECT_ID>,"startDate":"2024-04-23","endDate":"2024-05-23", "dateInterval":"DAY"}}'
  ```

  ```ts TypeScript theme={null}
  // Works in both a Webapp (browser) or Node.js by importing cross-fetch:
  // import fetch from "cross-fetch";
  (async () => {
    const res = await fetch("https://api.sequence.build/rpc/Analytics/MarketWalletsDaily", {
      method: "POST",
      headers: {
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        filter: {
          projectId: 4859,
          startDate: "2024-01-23",
          endDate: "2024-05-23",
          dateInterval: "DAY"
        }
      })
    });
    console.log("res", await res.json());
  })();
  ```
</CodeGroup>

## Schema

All wallet analytic endpoints follow a similar request schema

* Request: POST
* Content-Type: application/json
* Body (in JSON):
  * `projectId` (uint64) -- projectID of your project, can be found in the URL of the Builder project.
  * `startDate` (timestamp) -- starting date of the query in YYYY--MM--DD format
  * `endDate` (timestamp) -- ending date of the query in YYYY--MM--DD format
  * `dateInterval` (OPTIONAL string) -- date interval for the query, options are "DAY", "WEEK", or "MONTH"
* Response (in JSON):
  * `marketStats` (marketStats\[])
    \[
    * `value`
      * `buyItems` (uint64) -- number of items bought.
      * `sellItems` (uint64) -- number of items sold
    * `label` (string) -- label associated with the corresponding endpoint
      ]
