> For the complete documentation index, see [llms.txt](https://docs.definest.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.definest.ai/api/wallet-analytics/wallet-pnl-chart.md).

# Wallet PNL chart

## GET /wallets/{address}/charts/pnl

> Returns wallet PNL chart data.\
> Require period or custom time to be set. \
> To set custom time interval use \`from\_time\` and \`to\_time\` params.<br>

```json
{"openapi":"3.1.0","info":{"title":"Analytics API","version":"1.0.4"},"tags":[{"name":"wallet","description":"Wallet"}],"servers":[{"url":"https://definest.ai/api/analytics/v1","description":"Production server"}],"security":[{"xApiKey":[]}],"components":{"securitySchemes":{"xApiKey":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key for authentication"}},"parameters":{"WalletAddressPathParam":{"name":"address","in":"path","description":"Wallet address","required":true,"schema":{"$ref":"#/components/schemas/Wallet/properties/address"}},"BlockchainNetworkQueryParam":{"name":"network","in":"query","description":"Blockchain network","required":true,"schema":{"$ref":"#/components/schemas/BlockchainNetwork"}},"PeriodQueryParam":{"name":"period","in":"query","description":"Time period","schema":{"$ref":"#/components/schemas/Period"}},"FromTimeQueryParam":{"name":"from_time","in":"query","description":"Timestamp in seconds. \nMinimum time for the deal's first trade.\nDeals started before this time will be excluded from result and calculations.\n","schema":{"type":["integer","number"],"minimum":1}},"ToTimeQueryParam":{"name":"to_time","in":"query","description":"Timestamp in seconds. \nMaximum time for deal trades. \nTrades executed after this time will be excluded from result and calculations.\n","schema":{"type":["integer","number"],"minimum":1}}},"schemas":{"Wallet":{"properties":{"address":{"type":"string","description":"Wallet address"}}},"BlockchainNetwork":{"type":"string","enum":["eth","sol"],"description":"Supported blockchain networks"},"Period":{"type":"string","description":"Time period","enum":["12h","24h","2d","3d","7d","10d","14d","20d","1m","2m","3m","6m","1y","2y"]},"PnlChart":{"type":"object","description":"PNL chart data","properties":{"timestamps":{"$ref":"#/components/schemas/ChartTimestampsArray"},"initial_values":{"type":"array","description":"Array of initial PNL values corresponding to each timestamp. In USD ($)","items":{"$ref":"#/components/schemas/PnlValue"}},"following_values":{"type":"array","description":"Array of following PNL values corresponding to each timestamp. In USD ($)","items":{"$ref":"#/components/schemas/PnlValue"}},"period":{"$ref":"#/components/schemas/ChartPeriod"}},"required":["timestamps","initial_values","following_values","period"]},"ChartTimestampsArray":{"type":"array","description":"Array of timestamps for each data point","items":{"type":["integer"],"description":"UNIX timestamp in seconds"}},"PnlValue":{"type":["number"],"description":"PNL value in USD ($)"},"ChartPeriod":{"type":"object","properties":{"start":{"type":["integer"],"description":"Start timestamp of the chart period in seconds"},"end":{"type":["integer"],"description":"End timestamp of the chart period in seconds"}},"required":["start","end"]},"ResponseCredits":{"type":"object","description":"Credits data after request","properties":{"spent":{"type":"integer","description":"Credits spent on the request"},"remaining":{"type":"integer","description":"Remaining credits"}},"required":["spent","remaining"]}},"responses":{"400BadRequest":{"description":"Request fail","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"Error short code"},"detail":{"description":"Detailed error description"}},"required":["code"]}}}},"401Unauthorized":{"description":"API Key invalid or missing"},"403Forbidden":{"description":"API access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"Error short code"},"detail":{"description":"Detailed error description"}},"required":["code"]}}}}}},"paths":{"/wallets/{address}/charts/pnl":{"get":{"description":"Returns wallet PNL chart data.\nRequire period or custom time to be set. \nTo set custom time interval use `from_time` and `to_time` params.\n","tags":["wallet"],"parameters":[{"$ref":"#/components/parameters/WalletAddressPathParam"},{"$ref":"#/components/parameters/BlockchainNetworkQueryParam"},{"name":"type","in":"query","description":"PNL type. Only `realized` is available","schema":{"type":["string"],"enum":["realized"],"default":"realized"}},{"$ref":"#/components/parameters/PeriodQueryParam"},{"$ref":"#/components/parameters/FromTimeQueryParam"},{"$ref":"#/components/parameters/ToTimeQueryParam"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object","properties":{"chart":{"$ref":"#/components/schemas/PnlChart"}},"required":["chart"]},"credits":{"$ref":"#/components/schemas/ResponseCredits"}},"required":["result","credits"]}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.definest.ai/api/wallet-analytics/wallet-pnl-chart.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
