> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allium.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch historical PnL by Wallet

> Get the Historical PnL for a given wallet address.

export const SupportedChainsList = props => {
  const [data, setData] = useState(null);
  const [isLoading, setIsLoading] = useState(true);
  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await fetch("https://api.allium.so/api/v1/supported-chains/realtime-apis", {
          method: "GET"
        });
        if (!response.ok) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }
        const responseData = await response.json();
        const filteredData = responseData.filter(entry => {
          const product = entry.endpoints[props.product_name];
          return product !== null;
        });
        setData(filteredData);
        setIsLoading(false);
      } catch (error) {
        setIsLoading(false);
      }
    };
    fetchData();
  }, []);
  if (isLoading) {
    return <div>Loading chain information...</div>;
  }
  if (!data) {
    return <div>No data available</div>;
  }
  const isCustomSQL = props.product_name === "custom_sql";
  return <div>
            {data.length > 0 && <table className="w-full">
                    <thead>
                        <tr>
                            <th>Chain</th>
                            <th>Chain ID</th>
                            <th>Status</th>
                            {isCustomSQL && <th>Tables</th>}
                        </tr>
                    </thead>
                    <tbody>
                        {data.map(chain => {
    const endpoint = chain.endpoints[props.product_name];
    return <tr key={chain.id}>
                                    <td style={{
      padding: '12px'
    }}>{chain.label}</td>
                                    <td style={{
      padding: '12px'
    }}><code>{chain.id}</code></td>
                                    <td style={{
      padding: '12px'
    }}>{endpoint ? endpoint.availability === "beta" ? "🌱 Beta" : "✅ Supported" : "❌ Not Supported"}</td>
                                    {isCustomSQL && <td style={{
      padding: '12px'
    }}>
                                            {endpoint && endpoint.tables ? endpoint.tables.map(t => t.name).join(", ") : "-"}
                                        </td>}
                                </tr>;
  })}
                    </tbody>
                </table>}
        </div>;
};

This endpoint provides unrealized and realized PnL for wallet addresses at specified time periods and granularities.

## Time Range Parameters

* `start_timestamp` - Beginning of the time range (inclusive)
* `end_timestamp` - End of the time range (exclusive)
* Both timestamps are assumed to be in UTC if no timezone is specified
* All returned data is in UTC

## Granularity Options

* `1d` - Daily intervals
* `1h` - Hourly intervals
* `5m` - 5-minute intervals
* `1m` - 1-minute intervals
* `15s` - 15-second intervals

### Granularity Constraints

The allowed granularity depends on the requested time range:

| Time Range      | Finest Granularity Allowed |
| :-------------- | :------------------------- |
| 0 - 24 hours    | `15s`                      |
| 1 - 7 days      | `5m`                       |
| 1 week - 1 year | `1h`                       |
| Over 1 year     | `1d`                       |

## Supported Chains

<SupportedChainsList product_name="pnl" />


## OpenAPI

````yaml /_openapi/pnl-api.json POST /api/v1/developer/wallet/pnl/history
openapi: 3.1.0
info:
  title: Allium API
  version: 0.1.0
servers:
  - url: https://api.allium.so
security: []
paths:
  /api/v1/developer/wallet/pnl/history:
    post:
      tags:
        - PNL
        - DEVELOPER
        - WALLET
      summary: Get Pnl History
      operationId: get_pnl_history_api_v1_developer_wallet_pnl_history_post
      parameters:
        - name: min_liquidity
          in: query
          required: false
          schema:
            description: >-
              Minimum liquidity of which tokens must have to be included in the
              response.
            title: Min Liquidity
            type: number
          description: >-
            Minimum liquidity of which tokens must have to be included in the
            response.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayloadHistoricalPnlByWallet'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ResponseEnvelope_Union_HistoricalPnl__PnlError__
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyBearer: []
components:
  schemas:
    PayloadHistoricalPnlByWallet:
      properties:
        start_timestamp:
          type: string
          format: date-time
          title: Start Timestamp
          description: Start of time range (UTC ISO 8601)
        end_timestamp:
          type: string
          format: date-time
          title: End Timestamp
          description: End of time range (UTC ISO 8601)
        granularity:
          $ref: '#/components/schemas/PnlGranularity'
          description: Time interval granularity (1d, 1h, 5m, 1m, 15s)
        addresses:
          items:
            $ref: '#/components/schemas/PayloadAddress'
          type: array
          maxItems: 20
          minItems: 1
          title: Addresses
          description: List of wallet chain+address pairs
      type: object
      required:
        - start_timestamp
        - end_timestamp
        - granularity
        - addresses
      title: PayloadHistoricalPnlByWallet
      example:
        addresses:
          - address: 125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp
            chain: solana
        end_timestamp: '2025-04-10T00:00:00Z'
        granularity: 1h
        start_timestamp: '2025-04-01T00:00:00Z'
    ResponseEnvelope_Union_HistoricalPnl__PnlError__:
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/HistoricalPnl'
            - $ref: '#/components/schemas/PnlError'
            - type: 'null'
          title: Data
          description: Single item response data of type T
        items:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/HistoricalPnl'
                  - $ref: '#/components/schemas/PnlError'
              type: array
            - type: 'null'
          title: Items
          description: Response items of type T
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message
        cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Cursor
          description: Pagination cursor for next page
      type: object
      title: ResponseEnvelope[Union[HistoricalPnl, PnlError]]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PnlGranularity:
      type: string
      enum:
        - 1h
        - 1d
        - 1m
        - 5m
        - 15s
      title: PnlGranularity
    PayloadAddress:
      properties:
        chain:
          type: string
          title: Chain
          description: Lowercase chain name
        address:
          type: string
          title: Address
          description: Wallet address
      type: object
      required:
        - chain
        - address
      title: PayloadAddress
      examples:
        - address: '0xab16781a13fe343a275f4bb5c883a64ceda52917'
          chain: ethereum
        - address: 125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp
          chain: solana
    HistoricalPnl:
      properties:
        chain:
          type: string
          title: Chain
          description: Lowercase chain name
        address:
          type: string
          title: Address
          description: Wallet address
        pnl:
          items:
            $ref: '#/components/schemas/TimeIntervalPnl'
          type: array
          title: Pnl
          description: PnL snapshots per time interval
      type: object
      required:
        - chain
        - address
        - pnl
      title: HistoricalPnl
      example:
        address: 125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp
        chain: solana
        pnl:
          - realized_pnl:
              amount: '0.002335373911312482'
              currency: USD
            timestamp: '2026-03-19T22:00:00Z'
            unrealized_pnl:
              amount: '0.145848378518889629'
              currency: USD
          - realized_pnl:
              amount: '0.002335373911312482'
              currency: USD
            timestamp: '2026-03-19T23:00:00Z'
            unrealized_pnl:
              amount: '0.137894957302491137'
              currency: USD
    PnlError:
      properties:
        chain:
          type: string
          title: Chain
          description: Lowercase chain name
        address:
          type: string
          title: Address
          description: Wallet address
        message:
          type: string
          title: Message
          description: Error description
      type: object
      required:
        - chain
        - address
        - message
      title: PnlError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    TimeIntervalPnl:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: Interval start time (UTC)
        unrealized_pnl:
          $ref: '#/components/schemas/CurrencyAmount'
          description: Unrealized PnL at this interval (USD)
        realized_pnl:
          $ref: '#/components/schemas/CurrencyAmount'
          description: Cumulative realized PnL at this interval (USD)
      type: object
      required:
        - timestamp
        - unrealized_pnl
        - realized_pnl
      title: TimeIntervalPnl
    CurrencyAmount:
      properties:
        currency:
          $ref: '#/components/schemas/Currency'
          description: Currency code
          default: USD
        amount:
          type: string
          title: Amount
          description: Value in the specified currency
      type: object
      required:
        - amount
      title: CurrencyAmount
    Currency:
      type: string
      enum:
        - USD
      title: Currency
  securitySchemes:
    APIKeyBearer:
      type: apiKey
      in: header
      name: X-API-KEY

````